2023-12-29 04:24:30 +00:00
|
|
|
#ifndef QUICKBUILDCOMPONENT_H
|
|
|
|
#define QUICKBUILDCOMPONENT_H
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2024-01-05 12:33:52 +00:00
|
|
|
#include "BitStream.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
#include "NiPoint3.h"
|
|
|
|
#include "ScriptedActivityComponent.h"
|
|
|
|
#include "Preconditions.h"
|
|
|
|
#include "Component.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2023-12-29 04:24:30 +00:00
|
|
|
#include "eQuickBuildState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
class Entity;
|
2023-05-02 22:39:21 +00:00
|
|
|
enum class eQuickBuildFailReason : uint32_t;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that handles entities that can be built into other entities using the quick build mechanic. Generally
|
|
|
|
* consists of an activator that shows a popup and then the actual entity that the bricks are built into. Note
|
|
|
|
* that quick builds are also scripted activities so this shared some logic with the ScriptedActivityComponent.
|
|
|
|
*/
|
2024-01-24 05:13:23 +00:00
|
|
|
class QuickBuildComponent final : public Component {
|
2021-12-05 17:54:36 +00:00
|
|
|
public:
|
2024-01-24 05:13:23 +00:00
|
|
|
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2024-02-10 19:44:40 +00:00
|
|
|
QuickBuildComponent(Entity* const entity);
|
2023-12-29 04:24:30 +00:00
|
|
|
~QuickBuildComponent() override;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-08-10 21:33:15 +00:00
|
|
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;
|
2021-12-05 17:54:36 +00:00
|
|
|
void Update(float deltaTime) override;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Handles a OnUse event from some entity, initiating the quick build
|
|
|
|
* @param originator the entity that triggered the event
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
void OnUse(Entity* originator) override;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Spawns the activator that can be used to initiate the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
void SpawnActivator();
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Despawns the activiator that can be used to initiate the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
void DespawnActivator();
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the entity that acts as the activator for this quickbuild
|
|
|
|
* @return the entity that acts as the activator for this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] Entity* GetActivator() const;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the spawn position of the activator for this quickbuild, if any
|
|
|
|
* @return the spawn position of the activator for this quickbuild, if any
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] NiPoint3 GetActivatorPosition() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the spawn position for the activator of this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the spawn position to set for the activator
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetActivatorPosition(const NiPoint3& value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the time it takes for the quickbuild to reset after being built
|
|
|
|
* @return the time it takes for the quickbuild to reset after being built
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] float GetResetTime() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the time it takes for the quickbuild to reset after being built
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the reset time to set
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetResetTime(const float value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the time it takes to complete the quickbuild
|
|
|
|
* @return the time it takes to complete the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] float GetCompleteTime() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the time it takes to complete the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the completion time to set
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetCompleteTime(const float value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the imagination that's taken when completing the quickbuild
|
|
|
|
* @return the imagination that's taken when completing the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] int32_t GetTakeImagination() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the imagination that's taken when completing the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the imagination deduction to set
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetTakeImagination(const int32_t value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns if the quickbuild can be interrupted, currently unused
|
|
|
|
* @return if the quickbuild can be interrupted
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] bool GetInterruptible() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets whether or not the quickbuild can be interrupted, currently unused
|
|
|
|
* @param value true if the quickbuild may be interrupted, false otherwise
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetInterruptible(const bool value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Returns whether or not this entity contains a built-in activator
|
|
|
|
* @return whether or not this entity contains a built-in activator
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] bool GetSelfActivator() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Sets whether or not this entity contains a built-in activator. If set to false this will spawn activators on
|
2023-12-29 04:24:30 +00:00
|
|
|
* each new quickbuild.
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value whether or not this entity contains a built-in activator
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetSelfActivator(const bool value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] std::vector<int32_t> GetCustomModules() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetCustomModules(const std::vector<int32_t>& value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the activity ID for participating in this quickbuild
|
|
|
|
* @return the activity ID for participating in this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] int32_t GetActivityId() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the activity ID for participating in this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the activity ID to set
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetActivityId(const int32_t value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] int32_t GetPostImaginationCost() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetPostImaginationCost(const int32_t value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the time it takes for an incomplete quickbuild to be smashed automatically
|
|
|
|
* @return the time it takes for an incomplete quickbuild to be smashed automatically
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] float GetTimeBeforeSmash() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets the time it takes for an incomplete quickbuild to be smashed automatically
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param value the time to set
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetTimeBeforeSmash(const float value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the current quickbuild state
|
|
|
|
* @return the current quickbuild state
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 11:05:25 +00:00
|
|
|
[[nodiscard]] eQuickBuildState GetState() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns the player that is currently building this quickbuild
|
|
|
|
* @return the player that is currently building this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] Entity* GetBuilder() const;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Returns whether or not the player is repositioned when initiating the quickbuild
|
|
|
|
* @return whether or not the player is repositioned when initiating the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] bool GetRepositionPlayer() const noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Sets whether or not the player is repositioned when initiating the quickbuild
|
|
|
|
* @param value whether or not the player is repositioned when initiating the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void SetRepositionPlayer(const bool value) noexcept;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Adds a callback that is called when the quickbuild is completed
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param callback the callback to add
|
|
|
|
*/
|
2023-12-29 04:24:30 +00:00
|
|
|
void AddQuickBuildCompleteCallback(const std::function<void(Entity* user)>& callback);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Adds a callback when the quickbuild state is updated
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param callback the callback to add
|
|
|
|
*/
|
2023-12-29 04:24:30 +00:00
|
|
|
void AddQuickBuildStateCallback(const std::function<void(eQuickBuildState state)>& callback);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Resets the quickbuild
|
|
|
|
* @param failed whether or not the player failed to complete the quickbuild, triggers an extra animation
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void ResetQuickBuild(const bool failed);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Cancels the quickbuild if it wasn't completed
|
2022-07-28 13:39:57 +00:00
|
|
|
* @param builder the player that's currently building
|
2023-12-29 04:24:30 +00:00
|
|
|
* @param failReason the reason the quickbuild was cancelled
|
|
|
|
* @param skipChecks whether or not to skip the check for the quickbuild not being completed
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void CancelQuickBuild(Entity* const builder, const eQuickBuildFailReason failReason, const bool skipChecks = false);
|
2021-12-05 17:54:36 +00:00
|
|
|
private:
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the quickbuild state has been changed since we last serialized it.
|
|
|
|
*/
|
|
|
|
bool m_StateDirty = true;
|
|
|
|
|
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The state the quickbuild is currently in
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2023-12-29 04:24:30 +00:00
|
|
|
eQuickBuildState m_State = eQuickBuildState::OPEN;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The time that has passed since initiating the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_Timer = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The time that has passed before completing the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_TimerIncomplete = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The position that the quickbuild activator is spawned at
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-01-29 07:53:12 +00:00
|
|
|
NiPoint3 m_ActivatorPosition = NiPoint3Constant::ZERO;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The entity that represents the quickbuild activator
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
Entity* m_Activator = nullptr;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The ID of the entity that represents the quickbuild activator
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
LWOOBJID m_ActivatorId = LWOOBJID_EMPTY;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Triggers the blinking that indicates that the quickbuild is resetting
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
bool m_ShowResetEffect = false;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_Taken = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The callbacks that are called when the quickbuild is completed
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2023-12-29 04:24:30 +00:00
|
|
|
std::vector<std::function<void(Entity* user)>> m_QuickBuildCompleteCallbacks{};
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The callbacks that are called when the quickbuild state is updated
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2023-12-29 04:24:30 +00:00
|
|
|
std::vector<std::function<void(eQuickBuildState state)>> m_QuickBuildStateCallbacks{};
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The time it takes for the quickbuild to reset after being completed
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_ResetTime = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The time it takes to complete the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_CompleteTime = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The imagination that's deducted when completing the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
int32_t m_TakeImagination = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
bool m_Interruptible = false;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Whether or not this quickbuild entity also has an activator attached. If not a new one will be spawned
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
bool m_SelfActivator = false;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
std::vector<int32_t> m_CustomModules{};
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The activity ID that players partake in when doing this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
int32_t m_ActivityId = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
int32_t m_PostImaginationCost = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The time it takes for the quickbuild to reset when it's not completed yet
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_TimeBeforeSmash = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* The time it takes to drain imagination
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
float m_TimeBeforeDrain = 0;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The amount of imagination that was drained when building this quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
int32_t m_DrainedImagination = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Whether to reposition the player or not when building
|
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
bool m_RepositionPlayer = true;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
|
|
|
* Currently unused
|
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
int32_t m_SoftTimer = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* The ID of the entity that's currently building the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
LWOOBJID m_Builder = LWOOBJID_EMPTY;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Preconditions to be met before being able to start the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2021-12-05 17:54:36 +00:00
|
|
|
PreconditionExpression* m_Precondition = nullptr;
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Starts the quickbuild for a certain entity
|
|
|
|
* @param user the entity to start the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void StartQuickBuild(Entity* const user);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
/**
|
2023-12-29 04:24:30 +00:00
|
|
|
* Completes the quickbuild for an entity, dropping loot and despawning the activator
|
|
|
|
* @param user the entity that completed the quickbuild
|
2022-07-28 13:39:57 +00:00
|
|
|
*/
|
2024-02-10 19:44:40 +00:00
|
|
|
void CompleteQuickBuild(Entity* const user);
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|
|
|
|
|
2023-12-29 04:24:30 +00:00
|
|
|
#endif // QUICKBUILDCOMPONENT_H
|