Compare commits

..

No commits in common. "d68b9d1f9d6be7899f2342e3c113d0164f7a8a3f" and "0d53d1593f9df3782c3b0e412010712ab2963d2e" have entirely different histories.

9 changed files with 1 additions and 104 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 753 B

View file

@ -79,7 +79,7 @@ static void writePropertySetHandler(std::ofstream& out, ClassAnalysis state) {
std::string subtype = parseWeakPtr(prop.backingFieldType);
if (prop.flags & PropertyFlag_Readonly) {
out << "\n return AssignToReadOnlyMember(GetClass()->className, name);";
out << "\n return AssignToReadOnlyMember(GetClass()->className, name)";
} else if (prop.cframeMember == CFrameMember_Position) {
out << "\n this->" << prop.fieldName << " = this->" << prop.fieldName << ".Rotation() + value.get<Vector3>();";
} else if (prop.cframeMember == CFrameMember_Rotation) {

View file

@ -7,7 +7,6 @@
#include "objects/service/script/serverscriptservice.h"
#include "datatypes/variant.h"
#include "objects/service/workspace.h"
#include "objects/service/players.h"
#include "logger.h"
#include "panic.h"
#include <pugixml.hpp>
@ -24,7 +23,6 @@ DataModel::DataModel()
void DataModel::Init(bool runMode) {
// Create default services
GetService<Workspace>();
GetService<Players>();
GetService<ServerScriptService>();
// Init all services
@ -32,10 +30,6 @@ void DataModel::Init(bool runMode) {
service->InitService();
if (runMode) service->OnRun();
}
// if (runMode) {
// GetService<Players>()->createLocalPlayer(0);
// }
}
void DataModel::SaveToFile(std::optional<std::string> path) {

View file

@ -13,7 +13,6 @@
#include "objects/service/script/serverscriptservice.h"
#include "objects/service/selection.h"
#include "objects/service/workspace.h"
#include "objects/service/players.h"
#include "objects/datamodel.h"
std::map<std::string, const InstanceType*> INSTANCE_MAP = {
@ -33,7 +32,6 @@ std::map<std::string, const InstanceType*> INSTANCE_MAP = {
// Services
{ "Workspace", &Workspace::TYPE },
{ "Players", &Players::TYPE },
{ "JointsService", &JointsService::TYPE },
{ "ScriptContext", &ScriptContext::TYPE },
{ "ServerScriptService", &ServerScriptService::TYPE },

View file

@ -1,6 +0,0 @@
#include "player.h"
#include "objects/service/players.h"
#include "objects/datamodel.h"
Player::Player(): Instance(&TYPE) {}
Player::~Player() {}

View file

@ -1,23 +0,0 @@
#pragma once
#include "objects/annotation.h"
#include "objects/base/instance.h"
#include "objects/model.h"
#include <memory>
class DEF_INST_(explorer_icon="player") Player : public Instance {
AUTOGEN_PREAMBLE
public:
Player();
~Player();
DEF_PROP_CATEGORY(DATA)
DEF_PROP_(readonly) int userId = 0;
DEF_PROP std::weak_ptr<Model> character;
// DEF_PROP_CATEGORY(TEAM) //placeholder, we cant add TeamColor or Teams yet since no BrickColor
// DEF_PROP bool neutral = true;
static inline std::shared_ptr<Player> New() { return std::make_shared<Player>(); };
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Player>(); };
};

View file

@ -1,41 +0,0 @@
#include "players.h"
#include "objects/service/workspace.h"
#include "objects/datamodel.h"
#include "objects/player.h"
#include <memory>
#include <string>
#include <iostream>
int numPlayers;
int maxPlayers;
Players::Players(): Service(&TYPE) {
}
Players::~Players() = default;
void Players::InitService() {
if (initialized) return;
initialized = true;
// Clear any players if they for some reason exist
for (std::shared_ptr<Instance> inst : GetChildren()) {
inst->Destroy();
}
}
std::optional<std::shared_ptr<Player>> Players::createLocalPlayer(int userId) {
if (!dataModel()) return std::nullopt;
std::shared_ptr<Player> newPlr = Player::New();
newPlr->name = "Player"+std::to_string(userId);
newPlr->userId = userId;
this->localPlayer = newPlr;
this->AddChild(newPlr);
return newPlr;
}
void Players::removeLocalPlayer() {
if (!this->localPlayer.lock()) return;
this->localPlayer.lock()->Destroy();
this->localPlayer = std::weak_ptr<Player>();
}

View file

@ -1,25 +0,0 @@
#pragma once
#include "objects/annotation.h"
#include "objects/base/service.h"
#include "objects/player.h"
class DEF_INST_SERVICE_(explorer_icon="players") Players : public Service {
AUTOGEN_PREAMBLE
protected:
void InitService() override;
bool initialized = false;
public:
Players();
~Players();
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Players>(); };
std::optional<std::shared_ptr<Player>> createLocalPlayer(int userId);
void removeLocalPlayer();
DEF_PROP_CATEGORY(DATA)
DEF_PROP_(readonly,no_save) int numPlayers = 0;
DEF_PROP int maxPlayers = 10;
DEF_PROP_(readonly,no_save) std::weak_ptr<Player> localPlayer;
};