- /* Abstract action base class. */
- UCLASS(Abstract)
- class PROJECT_CHRONOLOGY_API UBase_Action : public UObject
- {
- public:
- GENERATED_BODY()
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Setup. -- ////////////////////////////////////////////////////
- /* Required call after creation. */
- virtual void Setup_Action(AChronology_GameState* Chronology_Game_State_Pointer)
- {
- // Brain pointer must be valid.
- verify(Chronology_Game_State_Pointer)
- CGSP = Chronology_Game_State_Pointer;
- // The action must be deterministic, or deterministic location and rotation must be false.
- check(Is_Deterministic || (!Is_Location_Deterministic && !Is_Rotation_Deterministic))
- // The actions rotation and location must both be determinisitic, or the rotation isn't determinisitic.
- check((Is_Rotation_Deterministic && Is_Location_Deterministic) || !Is_Rotation_Deterministic)
- }
- // Connection to the brain...
- AChronology_GameState* CGSP;
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Deterministic. -- ////////////////////////////////////////////
- /** Clients MUST know about this action before the min net delay.
- Note: Deterministic effects of any kind won't be allowed before the
- game state variable Min_Network_Segment_Delay has elapsed completed,
- that's the promise we make to clients. So that they have time to
- learn about deterministic actions before they can alter the simulation. */
- bool Is_Deterministic = true;
- /** Clients MUST also know the location during the action. (input prevented)
- location replicated in advance.
- Note: The use case for this being false would be extremely restricted,
- an action that can't be interrupted with collisions because the entity
- location has been assumed, so they can't reliably be hit, this actions
- effect can't actually be limited by distance so they must be applied
- globally, an example use case would be a buff applied to your whole,
- from inside character should, because collision isn't possible... */
- bool Is_Location_Deterministic = true;
- /** Clients MUST also know the rotation during the action. (input prevented)
- rotation replicated in advance.
- Note: There is no use case where this is true but location is false.
- the rotation being predetermined while the location is unknown has
- no practical purpose, why does it matter what direction your looking
- without context of where you are looking from!
- Note: The use case for this being false is to allow vulnerability to
- charged up actions while still allowing the entity to visually turn
- during the charge up period, the entity can still be hit even if the
- client doesn't know their rotation, (it's because of this uncertainty
- that backstab effects arn't possible in project chronology. ) */
- bool Is_Rotation_Deterministic = true;
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Start. -- ////////////////////////////////////////////////////
- /* Required to not be deterministically active.
- ---
- Test if requirements to start this action, stimulus manual input.
- --- */
- virtual bool Action_Initilize_Requirements(const uint32& Current_Segment, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- //////
- /* Not required to be deterministically active.
- ---
- Called when initally setting this action, setup can trigger movement based stimulus.
- --- */
- virtual void Action_Initilize(const uint32& Current_Segment, bool Event_Initlized, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Action generated collisions. -- //////////////////////////////
- /* Required to be deterministically active.
- ---
- Inital action collision creation.
- --- */
- virtual void Action_Collision_Initilize(const uint32& Current_Segment, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- //////
- /* Required to be deterministically active.
- ---
- Finalize action collision setup.
- --- */
- virtual void Action_Collision_Finalize(const uint32& Current_Segment, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- //////
- /* Required to be deterministically active.
- ---
- Apply action collision effects to collided entities.
- --- */
- virtual void Action_Collision_Effects(const uint32& Current_Segment, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Immediate stop? -- ///////////////////////////////////////////
- /* Required to not be deterministically active.
- ---
- Can this action be stopped immediatly for the requested action?
- --- */
- virtual bool Action_Stop_Requirements(const uint32& Current_Segment, const UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Latent switch? -- ////////////////////////////////////////////
- /* Required to be deterministically active.
- ---
- Can this action be switch out for another, if true the returned segment won't equal the current segment.
- --- */
- virtual uint32 Action_Switch_Requirements(const uint32& Current_Segment, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Responses to stimulus. -- ////////////////////////////////////
- /* Can trigger regardless of deterministic status.
- ---
- The entity health is going to be set to zero, action response?
- --- */
- virtual void Action_Death(const uint32& Current_Segment, const uint16& Damage, UChronology_Entity& Entity, Enum_Action_Type& Request_Action) {};
- //////
- /* Can trigger regardless of deterministic status.
- ---
- The entity has collided with terrain, action response?
- --- */
- virtual void Action_Terrain_Collision(const uint32& Current_Segment, UChronology_Entity& Entity, bool& Collision_Surface_Walkable, FVector& Collision_Impact_Normal) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Action ended. -- /////////////////////////////////////////////
- /* Can trigger regardless of deterministic status.
- ---
- This action has ended.
- --- */
- virtual void Action_Completed(const uint32& Segment, UChronology_Entity& Entity, Enum_Action_Complete_Type Complete_Reason) {};
- ////////////////////////////////////////////////////////////////////////////
- ////////// -- Base Variable Action Overrides. -- ///////////////////////////
- /* Triggers regardless of deterministic status.
- ---
- This action has ended.
- --- */
- virtual void Action_Maximum_Speed(uint32& Segment, UChronology_Entity& Entity, float& Return_New_Maximum_Speed) {};
- //////
- /* Triggers regardless of deterministic status.
- ---
- This action has ended.
- --- */
- virtual void Action_Ground_Breaking_Friction(uint32& Segment, UChronology_Entity& Entity, float& Return_New_Deceleration) {};
- //////
- /* Triggers regardless of deterministic status.
- ---
- The amount the speed of the character is reduced in air each segment proccessed.
- --- */
- virtual void Action_Air_Breaking_Friction(uint32& Segment, UChronology_Entity& Entity, float& Return_New_Deceleration) {};
- };