refactor: moved GetClass and TYPE into AUTOGEN_PREAMBLE
This commit is contained in:
parent
ec65c6eddc
commit
06a5f91769
12 changed files with 3 additions and 34 deletions
|
@ -28,4 +28,7 @@ result<PropertyMeta, MemberNotFound> InternalGetPropertyMeta(std::string name) o
|
|||
fallible<MemberNotFound, AssignToReadOnlyMember> InternalSetPropertyValue(std::string name, Data::Variant value) override; \
|
||||
result<Data::Variant, MemberNotFound> InternalGetPropertyValue(std::string name) override; \
|
||||
std::vector<std::string> InternalGetProperties() override; \
|
||||
public: \
|
||||
const static InstanceType TYPE; \
|
||||
virtual const InstanceType* GetClass() override; \
|
||||
private:
|
||||
|
|
|
@ -19,8 +19,6 @@ private:
|
|||
void DeserializeService(pugi::xml_node node);
|
||||
static void cloneService(std::shared_ptr<DataModel> target, std::shared_ptr<Service>, RefState<_RefStatePropertyCell>);
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
std::map<std::string, std::shared_ptr<Service>> services;
|
||||
|
||||
std::optional<std::string> currentFile;
|
||||
|
@ -29,7 +27,6 @@ public:
|
|||
void Init(bool runMode = false);
|
||||
|
||||
static inline std::shared_ptr<DataModel> New() { return std::make_shared<DataModel>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
|
||||
result<std::shared_ptr<Service>, NoSuchService> GetService(std::string className);
|
||||
result<std::optional<std::shared_ptr<Service>>, NoSuchService> FindService(std::string className);
|
||||
|
|
|
@ -34,8 +34,6 @@ enum HandlesType {
|
|||
class INSTANCE_WITH(abstract) Handles : public Instance {
|
||||
AUTOGEN_PREAMBLE
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
bool nixAxes = false; // XYZ -> ZXY, used with rotation
|
||||
bool active;
|
||||
std::weak_ptr<Part> adornee;
|
||||
|
@ -54,5 +52,4 @@ public:
|
|||
std::optional<HandleFace> RaycastHandle(rp3d::Ray ray);
|
||||
|
||||
static inline std::shared_ptr<Handles> New() { return std::make_shared<Handles>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -29,7 +29,6 @@ protected:
|
|||
virtual void buildJoint() = 0;
|
||||
virtual void breakJoint() = 0;
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
[[ def_prop(name="Part0", on_update=onUpdated) ]]
|
||||
std::weak_ptr<Part> part0;
|
||||
|
@ -42,6 +41,4 @@ public:
|
|||
|
||||
JointInstance(const InstanceType*);
|
||||
~JointInstance();
|
||||
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -13,12 +13,9 @@ class INSTANCE Snap : public JointInstance {
|
|||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
Snap();
|
||||
~Snap();
|
||||
|
||||
static inline std::shared_ptr<Snap> New() { return std::make_shared<Snap>(); };
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Snap>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -13,12 +13,9 @@ class INSTANCE Weld : public JointInstance {
|
|||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
Weld();
|
||||
~Weld();
|
||||
|
||||
static inline std::shared_ptr<Weld> New() { return std::make_shared<Weld>(); };
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Weld>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -12,11 +12,8 @@ protected:
|
|||
bool initialized = false;
|
||||
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
JointsService();
|
||||
~JointsService();
|
||||
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<JointsService>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -49,8 +49,6 @@ protected:
|
|||
void OnAncestryChanged(std::optional<std::shared_ptr<Instance>> child, std::optional<std::shared_ptr<Instance>> newParent) override;
|
||||
void onUpdated(std::string);
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
[[ def_prop(name="Velocity", on_update=onUpdated) ]]
|
||||
Vector3 velocity;
|
||||
[[ def_prop(name="CFrame", on_update=onUpdated), cframe_position_prop(name="Position"), cframe_rotation_prop(name="Rotation") ]]
|
||||
|
@ -89,7 +87,6 @@ public:
|
|||
static inline std::shared_ptr<Part> New() { return std::make_shared<Part>(); };
|
||||
static inline std::shared_ptr<Part> New(PartConstructParams params) { return std::make_shared<Part>(params); };
|
||||
static inline InstanceRef Create() { return std::make_shared<Part>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
|
||||
inline Vector3 position() { return cframe.Position(); }
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
class INSTANCE_WITH(explorer_icon="script") Script : public Instance {
|
||||
AUTOGEN_PREAMBLE
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
Script();
|
||||
~Script();
|
||||
|
||||
|
@ -19,5 +17,4 @@ public:
|
|||
|
||||
static inline std::shared_ptr<Script> New() { return std::make_shared<Script>(); };
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Script>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -11,13 +11,10 @@ protected:
|
|||
bool initialized = false;
|
||||
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
ScriptContext();
|
||||
~ScriptContext();
|
||||
|
||||
lua_State* state;
|
||||
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<ScriptContext>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -13,11 +13,8 @@ protected:
|
|||
bool initialized = false;
|
||||
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
ServerScriptService();
|
||||
~ServerScriptService();
|
||||
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<ServerScriptService>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
};
|
|
@ -44,19 +44,15 @@ protected:
|
|||
bool initialized = false;
|
||||
|
||||
public:
|
||||
const static InstanceType TYPE;
|
||||
|
||||
Workspace();
|
||||
~Workspace();
|
||||
|
||||
// static inline std::shared_ptr<Workspace> New() { return std::make_shared<Workspace>(); };
|
||||
static inline std::shared_ptr<Instance> Create() { return std::make_shared<Workspace>(); };
|
||||
virtual const InstanceType* GetClass() override;
|
||||
|
||||
void SyncPartPhysics(std::shared_ptr<Part> part);
|
||||
void DestroyRigidBody(rp::RigidBody* rigidBody);
|
||||
|
||||
void PhysicsStep(float deltaTime);
|
||||
std::optional<const RaycastResult> CastRayNearest(glm::vec3 point, glm::vec3 rotation, float maxLength, std::optional<RaycastFilter> filter = std::nullopt, unsigned short categoryMaskBits = 0xFFFF);
|
||||
|
||||
};
|
Loading…
Add table
Reference in a new issue