3 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3;
4 const float MAX_ACTION_DETECTION_DISTANCE = 2.0;
17 m_RefresherActive =
false;
18 m_RefresherActiveLocal =
false;
19 m_RefresherInitialized =
false;
20 m_RefresherTimeRemaining = 0;
24 RegisterNetSyncVariableBool(
"m_RefresherActive");
41 m_RefresherInitialized =
true;
46 return "TerritoryFlagKit";
68 if (MemoryPointExists(
"kit_spawn_position"))
71 position = GetMemoryPointPos(
"kit_spawn_position");
99 ctx.Write(m_RefresherTimeRemaining);
100 ctx.Write(m_RefreshTimeCounter);
101 ctx.Write(m_FlagRefresherMaxDuration);
102 ctx.Write(m_RefresherActive);
107 if (!
super.OnStoreLoad(
ctx, version))
113 if (!
ctx.Read(m_RefresherTimeRemaining))
116 if (!
ctx.Read(m_RefreshTimeCounter))
122 if (version >= 118 && !
ctx.Read(m_RefresherActive))
133 super.AfterStoreLoad();
135 if (!m_RefresherInitialized &&
GetCEApi())
147 if (m_RefresherTimeRemaining > 0)
150 if (m_RefreshTimeCounter >= m_FlagRefresherFrequency)
153 m_RefresherTimeRemaining =
Math.
Clamp(m_RefresherTimeRemaining - m_RefreshTimeCounter, 0, m_FlagRefresherMaxDuration);
154 m_RefreshTimeCounter = 0;
170 if (m_RefresherActive &&
idx == -1)
172 else if (!m_RefresherActive &&
idx > -1)
178 if (m_RefresherActive !=
state)
180 m_RefresherActive =
state;
212 super.OnVariablesSynchronized();
214 if (m_RefresherActive != m_RefresherActiveLocal)
258 if (!
GetGame().IsDedicatedServer())
384 if (
angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
409 if (
angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
419 if (MemoryPointExists(selection))
423 if (
distance >= MAX_ACTION_DETECTION_DISTANCE)
461 SetAnimationPhase(
"flag_mast",
phase_new);
477 PluginAdminLog
logs = PluginAdminLog.Cast(
GetPlugin(PluginAdminLog));
506 float temp =
Math.
Clamp(m_RefresherTimeRemaining + (
fraction * m_FlagRefresherMaxDuration), 0, m_FlagRefresherMaxDuration);
520 m_RefresherTimeRemaining = m_FlagRefresherMaxDuration * m_RefresherTimeRemaining /
max_duration;
541 super.OnDebugSpawn();
543 GetInventory().CreateInInventory(
"Flag_DayZ");
eBleedingSourceType GetType()
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
void AddAction(typename actionName)
Construction GetConstruction()
proto native CEApi GetCEApi()
Get the CE API.
bool IsPartConstructed(string part_name)
PluginBase GetPlugin(typename plugin_type)
class JsonUndergroundAreaTriggerData GetPosition
override bool CanDisplayAttachmentCategory(string category_name)
override void OnDebugSpawn()
override bool IsPlayerInside(PlayerBase player, string selection)
bool m_RefresherInitialized
override void OnVariablesSynchronized()
void SetRefreshTimer01(float fraction)
void RemoveRefresherPosition(int idx=-2)
override string GetConstructionKitType()
float GetRefresherTime01()
override bool CanPutIntoHands(EntityAI parent)
override void UpdateVisuals()
int m_RefresherTimeRemaining
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
override void SetActions()
void AddRefresherTime01(float fraction)
void SetRefresherActive(bool state)
int m_FlagRefresherMaxDuration
override bool IsFacingCamera(string selection)
override bool IsFacingPlayer(PlayerBase player, string selection)
override void OnCEUpdate()
override void AfterStoreLoad()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
void LogAnimateFlag(float newPhase, notnull PlayerBase player)
override int GetMeleeTargetType()
override bool HasProperDistance(string selection, PlayerBase player)
void HandleRefreshers()
Client-side, saves positions of active lifetime refreshers to MissionGameplay.
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void CheckLoadedVariables(int max_duration)
override void OnStoreSave(ParamsWriteContext ctx)
void InsertRefresherPosition()
override vector GetKitSpawnPosition()
override bool CanBeRepairedToPristine()
void AnimateFlagEx(float delta, PlayerBase player=null)
void AnimateFlag(float delta)
bool m_RefresherActiveLocal
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
ref array< vector > m_ActiveRefresherLocations
Serialization general interface. Serializer API works with:
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
const float REFRESHER_RADIUS
const int REFRESHER_MAX_DURATION_DEFAULT
const int REFRESHER_FREQUENCY_DEFAULT
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.