Plasma Engine  2.0
Loading...
Searching...
No Matches
PowerConnectorComponent.h
1#include <Core/World/Component.h>
2#include <GameComponentsPlugin/GameComponentsDLL.h>
3#include <GameEngine/AI/SensorComponent.h>
4
7
14class PL_GAMECOMPONENTS_DLL plEventMsgSetPowerInput : public plEventMessage
15{
16 PL_DECLARE_MESSAGE_TYPE(plEventMsgSetPowerInput, plEventMessage);
17
18 plUInt16 m_uiPrevValue = 0;
19 plUInt16 m_uiNewValue = 0;
20};
21
23
53class PL_GAMECOMPONENTS_DLL plPowerConnectorComponent : public plComponent
54{
56
58 // plComponent
59
60public:
61 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
62 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
63
64protected:
65 virtual void OnDeactivated() override;
66 virtual void OnSimulationStarted() override;
67
69 // plPowerConnectorComponent
70
71public:
77 void SetOutput(plUInt16 value); // [ property ]
78 plUInt16 GetOutput() const { return m_uiOutput; } // [ property ]
79
80 void SetBuddy(plGameObjectHandle hObject);
81 void SetConnectedTo(plGameObjectHandle hObject);
82
84 bool IsConnected() const; // [ scriptable ]
85
87 bool IsAttached() const; // [ scriptable ]
88
89 void Detach(); // [ scriptable ]
90 void Attach(plGameObjectHandle hObject);
91
92protected:
93 void SetBuddyReference(const char* szReference); // [ property ]
94 void SetConnectedToReference(const char* szReference); // [ property ]
95
96 void ConnectToSocket(plGameObjectHandle hSocket);
97
98 void SetInput(plUInt16 value);
99
101 void OnMsgSensorDetectedObjectsChanged(plMsgSensorDetectedObjectsChanged& msg); // [ message handler ]
102
107 void OnMsgObjectGrabbed(plMsgObjectGrabbed& msg); // [ message handler ]
108
109
110 plTime m_DetachTime;
111 plGameObjectHandle m_hAttachPoint;
112 plGameObjectHandle m_hGrabbedBy;
113
114 plUInt16 m_uiOutput = 0;
115 plUInt16 m_uiInput = 0;
116
117 plGameObjectHandle m_hBuddy;
118 plGameObjectHandle m_hConnectedTo;
119
120 void InputChanged(plUInt16 uiPrevInput, plUInt16 uiInput);
121 void OutputChanged(plUInt16 uiOutput);
122
123private:
124 const char* DummyGetter() const { return nullptr; }
125};
Base class of all component types.
Definition Component.h:25
Definition ComponentManager.h:88
This event is posted by plPowerConnectorComponent whenever the power input on a connector changes.
Definition PowerConnectorComponent.h:15
This component is for propagating the flow of power in cables or fluid in pipes and determine whether...
Definition PowerConnectorComponent.h:54
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
Base class for all messages that are sent as 'events'.
Definition EventMessage.h:8
A handle to a game object.
Definition Declarations.h:76
Sent by components such as plJoltGrabObjectComponent to indicate that the object has been grabbed or ...
Definition PhysicsWorldModule.h:221
Definition SensorComponent.h:11
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12