DayZ 1.24
Loading...
Searching...
No Matches
BaseBuildingBase Class Reference
Collaboration diagram for BaseBuildingBase:
[legend]

Protected Member Functions

void Fence ()
 
override string GetConstructionKitType ()
 
override int GetMeleeTargetType ()
 
bool HasHinges ()
 
bool HasFullyConstructedGate ()
 
void SetGateState (int state)
 
int GetGateState ()
 
int CheckGateState ()
 
void SetOpenedState (bool state)
 
override bool IsOpened ()
 
bool IsLocked ()
 
override bool NameOverride (out string output)
 
CombinationLock GetCombinationLock ()
 
CamoNet GetCamoNet ()
 
BarbedWire GetBarbedWire1 ()
 
BarbedWire GetBarbedWire2 ()
 
override vector GetKitSpawnPosition ()
 
override bool CanDisplayAttachmentSlot (int slot_id)
 
override bool CanDisplayAttachmentCategory (string category_name)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void AfterStoreLoad ()
 
override void OnVariablesSynchronized ()
 
override void OnPartBuiltServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDismantledServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDestroyedServer (Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanBeRepairedToPristine ()
 
bool CanOpenFence ()
 
bool CanCloseFence ()
 
void OpenFence ()
 
void CloseFence ()
 
void CheckFenceOpened ()
 
void CheckFenceClosed ()
 
override void CreateAreaDamage (string slot_name, float rotation_angle=0)
 
void UpdateBarbedWireAreaDamagePos (float rotation_angle=0, bool to_delete=false)
 
override void PostAreaDamageActions ()
 
override bool IsPlayerInside (PlayerBase player, string selection)
 
override bool IsFacingPlayer (PlayerBase player, string selection)
 
override bool IsFacingCamera (string selection)
 
override bool HasProperDistance (string selection, PlayerBase player)
 
override bool CanUseConstructionBuild ()
 
void SoundGateOpenStart ()
 
void SoundGateCloseStart ()
 
void SoundGateCloseEnd ()
 
void GateAttachmentsSanityCheck ()
 
void HandleDropAttachment (ItemBase item)
 
bool GateAttachmentConditions (int slotId)
 
override bool TranslateSlotFromSelection (string selection_name, out int slot_id)
 
override void SetActions ()
 
override array< stringOnDebugSpawnBuildExcludes ()
 Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
 
override void OnDebugSpawn ()
 
void TerritoryFlag ()
 
void ~TerritoryFlag ()
 
void InitRefresherData ()
 
override string GetConstructionKitType ()
 
override int GetMeleeTargetType ()
 
override vector GetKitSpawnPosition ()
 
override bool CanDisplayAttachmentCategory (string category_name)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void AfterStoreLoad ()
 
override void OnCEUpdate ()
 
void HandleRefreshers ()
 Client-side, saves positions of active lifetime refreshers to MissionGameplay.
 
void SetRefresherActive (bool state)
 
void InsertRefresherPosition ()
 
void RemoveRefresherPosition (int idx=-2)
 
override void OnVariablesSynchronized ()
 
override void OnPartBuiltServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDismantledServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDestroyedServer (Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanBeRepairedToPristine ()
 
override bool IsPlayerInside (PlayerBase player, string selection)
 
override bool IsFacingPlayer (PlayerBase player, string selection)
 
override bool IsFacingCamera (string selection)
 
override bool HasProperDistance (string selection, PlayerBase player)
 
override void SetActions ()
 
void AnimateFlagEx (float delta, PlayerBase player=null)
 
void AnimateFlag (float delta)
 
void LogAnimateFlag (float newPhase, notnull PlayerBase player)
 
void SetRefreshTimer01 (float fraction)
 
void AddRefresherTime01 (float fraction)
 
float GetRefresherTime01 ()
 
void CheckLoadedVariables (int max_duration)
 
override void OnDebugSpawn ()
 

Protected Attributes

bool m_ToDiscard = false
 
bool m_IsOpened = false
 
bool m_IsOpenedClient = false
 
int m_GateState = 0
 
EffectSound m_SoundGate_Start
 
EffectSound m_SoundGate_End
 
int m_FlagRefresherFrequency = GameConstants.REFRESHER_FREQUENCY_DEFAULT
 
int m_FlagRefresherMaxDuration = GameConstants.REFRESHER_MAX_DURATION_DEFAULT
 

Private Member Functions

void ShelterSite ()
 
override string GetConstructionKitType ()
 
override int GetMeleeTargetType ()
 
override vector GetKitSpawnPosition ()
 
override void OnPartBuiltServer (notnull Man player, string part_name, int action_id)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanBeRepairedToPristine ()
 
override bool CanUseHandConstruction ()
 
override bool MustBeBuiltFromOutside ()
 
override bool IsFacingCamera (string selection)
 
override bool IsPlayerInside (PlayerBase player, string selection)
 
override bool HasProperDistance (string selection, PlayerBase player)
 
override void SetActions ()
 
void Watchtower ()
 
override string GetConstructionKitType ()
 
override int GetMeleeTargetType ()
 
override void UpdateVisuals ()
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanBeRepairedToPristine ()
 
override bool PerformRoofCheckForBase (string partName, PlayerBase player, out bool result)
 
override bool CanDisplayAttachmentSlot (int slot_id)
 
override bool CanDisplayAttachmentCategory (string category_name)
 
override bool CheckSlotVerticalDistance (int slot_id, PlayerBase player)
 
override bool CheckMemoryPointVerticalDistance (float max_dist, string selection, PlayerBase player)
 
override bool CheckLevelVerticalDistance (float max_dist, string selection, PlayerBase player)
 
override void AfterStoreLoad ()
 
override void OnPartBuiltServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDismantledServer (notnull Man player, string part_name, int action_id)
 
override void OnPartDestroyedServer (Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
 
override bool IsFacingPlayer (PlayerBase player, string selection)
 
override bool IsFacingCamera (string selection)
 
override bool IsPlayerInside (PlayerBase player, string selection)
 
override bool HasProperDistance (string selection, PlayerBase player)
 
override void SetActions ()
 
override array< stringOnDebugSpawnBuildExcludes ()
 Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
 
override void OnDebugSpawn ()
 

Private Attributes

const int GATE_STATE_NONE = 0
 
const int GATE_STATE_PARTIAL = 1
 
const int GATE_STATE_FULL = 2
 
const string ATTACHMENT_SLOT_COMBINATION_LOCK = "Att_CombinationLock"
 
const string SOUND_GATE_OPEN_START = "DoorWoodTowerOpen_SoundSet"
 
const string SOUND_GATE_CLOSE_START = "DoorWoodTowerClose_start_SoundSet"
 
const string SOUND_GATE_CLOSE_END = "DoorWoodTowerClose_end_SoundSet"
 
const float GATE_ROTATION_ANGLE_DEG = 100
 
const float GATE_ROTATION_TIME_APPROX = 2000
 
const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3
 
const float MAX_ACTION_DETECTION_DISTANCE = 2.0
 
 ATTACHMENT_WOODEN_LOG = WoodenLog
 
 ATTACHMENT_COMBINATION_LOCK = CombinationLock
 
string ATTSLOT_CAMONET = "Wall_Camonet"
 
string ATTSLOT_BARBEDWIRE_DOWN = "Wall_Barbedwire_1"
 
string ATTSLOT_BARBEDWIRE_UP = "Wall_Barbedwire_2"
 
bool m_RefresherActive
 
bool m_RefresherActiveLocal
 
bool m_RefresherInitialized
 
int m_RefresherTimeRemaining
 
int m_RefreshTimeCounter
 
 ATTACHMENT_BARBED_WIRE = BarbedWire
 
 ATTACHMENT_CAMONET = CamoNet
 
const float MAX_FLOOR_VERTICAL_DISTANCE = 0.5
 
const float MIN_ACTION_DETECTION_ANGLE_RAD = 0.35
 

Static Private Attributes

static const string BASE_VIEW_NAME = "level_"
 
static const string BASE_WALL_NAME = "_wall_"
 
static const string BASE_ROOF_NAME = "_roof"
 
static const int MAX_WATCHTOWER_FLOORS = 3
 
static const int MAX_WATCHTOWER_WALLS = 3
 

Detailed Description

Definition at line 1 of file Fence.c.

Constructor & Destructor Documentation

◆ ~TerritoryFlag()

void BaseBuildingBase::~TerritoryFlag ( )
inlineprotected

Definition at line 27 of file Totem.c.

28 {
30 }
void RemoveRefresherPosition(int idx=-2)
Definition Totem.c:194

References RemoveRefresherPosition().

Member Function Documentation

◆ AddRefresherTime01()

void BaseBuildingBase::AddRefresherTime01 ( float fraction)
inlineprotected

Definition at line 504 of file Totem.c.

505 {
509 //Print(m_RefresherTimeRemaining);
510 }
int m_RefresherTimeRemaining
Definition Totem.c:9
void SetRefresherActive(bool state)
Definition Totem.c:176
int m_FlagRefresherMaxDuration
Definition Totem.c:13
Definition EnMath.c:7
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'.

References Math::Clamp(), Math::Round(), and SetRefresherActive().

Referenced by OnDebugSpawn().

◆ AfterStoreLoad() [1/3]

override void BaseBuildingBase::AfterStoreLoad ( )
inlineprotected

Definition at line 247 of file Fence.c.

248 {
249 super.AfterStoreLoad();
250
251 //set gate state
252 ConstructionPart gate_part = GetConstruction().GetGateConstructionPart();
254
255 //update gate state visual
256 if (IsOpened())
257 OpenFence();
258
260
261 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] AfterStoreLoad - build=" + gate_part.IsBuilt() + " opened=" + IsOpened());
262 }
Construction GetConstruction()
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
void SetGateState(int state)
Definition Fence.c:66
override bool IsOpened()
Definition Fence.c:106
override void UpdateVisuals()
Definition Watchtower.c:44
void OpenFence()
Definition Fence.c:419
int CheckGateState()
Definition Fence.c:77
static bool IsBaseBuildingLogEnable()
Definition Debug.c:779

References bsbDebugPrint(), CheckGateState(), GetConstruction(), LogManager::IsBaseBuildingLogEnable(), IsOpened(), IsOpened(), OpenFence(), SetGateState(), and UpdateVisuals().

◆ AfterStoreLoad() [2/3]

override void BaseBuildingBase::AfterStoreLoad ( )
inlineprotected

Definition at line 131 of file Totem.c.

132 {
133 super.AfterStoreLoad();
134
137 SetSynchDirty();
139 }
proto native CEApi GetCEApi()
Get the CE API.
bool m_RefresherInitialized
Definition Totem.c:8
void InitRefresherData()
Definition Totem.c:32

References GetCEApi(), InitRefresherData(), and UpdateVisuals().

◆ AfterStoreLoad() [3/3]

override void BaseBuildingBase::AfterStoreLoad ( )
inlineprivate

Definition at line 349 of file Watchtower.c.

350 {
351 super.AfterStoreLoad();
352
354 }

References UpdateVisuals().

◆ AnimateFlag()

void BaseBuildingBase::AnimateFlag ( float delta)
inlineprotected

Definition at line 470 of file Totem.c.

471 {
473 }
void AnimateFlagEx(float delta, PlayerBase player=null)
Definition Totem.c:452

References AnimateFlagEx().

Referenced by OnCEUpdate(), OnDebugSpawn(), and OnStoreLoad().

◆ AnimateFlagEx()

void BaseBuildingBase::AnimateFlagEx ( float delta,
PlayerBase player = null )
inlineprotected

Definition at line 452 of file Totem.c.

453 {
454 float temp = Math.Clamp(delta, 0, 1);
455 float phase_new;
456 if (temp < 0.01 || temp > 0.99)
458 else
459 phase_new = temp;
460
461 SetAnimationPhase("flag_mast", phase_new);
462
463 if (player)
465
466 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString("Material_FPole_Flag"), phase_new != 1);
467
468 }
void LogAnimateFlag(float newPhase, notnull PlayerBase player)
Definition Totem.c:475
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References Math::Clamp(), InventorySlots::GetSlotIdFromString(), LogAnimateFlag(), and Math::Round().

Referenced by AnimateFlag().

◆ CanBeRepairedToPristine() [1/4]

override bool BaseBuildingBase::CanBeRepairedToPristine ( )
inlineprotected

Definition at line 397 of file Fence.c.

398 {
399 return true;
400 }

◆ CanBeRepairedToPristine() [2/4]

override bool BaseBuildingBase::CanBeRepairedToPristine ( )
inlineprivate

Definition at line 78 of file ShelterSite.c.

79 {
80 return true;
81 }

◆ CanBeRepairedToPristine() [3/4]

override bool BaseBuildingBase::CanBeRepairedToPristine ( )
inlineprotected

Definition at line 324 of file Totem.c.

325 {
326 return true;
327 }

◆ CanBeRepairedToPristine() [4/4]

override bool BaseBuildingBase::CanBeRepairedToPristine ( )
inlineprivate

Definition at line 128 of file Watchtower.c.

129 {
130 return true;
131 }

◆ CanCloseFence()

bool BaseBuildingBase::CanCloseFence ( )
inlineprotected

Definition at line 411 of file Fence.c.

412 {
413 if (HasHinges() && IsOpened())
414 return true;
415
416 return false;
417 }
bool HasHinges()
Definition Fence.c:56

References HasHinges(), and IsOpened().

◆ CanDisplayAttachmentCategory() [1/3]

override bool BaseBuildingBase::CanDisplayAttachmentCategory ( string category_name)
inlineprotected

Definition at line 189 of file Fence.c.

190 {
191 if (category_name == "Attachments" || category_name == "Material")
192 {
193 if (!HasBase())
194 return false;
195 }
196
197 return true;
198 }
bool HasBase()

References HasBase().

◆ CanDisplayAttachmentCategory() [2/3]

override bool BaseBuildingBase::CanDisplayAttachmentCategory ( string category_name)
inlineprotected

Definition at line 79 of file Totem.c.

80 {
81 if (category_name == "Base" && !HasBase())
82 return true;
83 else if (category_name == "Support" && HasBase() && !GetConstruction().IsPartConstructed("support"))
84 return true;
85 else if (category_name == "Pole" && GetConstruction().IsPartConstructed("support") && !GetConstruction().IsPartConstructed("pole"))
86 return true;
87 else if (category_name == "Flag" && GetConstruction().IsPartConstructed("pole"))
88 return true;
89 else
90 return false;
91 }
bool IsPartConstructed(string part_name)

References GetConstruction(), HasBase(), and IsPartConstructed().

◆ CanDisplayAttachmentCategory() [3/3]

override bool BaseBuildingBase::CanDisplayAttachmentCategory ( string category_name)
inlineprivate

Definition at line 229 of file Watchtower.c.

230 {
231 //super
232 if (!super.CanDisplayAttachmentCategory(category_name))
233 return false;
234 //
235
236 category_name.ToLower();
238 //level 1
239 if (category_name.Contains("level_1"))
240 {
241 if (category_name.Contains("level_1_"))
242 return GetConstruction().IsPartConstructed("level_1_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_1", player);
243 else
245 }
246 //level 2
247 if (category_name.Contains("level_2"))
248 {
249 if (category_name.Contains("level_2_"))
250 return GetConstruction().IsPartConstructed("level_2_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_2", player);
251 else
252 return GetConstruction().IsPartConstructed("level_1_roof") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_2", player);
253 }
254 //level 3
255 if (category_name.Contains("level_3"))
256 {
257 if (category_name.Contains("level_3_"))
258 return GetConstruction().IsPartConstructed("level_3_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_3", player);
259 else
260 return GetConstruction().IsPartConstructed("level_2_roof") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_3", player);
261 }
262
263 return true;
264 }
PlayerBase GetPlayer()
const float MAX_FLOOR_VERTICAL_DISTANCE
Definition Watchtower.c:6
override bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
Definition Watchtower.c:313
proto native CGame GetGame()

References CheckMemoryPointVerticalDistance(), GetConstruction(), GetGame(), and GetPlayer().

◆ CanDisplayAttachmentSlot() [1/2]

override bool BaseBuildingBase::CanDisplayAttachmentSlot ( int slot_id)
inlineprotected

Definition at line 170 of file Fence.c.

171 {
172 if (!super.CanDisplayAttachmentSlot(slot_id))
173 return false;
174
176
177 if (slot_name == "Att_CombinationLock")
178 {
180 return false;
181 }
182
184 return false;
185
186 return true;
187 }
bool HasFullyConstructedGate()
Definition Fence.c:61
bool GateAttachmentConditions(int slotId)
Definition Fence.c:731
static proto native owned string GetSlotName(int id)
converts slot_id to string

References GateAttachmentConditions(), InventorySlots::GetSlotIdFromString(), InventorySlots::GetSlotName(), and HasFullyConstructedGate().

◆ CanDisplayAttachmentSlot() [2/2]

override bool BaseBuildingBase::CanDisplayAttachmentSlot ( int slot_id)
inlineprivate

Definition at line 194 of file Watchtower.c.

195 {
196 //super
197 if (!super.CanDisplayAttachmentSlot(slot_id))
198 return false;
199
201 slot_name.ToLower();
203 //base attachments
204 if (slot_name.Contains("material_l1") || slot_name.Contains("level_1_"))
205 {
206 if (slot_name.Contains("woodenlogs"))
208 else
209 return GetConstruction().IsPartConstructed("level_1_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_1", player);
210 }
211 else if (slot_name.Contains("material_l2") || slot_name.Contains("level_2_"))
212 {
213 if (slot_name.Contains("woodenlogs"))
215 else
216 return GetConstruction().IsPartConstructed("level_2_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_2", player);
217 }
218 else if (slot_name.Contains("material_l3") || slot_name.Contains("level_3_"))
219 {
220 if (slot_name.Contains("woodenlogs"))
222 else
223 return GetConstruction().IsPartConstructed("level_3_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_3", player);
224 }
225
226 return true;
227 }

References CheckMemoryPointVerticalDistance(), GetConstruction(), GetGame(), GetPlayer(), and InventorySlots::GetSlotName().

◆ CanOpenFence()

bool BaseBuildingBase::CanOpenFence ( )
inlineprotected

Definition at line 403 of file Fence.c.

404 {
405 if (HasHinges() && !IsOpened() && !IsLocked())
406 return true;
407
408 return false;
409 }
bool IsLocked()
Definition Fence.c:111

References HasHinges(), IsLocked(), and IsOpened().

◆ CanPutIntoHands() [1/4]

override bool BaseBuildingBase::CanPutIntoHands ( EntityAI parent)
inlineprotected

Definition at line 386 of file Fence.c.

387 {
388 if (!super.CanPutIntoHands(parent))
389 return false;
390
391 if (HasBase())
392 return false;
393
394 return true;
395 }

References HasBase().

◆ CanPutIntoHands() [2/4]

override bool BaseBuildingBase::CanPutIntoHands ( EntityAI parent)
inlineprivate

Definition at line 73 of file ShelterSite.c.

74 {
75 return false;
76 }

◆ CanPutIntoHands() [3/4]

override bool BaseBuildingBase::CanPutIntoHands ( EntityAI parent)
inlineprotected

Definition at line 319 of file Totem.c.

320 {
321 return false;
322 }

◆ CanPutIntoHands() [4/4]

override bool BaseBuildingBase::CanPutIntoHands ( EntityAI parent)
inlineprivate

Definition at line 123 of file Watchtower.c.

124 {
125 return false;
126 }

◆ CanReceiveAttachment() [1/3]

override bool BaseBuildingBase::CanReceiveAttachment ( EntityAI attachment,
int slotId )
inlineprotected

Definition at line 351 of file Fence.c.

352 {
353 if (!super.CanReceiveAttachment(attachment, slotId))
354 return false;
355
356 //manage action initiator (AT_ATTACH_TO_CONSTRUCTION)
357 if (!GetGame().IsDedicatedServer())
358 {
360 if (player)
361 {
362 ConstructionActionData construction_action_data = player.GetConstructionActionData();
363
364 //reset action initiator
365 construction_action_data.SetActionInitiator(NULL);
366 }
367 }
368
369 //conditions
370 if (attachment.Type() != ATTACHMENT_WOODEN_LOG)
371 {
372 if (!HasBase())
373 return false;
374 }
375
377 return (HasFullyConstructedGate() && !IsOpened());
378
380 return false;
381
382 return true;
383 }
ATTACHMENT_COMBINATION_LOCK
Definition Fence.c:20

References GateAttachmentConditions(), GetGame(), GetPlayer(), HasBase(), HasFullyConstructedGate(), and IsOpened().

◆ CanReceiveAttachment() [2/3]

override bool BaseBuildingBase::CanReceiveAttachment ( EntityAI attachment,
int slotId )
inlineprotected

Definition at line 252 of file Totem.c.

253 {
254 if (!super.CanReceiveAttachment(attachment, slotId))
255 return false;
256
257 //manage action initiator (AT_ATTACH_TO_CONSTRUCTION)
258 if (!GetGame().IsDedicatedServer())
259 {
261 if (player)
262 {
263 ConstructionActionData construction_action_data = player.GetConstructionActionData();
264
265 //reset action initiator
266 construction_action_data.SetActionInitiator(NULL);
267 }
268 }
269
270 //conditions
272 //flag item attachment
273 if (slot_name == "Material_FPole_Flag")
274 {
276 return true;
277 else
278 return false;
279 }
280 //materials
283 int part_id = -1;
284 for (int i = 0; i < GetConstruction().GetConstructionParts().Count(); i++)
285 {
286 part = GetConstruction().GetConstructionParts().GetElement(i);
287 if (!part.IsBuilt())
288 {
289 if (part_id == -1 || part_id > part.GetId())
290 {
292 part_id = part.GetId();
293 }
294 }
295 }
296
297 if (part_lowest /*&& !part_lowest.IsBuilt()*/)
298 {
299 string cfg_path = "cfgVehicles " + GetType() + " Construction " + part_lowest.GetMainPartName() + " " + part_lowest.GetPartName() + " Materials";
300 string material_path;
301 if (GetGame().ConfigIsExisting(cfg_path))
302 {
303 string child_name;
304 string child_slot_name;
305 for (i = 0; i < GetGame().ConfigGetChildrenCount(cfg_path); i++)
306 {
307 GetGame().ConfigGetChildName(cfg_path, i, child_name);
308 material_path = "" + cfg_path + " " + child_name + " slot_name";
310 return true;
311 }
312 }
313 }
314
315 return false;
316 }
eBleedingSourceType GetType()

References GetConstruction(), GetGame(), GetPlayer(), InventorySlots::GetSlotName(), GetType(), and IsPartConstructed().

◆ CanReceiveAttachment() [3/3]

override bool BaseBuildingBase::CanReceiveAttachment ( EntityAI attachment,
int slotId )
inlineprivate

Definition at line 90 of file Watchtower.c.

91 {
92 if (!super.CanReceiveAttachment(attachment, slotId))
93 return false;
94
95 //because CanReceiveAttachment() method can be called on all clients in the vicinity, vertical distance check needs to be skipped on clients that don't
96 //interact with the object through attach action (AT_ATTACH_TO_CONSTRUCTION)
98 if (!GetGame().IsDedicatedServer())
99 {
100 //check action initiator (AT_ATTACH_TO_CONSTRUCTION)
102 if (player)
103 {
104 ConstructionActionData construction_action_data = player.GetConstructionActionData();
106
108 {
109 construction_action_data.SetActionInitiator(NULL); //reset action initiator
110 }
111 else
112 {
113 player = null; //do not do vertical check (next)
114 }
115 }
116 }
117 //
118
120 }
override bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
Definition Watchtower.c:267

References CheckSlotVerticalDistance(), GetGame(), and GetPlayer().

◆ CanUseConstructionBuild()

override bool BaseBuildingBase::CanUseConstructionBuild ( )
inlineprotected

Definition at line 670 of file Fence.c.

671 {
672 return !IsOpened();
673 }

References IsOpened().

◆ CanUseHandConstruction()

override bool BaseBuildingBase::CanUseHandConstruction ( )
inlineprivate

Definition at line 83 of file ShelterSite.c.

84 {
85 return true;
86 }

◆ CheckFenceClosed()

void BaseBuildingBase::CheckFenceClosed ( )
inlineprotected

Definition at line 513 of file Fence.c.

514 {
515 if (GetAnimationPhase("Wall_Gate_Rotate") == 0) //animation finished - closed
516 {
517 //client or single player
518 if (!GetGame().IsDedicatedServer())
519 {
520 //play sound
521 if (this) SoundGateCloseEnd();
522 }
523 UpdateBarbedWireAreaDamagePos(GetAnimationPhase("Wall_Gate_Rotate"));
524 //remove check
525 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
526 }
527 }
void CheckFenceClosed()
Definition Fence.c:513
void UpdateBarbedWireAreaDamagePos(float rotation_angle=0, bool to_delete=false)
Definition Fence.c:539
void SoundGateCloseEnd()
Definition Fence.c:692
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

References CALL_CATEGORY_GAMEPLAY, GetGame(), SoundGateCloseEnd(), and UpdateBarbedWireAreaDamagePos().

◆ CheckFenceOpened()

void BaseBuildingBase::CheckFenceOpened ( )
inlineprotected

Definition at line 503 of file Fence.c.

504 {
505 if (GetAnimationPhase("Wall_Gate_Rotate") == GATE_ROTATION_ANGLE_DEG) //animation finished - open
506 {
507 UpdateBarbedWireAreaDamagePos(GetAnimationPhase("Wall_Gate_Rotate"));
508 //remove check
509 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
510 }
511 }
const float GATE_ROTATION_ANGLE_DEG
Definition Fence.c:13
void CheckFenceOpened()
Definition Fence.c:503

References CALL_CATEGORY_GAMEPLAY, GetGame(), and UpdateBarbedWireAreaDamagePos().

◆ CheckGateState()

int BaseBuildingBase::CheckGateState ( )
inlineprotected

Definition at line 77 of file Fence.c.

78 {
79 ConstructionPart gate_part = GetConstruction().GetGateConstructionPart();
81 if (gate_part.IsBuilt())
82 {
84 array<string> req_parts = gate_part.GetRequiredParts();
85 for (int i = 0; i < req_parts.Count(); i++)
86 {
87 req_part = GetConstruction().GetConstructionPart(req_parts.Get(i));
88 if (!req_part.IsBuilt())
89 break;
90 }
91
92 if (i != req_parts.Count())
94 else
96
97 }
98 return state;
99 }
const int GATE_STATE_NONE
Definition Fence.c:3
const int GATE_STATE_FULL
Definition Fence.c:5
const int GATE_STATE_PARTIAL
Definition Fence.c:4

References GATE_STATE_FULL, GATE_STATE_NONE, GATE_STATE_PARTIAL, and GetConstruction().

Referenced by AfterStoreLoad(), OnPartBuiltServer(), OnPartDestroyedServer(), and OnPartDismantledServer().

◆ CheckLevelVerticalDistance()

override bool BaseBuildingBase::CheckLevelVerticalDistance ( float max_dist,
string selection,
PlayerBase player )
inlineprivate

Definition at line 333 of file Watchtower.c.

334 {
335 if (player)
336 {
337 if (selection.Contains("level_1_"))
339
340 if (selection.Contains("level_2_"))
342
343 if (selection.Contains("level_3_"))
345 }
346 return false;
347 }
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286

References CheckMemoryPointVerticalDistance(), and string::Contains().

Referenced by IsPlayerInside().

◆ CheckLoadedVariables()

void BaseBuildingBase::CheckLoadedVariables ( int max_duration)
inlineprotected

◆ CheckMemoryPointVerticalDistance()

override bool BaseBuildingBase::CheckMemoryPointVerticalDistance ( float max_dist,
string selection,
PlayerBase player )
inlineprivate

Definition at line 313 of file Watchtower.c.

314 {
315 if (player)
316 {
317 //check vertical distance
318 vector player_pos = player.GetPosition();
319 vector pos;
320
321 if (MemoryPointExists(selection))
322 pos = ModelToWorld(GetMemoryPointPos(selection));
323
324 if (Math.AbsFloat(player_pos[1] - pos[1]) <= max_dist)
325 return true;
326 else
327 return false;
328 }
329
330 return true;
331 }
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat().

Referenced by CanDisplayAttachmentCategory(), CanDisplayAttachmentSlot(), CheckLevelVerticalDistance(), and CheckSlotVerticalDistance().

◆ CheckSlotVerticalDistance()

override bool BaseBuildingBase::CheckSlotVerticalDistance ( int slot_id,
PlayerBase player )
inlineprivate

Definition at line 267 of file Watchtower.c.

268 {
269 string slot_name;
271 slot_name.ToLower();
272
273 //wall attachments
274 //level 1
275 if (slot_name.Contains("material_l1") || slot_name.Contains("level_1_"))
276 {
277 if (slot_name.Contains("woodenlogs"))
279 else
280 return GetConstruction().IsPartConstructed("level_1_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_1", player);
281 }
282 //level 2
283 if (slot_name.Contains("material_l2") || slot_name.Contains("level_2_"))
284 {
285 if (slot_name.Contains("material_l2w") || slot_name.Contains("level_2_wall"))
286 return GetConstruction().IsPartConstructed("level_2_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_2", player);
287 else
288 {
289 if (slot_name.Contains("woodenlogs"))
291 else
292 return GetConstruction().IsPartConstructed("level_1_roof") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_2", player);
293 }
294 }
295 //level 3
296 if (slot_name.Contains("material_l3") || slot_name.Contains("level_3_"))
297 {
298 if (slot_name.Contains("material_l3w") || slot_name.Contains("level_3_wall"))
299 return GetConstruction().IsPartConstructed("level_3_base") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_3", player);
300 else
301 {
302 if (slot_name.Contains("woodenlogs"))
304 else
305 return GetConstruction().IsPartConstructed("level_2_roof") && CheckMemoryPointVerticalDistance(MAX_FLOOR_VERTICAL_DISTANCE, "level_3", player);
306 }
307 }
308
309 return true;
310 }
static proto bool GetSelectionForSlotId(int slot_Id, out string selection)

References CheckMemoryPointVerticalDistance(), GetConstruction(), and InventorySlots::GetSelectionForSlotId().

Referenced by CanReceiveAttachment().

◆ CloseFence()

void BaseBuildingBase::CloseFence ( )
inlineprotected

Definition at line 461 of file Fence.c.

462 {
463 //server or single player
464 if (GetGame().IsServer())
465 {
466 float value = 0;
467 SetAnimationPhase("Wall_Interact_Rotate", value);
468 SetAnimationPhase("Wall_Barbedwire_1_Mounted_Rotate", value);
469 SetAnimationPhase("Wall_Barbedwire_2_Mounted_Rotate", value);
470 SetAnimationPhase("Wall_Camonet_Rotate", value);
471 SetAnimationPhase("Wall_Gate_Rotate", value);
472 SetAnimationPhase("Wall_Base_Down_Rotate", value);
473 SetAnimationPhase("Wall_Base_Up_Rotate", value);
474 SetAnimationPhase("Wall_Wood_Down_Rotate", value);
475 SetAnimationPhase("Wall_Wood_Up_Rotate", value);
476 SetAnimationPhase("Wall_Metal_Down_Rotate", value);
477 SetAnimationPhase("Wall_Metal_Up_Rotate", value);
478
479 SetOpenedState(false);
480
481 //regenerate navmesh
483
484 //synchronize
486 }
487
488 //client or single player
489 if (!GetGame().IsDedicatedServer())
490 {
491 //play sound
493 }
494
495 //remove BarbedWire AreaDamageTrigger
497
498 //add check
499 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceOpened);
500 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceClosed, 0, true);
501 }
void UpdateNavmesh()
void SynchronizeBaseState()
void SetOpenedState(bool state)
Definition Fence.c:101
const float GATE_ROTATION_TIME_APPROX
Definition Fence.c:14
void SoundGateCloseStart()
Definition Fence.c:685

References CALL_CATEGORY_GAMEPLAY, GetGame(), SetOpenedState(), SoundGateCloseStart(), SynchronizeBaseState(), UpdateBarbedWireAreaDamagePos(), and UpdateNavmesh().

Referenced by OnPartDestroyedServer(), and OnVariablesSynchronized().

◆ CreateAreaDamage()

override void BaseBuildingBase::CreateAreaDamage ( string slot_name,
float rotation_angle = 0 )
inlineprotected

Definition at line 530 of file Fence.c.

531 {
532 if (IsOpened())
533 rotation_angle = 100;
534
535 super.CreateAreaDamage(slot_name, rotation_angle);
536 }

References IsOpened().

◆ Fence()

void BaseBuildingBase::Fence ( )
inlineprotected

Definition at line 36 of file Fence.c.

37 {
38 //synchronized variables
39 //RegisterNetSyncVariableBool( "m_HasHinges" );
40 //RegisterNetSyncVariableBool( "m_GateFullyConstructed" );
41 RegisterNetSyncVariableBool("m_IsOpened");
42 RegisterNetSyncVariableInt("m_GateState");
43 }

◆ GateAttachmentConditions()

bool BaseBuildingBase::GateAttachmentConditions ( int slotId)
inlineprotected

Definition at line 731 of file Fence.c.

732 {
734 {
735 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
736 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
738 if (!wall_base_up.IsBuilt())
739 {
741 return false;
742 }
743 if (!wall_base_down.IsBuilt())
744 {
746 return false;
747 }
748 }
749 return true;
750 }
string ATTSLOT_BARBEDWIRE_DOWN
Definition Fence.c:23
string ATTSLOT_BARBEDWIRE_UP
Definition Fence.c:24
int GetGateState()
Definition Fence.c:72
string ATTSLOT_CAMONET
Definition Fence.c:22

References GetConstruction(), GetGateState(), and InventorySlots::GetSlotName().

Referenced by CanDisplayAttachmentSlot(), and CanReceiveAttachment().

◆ GateAttachmentsSanityCheck()

void BaseBuildingBase::GateAttachmentsSanityCheck ( )
inlineprotected

Definition at line 699 of file Fence.c.

700 {
701 ConstructionPart wall_base_down = GetConstruction().GetConstructionPart("wall_base_down");
702 ConstructionPart wall_base_up = GetConstruction().GetConstructionPart("wall_base_up");
703 if (GetBarbedWire1() && !wall_base_down.IsBuilt())
704 {
707 }
708 if ((GetCamoNet() || GetBarbedWire2()) && !wall_base_up.IsBuilt())
709 {
713 }
714 }
void HandleDropAttachment(ItemBase item)
Definition Fence.c:716
CamoNet GetCamoNet()
Definition Fence.c:137
BarbedWire GetBarbedWire1()
Definition Fence.c:143
CombinationLock GetCombinationLock()
Definition Fence.c:131
BarbedWire GetBarbedWire2()
Definition Fence.c:149

References GetBarbedWire1(), GetBarbedWire2(), GetCamoNet(), GetCombinationLock(), GetConstruction(), and HandleDropAttachment().

◆ GetBarbedWire1()

BarbedWire BaseBuildingBase::GetBarbedWire1 ( )
inlineprotected

Definition at line 143 of file Fence.c.

144 {
145 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName("Wall_Barbedwire_1"));
146 return barbedwire;
147 }

Referenced by GateAttachmentsSanityCheck(), OnPartDestroyedServer(), and UpdateBarbedWireAreaDamagePos().

◆ GetBarbedWire2()

BarbedWire BaseBuildingBase::GetBarbedWire2 ( )
inlineprotected

Definition at line 149 of file Fence.c.

150 {
151 BarbedWire barbedwire = BarbedWire.Cast(FindAttachmentBySlotName("Wall_Barbedwire_2"));
152 return barbedwire;
153 }

Referenced by GateAttachmentsSanityCheck(), OnPartDestroyedServer(), and UpdateBarbedWireAreaDamagePos().

◆ GetCamoNet()

CamoNet BaseBuildingBase::GetCamoNet ( )
inlineprotected

Definition at line 137 of file Fence.c.

138 {
139 CamoNet camonet = CamoNet.Cast(FindAttachmentBySlotName("Wall_Camonet"));
140 return camonet;
141 }

Referenced by GateAttachmentsSanityCheck(), and OnPartDestroyedServer().

◆ GetCombinationLock()

CombinationLock BaseBuildingBase::GetCombinationLock ( )
inlineprotected

Definition at line 131 of file Fence.c.

132 {
134 return combination_lock;
135 }
const string ATTACHMENT_SLOT_COMBINATION_LOCK
Definition Fence.c:7

Referenced by GateAttachmentsSanityCheck(), IsLocked(), and OnPartDestroyedServer().

◆ GetConstructionKitType() [1/4]

override string BaseBuildingBase::GetConstructionKitType ( )
inlineprotected

Definition at line 45 of file Fence.c.

46 {
47 return "FenceKit";
48 }

Referenced by ItemBase::CreateConstructionKit(), and ItemBase::CreateConstructionKitInHands().

◆ GetConstructionKitType() [2/4]

override string BaseBuildingBase::GetConstructionKitType ( )
inlineprivate

Definition at line 10 of file ShelterSite.c.

11 {
12 return "ShelterKit";
13 }

◆ GetConstructionKitType() [3/4]

override string BaseBuildingBase::GetConstructionKitType ( )
inlineprotected

Definition at line 44 of file Totem.c.

45 {
46 return "TerritoryFlagKit";
47 }

◆ GetConstructionKitType() [4/4]

override string BaseBuildingBase::GetConstructionKitType ( )
inlineprivate

Definition at line 21 of file Watchtower.c.

22 {
23 return "WatchtowerKit";
24 }

◆ GetGateState()

int BaseBuildingBase::GetGateState ( )
inlineprotected

Definition at line 72 of file Fence.c.

73 {
74 return m_GateState;
75 }
int m_GateState
Definition Fence.c:31

References m_GateState.

Referenced by GateAttachmentConditions().

◆ GetKitSpawnPosition() [1/3]

override vector BaseBuildingBase::GetKitSpawnPosition ( )
inlineprotected

Definition at line 156 of file Fence.c.

157 {
158 if (MemoryPointExists("kit_spawn_position"))
159 {
161 position = GetMemoryPointPos("kit_spawn_position");
162
163 return ModelToWorld(position);
164 }
165
166 return GetPosition();
167 }
class JsonUndergroundAreaTriggerData GetPosition

References GetPosition.

Referenced by ItemBase::CreateConstructionKit().

◆ GetKitSpawnPosition() [2/3]

override vector BaseBuildingBase::GetKitSpawnPosition ( )
inlineprivate

Definition at line 21 of file ShelterSite.c.

22 {
23 if (MemoryPointExists("kit_spawn_position"))
24 {
26 position = GetMemoryPointPos("kit_spawn_position");
27
28 return ModelToWorld(position);
29 }
30
31 return GetPosition();
32 }

References GetPosition.

◆ GetKitSpawnPosition() [3/3]

override vector BaseBuildingBase::GetKitSpawnPosition ( )
inlineprotected

Definition at line 66 of file Totem.c.

67 {
68 if (MemoryPointExists("kit_spawn_position"))
69 {
71 position = GetMemoryPointPos("kit_spawn_position");
72
73 return ModelToWorld(position);
74 }
75
76 return GetPosition();
77 }

References GetPosition.

◆ GetMeleeTargetType() [1/4]

override int BaseBuildingBase::GetMeleeTargetType ( )
inlineprotected

Definition at line 50 of file Fence.c.

51 {
52 return EMeleeTargetType.NONALIGNABLE;
53 }
EMeleeTargetType

◆ GetMeleeTargetType() [2/4]

override int BaseBuildingBase::GetMeleeTargetType ( )
inlineprivate

Definition at line 15 of file ShelterSite.c.

16 {
17 return EMeleeTargetType.NONALIGNABLE;
18 }

◆ GetMeleeTargetType() [3/4]

override int BaseBuildingBase::GetMeleeTargetType ( )
inlineprotected

Definition at line 49 of file Totem.c.

50 {
51 return EMeleeTargetType.NONALIGNABLE;
52 }

◆ GetMeleeTargetType() [4/4]

override int BaseBuildingBase::GetMeleeTargetType ( )
inlineprivate

Definition at line 26 of file Watchtower.c.

27 {
28 return EMeleeTargetType.NONALIGNABLE;
29 }

◆ GetRefresherTime01()

float BaseBuildingBase::GetRefresherTime01 ( )
inlineprotected

Definition at line 512 of file Totem.c.

References m_FlagRefresherMaxDuration.

Referenced by OnCEUpdate(), and OnStoreLoad().

◆ HandleDropAttachment()

void BaseBuildingBase::HandleDropAttachment ( ItemBase item)
inlineprotected

Definition at line 716 of file Fence.c.

717 {
718 BarbedWire wire;
720 if (Class.CastTo(wire, item)) //special barbed wire beh.
721 {
722 wire.SetMountedState(false);
723 GetInventory().DropEntity(InventoryMode.SERVER, this, wire);
724 }
725 else if (Class.CastTo(lock, item))
726 lock.UnlockServer(null, this);
727 else if (item)//generic behaviour
728 GetInventory().DropEntity(InventoryMode.SERVER, this, item);
729 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

Referenced by GateAttachmentsSanityCheck(), and OnPartDestroyedServer().

◆ HandleRefreshers()

void BaseBuildingBase::HandleRefreshers ( )
inlineprotected

Client-side, saves positions of active lifetime refreshers to MissionGameplay.

Definition at line 163 of file Totem.c.

164 {
165 Mission mission = GetGame().GetMission();
167 return;
168
170 if (m_RefresherActive && idx == -1)
172 else if (!m_RefresherActive && idx > -1)
174 }
Mission mission
bool m_RefresherActive
Definition Totem.c:6
void InsertRefresherPosition()
Definition Totem.c:188
Mission class.
Definition gameplay.c:668
ref array< vector > m_ActiveRefresherLocations
Definition gameplay.c:671

References GetGame(), GetPosition, InsertRefresherPosition(), Mission::m_ActiveRefresherLocations, mission, and RemoveRefresherPosition().

Referenced by OnVariablesSynchronized().

◆ HasFullyConstructedGate()

bool BaseBuildingBase::HasFullyConstructedGate ( )
inlineprotected

Definition at line 61 of file Fence.c.

62 {
64 }

References GATE_STATE_FULL.

Referenced by CanDisplayAttachmentSlot(), and CanReceiveAttachment().

◆ HasHinges()

bool BaseBuildingBase::HasHinges ( )
inlineprotected

Definition at line 56 of file Fence.c.

57 {
59 }

References GATE_STATE_NONE.

Referenced by CanCloseFence(), and CanOpenFence().

◆ HasProperDistance() [1/4]

override bool BaseBuildingBase::HasProperDistance ( string selection,
PlayerBase player )
inlineprotected

Definition at line 657 of file Fence.c.

658 {
659 if (MemoryPointExists(selection))
660 {
661 vector selection_pos = ModelToWorld(GetMemoryPointPos(selection));
662 float distance = vector.Distance(selection_pos, player.GetPosition());
664 return false;
665 }
666
667 return true;
668 }
const float MAX_ACTION_DETECTION_DISTANCE
Definition Fence.c:17
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

References vector::Distance().

◆ HasProperDistance() [2/4]

override bool BaseBuildingBase::HasProperDistance ( string selection,
PlayerBase player )
inlineprivate

Definition at line 146 of file ShelterSite.c.

147 {
148 if (MemoryPointExists(selection))
149 {
150 vector selection_pos = ModelToWorld(GetMemoryPointPos(selection));
151 float distance = vector.Distance(selection_pos, player.GetPosition());
153 return false;
154 }
155
156 return true;
157 }

References vector::Distance().

◆ HasProperDistance() [3/4]

override bool BaseBuildingBase::HasProperDistance ( string selection,
PlayerBase player )
inlineprotected

Definition at line 416 of file Totem.c.

417 {
418 //TODO
419 if (MemoryPointExists(selection))
420 {
421 vector selection_pos = ModelToWorld(GetMemoryPointPos(selection));
422 float distance = vector.Distance(selection_pos, player.GetPosition());
424 return false;
425 }
426
427 return true;
428 }

References vector::Distance().

◆ HasProperDistance() [4/4]

override bool BaseBuildingBase::HasProperDistance ( string selection,
PlayerBase player )
inlineprivate

Definition at line 484 of file Watchtower.c.

485 {
486 if (MemoryPointExists(selection))
487 {
488 vector selection_pos = ModelToWorld(GetMemoryPointPos(selection));
489 float distance = vector.Distance(selection_pos, player.GetPosition());
491 return false;
492 }
493
494 return true;
495 }

References vector::Distance().

◆ InitRefresherData()

void BaseBuildingBase::InitRefresherData ( )
inlineprotected

Definition at line 32 of file Totem.c.

33 {
34 int frequency = GetCEApi().GetCEGlobalInt("FlagRefreshFrequency");
35 int max_duration = GetCEApi().GetCEGlobalInt("FlagRefreshMaxDuration");
36
37 if (frequency > 0)
39 if (max_duration > 0)
42 }
int m_FlagRefresherFrequency
Definition Totem.c:12

References GetCEApi().

Referenced by AfterStoreLoad(), and TerritoryFlag().

◆ InsertRefresherPosition()

void BaseBuildingBase::InsertRefresherPosition ( )
inlineprotected

Definition at line 188 of file Totem.c.

189 {
190 Mission mission = GetGame().GetMission();
192 }

References GetGame(), GetPosition, Mission::m_ActiveRefresherLocations, and mission.

Referenced by HandleRefreshers().

◆ IsFacingCamera() [1/4]

override bool BaseBuildingBase::IsFacingCamera ( string selection)
inlineprotected

Definition at line 634 of file Fence.c.

635 {
636 vector ref_dir = GetDirection();
637 vector cam_dir = GetGame().GetCurrentCameraDirection();
638
639 //ref_dir = GetGame().GetCurrentCameraPosition() - GetPosition();
640 ref_dir.Normalize();
641 ref_dir[1] = 0; //ignore height
642
643 cam_dir.Normalize();
644 cam_dir[1] = 0; //ignore height
645
646 if (ref_dir.Length() != 0)
647 {
648 float angle = Math.Acos(cam_dir * ref_dir);
649
651 return true;
652 }
653
654 return false;
655 }
const float MAX_ACTION_DETECTION_ANGLE_RAD
Definition Fence.c:16
static proto float Acos(float c)
Returns angle in radians from cosinus.

References Math::Acos(), and GetGame().

◆ IsFacingCamera() [2/4]

override bool BaseBuildingBase::IsFacingCamera ( string selection)
inlineprivate

Definition at line 93 of file ShelterSite.c.

94 {
95 vector ref_dir = GetDirection();
96 vector cam_dir = GetGame().GetCurrentCameraDirection();
97
98 //ref_dir = GetGame().GetCurrentCameraPosition() - GetPosition();
99 ref_dir.Normalize();
100 ref_dir[1] = 0; //ignore height
101
102 cam_dir.Normalize();
103 cam_dir[1] = 0; //ignore height
104
105 if (ref_dir.Length() != 0)
106 {
107 float angle = Math.Acos(cam_dir * ref_dir);
108
110 return true;
111 }
112
113 return false;
114 }

References Math::Acos(), and GetGame().

◆ IsFacingCamera() [3/4]

override bool BaseBuildingBase::IsFacingCamera ( string selection)
inlineprotected

Definition at line 391 of file Totem.c.

392 {
393 return false; //TODO
394
395 vector ref_dir = GetDirection();
396 vector cam_dir = GetGame().GetCurrentCameraDirection();
397
398 //ref_dir = GetGame().GetCurrentCameraPosition() - GetPosition();
399 ref_dir.Normalize();
400 ref_dir[1] = 0; //ignore height
401
402 cam_dir.Normalize();
403 cam_dir[1] = 0; //ignore height
404
405 if (ref_dir.Length() != 0)
406 {
407 float angle = Math.Acos(cam_dir * ref_dir);
408
410 return true;
411 }
412
413 return false;
414 }

References Math::Acos(), and GetGame().

◆ IsFacingCamera() [4/4]

override bool BaseBuildingBase::IsFacingCamera ( string selection)
inlineprivate

Definition at line 422 of file Watchtower.c.

423 {
426 vector cam_dir = GetGame().GetCurrentCameraDirection();
427
428 if (MemoryPointExists(selection))
429 {
430 ref_pos = ModelToWorld(GetMemoryPointPos(selection));
432
433 ref_dir.Normalize();
434 ref_dir[1] = 0; //ignore height
435
436 cam_dir[1] = 0; //ignore height
437
438 if (ref_dir.Length() > 0.5) //if the distance (m) is too low, ignore this check
439 {
440 float dot = vector.Dot(cam_dir, ref_dir);
441
442 if (dot < 0)
443 return true;
444 }
445 }
446
447 return false;
448 }
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271

References vector::Dot(), GetGame(), and GetPosition.

◆ IsFacingPlayer() [1/3]

override bool BaseBuildingBase::IsFacingPlayer ( PlayerBase player,
string selection )
inlineprotected

Definition at line 609 of file Fence.c.

610 {
612 vector player_pos = player.GetPosition();
613 vector ref_dir = GetDirection();
614
615 //vector fence_player_dir = player_pos - fence_pos;
616 vector fence_player_dir = player.GetDirection();
617 fence_player_dir.Normalize();
618 fence_player_dir[1] = 0; //ignore height
619
620 ref_dir.Normalize();
621 ref_dir[1] = 0; //ignore height
622
623 if (ref_dir.Length() != 0)
624 {
626
628 return true;
629 }
630
631 return false;
632 }

References Math::Acos(), and GetPosition.

◆ IsFacingPlayer() [2/3]

override bool BaseBuildingBase::IsFacingPlayer ( PlayerBase player,
string selection )
inlineprotected

Definition at line 364 of file Totem.c.

365 {
366 return true; //TODO
367
369 vector player_pos = player.GetPosition();
370 vector ref_dir = GetDirection();
371
372 //vector fence_player_dir = player_pos - fence_pos;
373 vector fence_player_dir = player.GetDirection();
374 fence_player_dir.Normalize();
375 fence_player_dir[1] = 0; //ignore height
376
377 ref_dir.Normalize();
378 ref_dir[1] = 0; //ignore height
379
380 if (ref_dir.Length() != 0)
381 {
383
385 return true;
386 }
387
388 return false;
389 }

References Math::Acos(), and GetPosition.

◆ IsFacingPlayer() [3/3]

override bool BaseBuildingBase::IsFacingPlayer ( PlayerBase player,
string selection )
inlineprivate

Definition at line 379 of file Watchtower.c.

380 {
384 float dot;
385 bool has_memory_point = MemoryPointExists(selection);
386
388 {
389 ref_pos = ModelToWorld(GetMemoryPointPos(selection));
391 }
392 else
393 {
395 ref_dir = ref_pos - player.GetPosition();
396 }
397
398 ref_dir.Normalize();
399 ref_dir[1] = 0; //ignore height
400
401 player_dir = player.GetDirection();
402 player_dir.Normalize();
403 player_dir[1] = 0; //ignore height
404
405 if (ref_dir.Length() != 0)
407
409 {
411 return true;
412 }
413 else
414 {
416 return true;
417 }
418
419 return false;
420 }
const float MIN_ACTION_DETECTION_ANGLE_RAD
Definition Watchtower.c:8

References Math::AbsFloat(), vector::Dot(), and GetPosition.

◆ IsLocked()

bool BaseBuildingBase::IsLocked ( )
inlineprotected

Definition at line 111 of file Fence.c.

112 {
114 if (combination_lock && combination_lock.IsLocked())
115 return true;
116
117 return false;
118 }

References GetCombinationLock().

Referenced by CanOpenFence(), and OnPartDismantledServer().

◆ IsOpened()

override bool BaseBuildingBase::IsOpened ( )
inlineprotected

◆ IsPlayerInside() [1/4]

override bool BaseBuildingBase::IsPlayerInside ( PlayerBase player,
string selection )
inlineprotected

Definition at line 577 of file Fence.c.

578 {
579 vector player_pos = player.GetPosition();
581 vector ref_dir = GetDirection();
582 ref_dir[1] = 0;
583 ref_dir.Normalize();
584
585 vector x[2];
586 vector b1, b2;
587 GetCollisionBox(x);
588 b1 = x[0];
589 b2 = x[1];
590
592 dir_to_fence[1] = 0;
593 float len = dir_to_fence.Length();
594
595 dir_to_fence.Normalize();
596
597 vector ref_dir_angle = ref_dir.VectorToAngles();
598 vector dir_to_fence_angle = dir_to_fence.VectorToAngles();
600
601 vector test_position = test_angles.AnglesToVector() * len;
602
603 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
604 return false;
605 else
606 return true;
607 }
Icon x

References GetPosition, and x.

Referenced by VicinityContainer::UpdateInterval().

◆ IsPlayerInside() [2/4]

override bool BaseBuildingBase::IsPlayerInside ( PlayerBase player,
string selection )
inlineprivate

Definition at line 116 of file ShelterSite.c.

117 {
118 vector player_pos = player.GetPosition();
120 vector ref_dir = GetDirection();
121 ref_dir[1] = 0;
122 ref_dir.Normalize();
123
124 vector min, max;
125 min = -GetMemoryPointPos("BoundingBox_min");
126 max = -GetMemoryPointPos("BoundingBox_max");
127
129 dir_to_object[1] = 0;
130 float len = dir_to_object.Length();
131
132 dir_to_object.Normalize();
133
134 vector ref_dir_angle = ref_dir.VectorToAngles();
135 vector dir_to_object_angle = dir_to_object.VectorToAngles();
137
138 vector test_position = test_angles.AnglesToVector() * len;
139
140 if (test_position[0] > max[0] || test_position[0] < min[0] || test_position[2] > max[2] || test_position[2] < min[2])
141 return false;
142
143 return true;
144 }

References GetPosition.

◆ IsPlayerInside() [3/4]

override bool BaseBuildingBase::IsPlayerInside ( PlayerBase player,
string selection )
inlineprotected

Definition at line 330 of file Totem.c.

331 {
332 return true; //TODO
333
334 vector player_pos = player.GetPosition();
336 vector ref_dir = GetDirection();
337 ref_dir[1] = 0;
338 ref_dir.Normalize();
339
340 vector x[2];
341 vector b1, b2;
342 GetCollisionBox(x);
343 b1 = x[0];
344 b2 = x[1];
345
347 dir_to_fence[1] = 0;
348 float len = dir_to_fence.Length();
349
350 dir_to_fence.Normalize();
351
352 vector ref_dir_angle = ref_dir.VectorToAngles();
353 vector dir_to_fence_angle = dir_to_fence.VectorToAngles();
355
356 vector test_position = test_angles.AnglesToVector() * len;
357
358 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
359 return false;
360 else
361 return true;
362 }

References GetPosition, and x.

◆ IsPlayerInside() [4/4]

override bool BaseBuildingBase::IsPlayerInside ( PlayerBase player,
string selection )
inlineprivate

Definition at line 450 of file Watchtower.c.

451 {
452 if (selection != "")
454 vector player_pos = player.GetPosition();
456 vector ref_dir = GetDirection();
457 ref_dir[1] = 0;
458 ref_dir.Normalize();
459
460 vector min, max;
461
462 min = -GetMemoryPointPos("interact_min");
463 max = -GetMemoryPointPos("interact_max");
464
466 dir_to_tower[1] = 0;
467 float len = dir_to_tower.Length();
468
469
470 dir_to_tower.Normalize();
471
472 vector ref_dir_angle = ref_dir.VectorToAngles();
473 vector dir_to_tower_angle = dir_to_tower.VectorToAngles();
475
476 vector test_position = test_angles.AnglesToVector() * len;
477
478 if (test_position[0] > max[0] || test_position[0] < min[0] || test_position[2] > max[2] || test_position[2] < min[2])
479 return false;
480
481 return true;
482 }
override bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
Definition Watchtower.c:333

References CheckLevelVerticalDistance(), and GetPosition.

◆ LogAnimateFlag()

void BaseBuildingBase::LogAnimateFlag ( float newPhase,
notnull PlayerBase player )
inlineprotected

Definition at line 475 of file Totem.c.

476 {
477 PluginAdminLog logs = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
478 if (newPhase == 0)
479 {
480 // at the top(it's inverted)
481 logs.TotemFlagChange(true, player, this);
482 }
483 else if (newPhase == 1)
484 {
485 // at the bottom(it's inverted)
486 logs.TotemFlagChange(false, player, this);
487 }
488
489 }
PluginBase GetPlugin(typename plugin_type)

References GetPlugin().

Referenced by AnimateFlagEx().

◆ MustBeBuiltFromOutside()

override bool BaseBuildingBase::MustBeBuiltFromOutside ( )
inlineprivate

Definition at line 88 of file ShelterSite.c.

89 {
90 return true;
91 }

◆ NameOverride()

override bool BaseBuildingBase::NameOverride ( out string output)
inlineprotected

Definition at line 120 of file Fence.c.

121 {
123 {
124 output = "#str_cfgvehicles_construction_part_gate"; //changes object displayed name if in 'gate' state
125 output.ToUpper();
126 return true;
127 }
128 return false;
129 }

◆ OnCEUpdate()

override void BaseBuildingBase::OnCEUpdate ( )
inlineprotected

Definition at line 141 of file Totem.c.

142 {
143 super.OnCEUpdate();
144
145 int time_elapsed_rounded = Math.Round(m_ElapsedSinceLastUpdate);
146
148 {
151 {
152 GetCEApi().RadiusLifetimeReset(GetPosition(), GameConstants.REFRESHER_RADIUS);
154 m_RefreshTimeCounter = 0; //possibly carry over the rest?
156 }
157 }
158
160 }
float GetRefresherTime01()
Definition Totem.c:512
int m_RefreshTimeCounter
Definition Totem.c:10
void AnimateFlag(float delta)
Definition Totem.c:470
const float REFRESHER_RADIUS
Definition constants.c:881

References AnimateFlag(), Math::Clamp(), GetCEApi(), GetPosition, GetRefresherTime01(), GameConstants::REFRESHER_RADIUS, Math::Round(), and SetRefresherActive().

◆ OnDebugSpawn() [1/3]

override void BaseBuildingBase::OnDebugSpawn ( )
inlineprotected

Definition at line 822 of file Fence.c.

823 {
824 super.OnDebugSpawn();
825
826 GetInventory().CreateInInventory("CamoNet");
827
828 for (int i = 0; i < 2; ++i)
829 {
830 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory("BarbedWire"));
831 wire.SetMountedState(true);
832 }
833 }

◆ OnDebugSpawn() [2/3]

override void BaseBuildingBase::OnDebugSpawn ( )
inlineprotected

Definition at line 539 of file Totem.c.

540 {
541 super.OnDebugSpawn();
542
543 GetInventory().CreateInInventory("Flag_DayZ");
544 AnimateFlag(0);
546 }
void AddRefresherTime01(float fraction)
Definition Totem.c:504

References AddRefresherTime01(), and AnimateFlag().

◆ OnDebugSpawn() [3/3]

override void BaseBuildingBase::OnDebugSpawn ( )
inlineprivate

Definition at line 535 of file Watchtower.c.

536 {
537 super.OnDebugSpawn();
538
539 int i;
540
542 GetInventory().CreateInInventory("CamoNet");
543
544 for (i = 0; i < 2 * MAX_WATCHTOWER_WALLS; ++i)
545 {
546 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory("BarbedWire"));
547 wire.SetMountedState(true);
548 }
549 }
static const int MAX_WATCHTOWER_WALLS
Definition Watchtower.c:15
static const int MAX_WATCHTOWER_FLOORS
Definition Watchtower.c:14

References MAX_WATCHTOWER_WALLS.

◆ OnDebugSpawnBuildExcludes() [1/2]

override array< string > BaseBuildingBase::OnDebugSpawnBuildExcludes ( )
inlineprotected

Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.

Definition at line 792 of file Fence.c.

793 {
795
796#ifdef DIAG_DEVELOPER
797 bool bWood = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_WOOD);
798#else
799 bool bWood = false;
800#endif
801
802 if (bWood)
803 excludes.Insert("_metal_");
804 else
805 excludes.Insert("_wood_");
806
807#ifdef DIAG_DEVELOPER
808 bool bGate = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_GATE);
809#else
810 bool bGate = false;
811#endif
812
813 if (bGate)
814 excludes.Insert("platform");
815 else
816 excludes.Insert("gate");
817
818 return excludes;
819 }
DiagMenuIDs
Definition EDiagMenuIDs.c:2
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.

References DiagMenu::GetBool().

Referenced by ItemBase::FullyBuild().

◆ OnDebugSpawnBuildExcludes() [2/2]

override array< string > BaseBuildingBase::OnDebugSpawnBuildExcludes ( )
inlineprivate

Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.

Definition at line 512 of file Watchtower.c.

513 {
515
516#ifdef DIAG_DEVELOPER
517 bool bWood = DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_WOOD);
518#else
519 bool bWood = false;
520#endif
521
522 if (bWood)
523 {
524 excludes = {"_metal_"};
525 }
526 else
527 {
528 excludes = {"_wood_"};
529 }
530
531 return excludes;
532 }

References DiagMenu::GetBool().

◆ OnPartBuiltServer() [1/4]

override void BaseBuildingBase::OnPartBuiltServer ( notnull Man player,
string part_name,
int action_id )
inlineprotected

Definition at line 281 of file Fence.c.

282 {
284
285 super.OnPartBuiltServer(player, part_name, action_id);
286
288
289 //update visuals (server)
291 }

References CheckGateState(), GetConstruction(), SetGateState(), and UpdateVisuals().

Referenced by ItemBase::FullyBuild().

◆ OnPartBuiltServer() [2/4]

override void BaseBuildingBase::OnPartBuiltServer ( notnull Man player,
string part_name,
int action_id )
inlineprivate

Definition at line 36 of file ShelterSite.c.

37 {
39
40 string shelter_type = "";
41 switch (part_name)
42 {
43 case "leather":
44 shelter_type = "ShelterLeather";
45 break;
46
47 case "fabric":
48 shelter_type = "ShelterFabric";
49 break;
50
51 case "stick":
52 shelter_type = "ShelterStick";
53 break;
54
55 default: {};
56 }
57
58 if (shelter_type != "")
59 {
60 GetConstruction().DropNonUsableMaterialsServer(player, part_name);
61 MiscGameplayFunctions.TurnItemIntoItem(this, shelter_type, PlayerBase.Cast(player));
62
63 PluginAdminLog admin_log = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
64 if (admin_log)
65 {
66 string playerPrefix = admin_log.GetPlayerPrefix(PlayerBase.Cast(player), player.GetIdentity());
67 admin_log.DirectAdminLogPrint(playerPrefix + " built " + shelter_type + " with Hands ");
68 }
69 }
70 //super.OnPartBuiltServer( part_name, action_id );
71 }

References GetConstruction(), and GetPlugin().

◆ OnPartBuiltServer() [3/4]

override void BaseBuildingBase::OnPartBuiltServer ( notnull Man player,
string part_name,
int action_id )
inlineprotected

Definition at line 223 of file Totem.c.

224 {
225 //ConstructionPart constrution_part = GetConstruction().GetConstructionPart( part_name );
226
227 super.OnPartBuiltServer(player, part_name, action_id);
228
229 //update visuals (server)
231 }

References UpdateVisuals().

◆ OnPartBuiltServer() [4/4]

override void BaseBuildingBase::OnPartBuiltServer ( notnull Man player,
string part_name,
int action_id )
inlineprivate

Definition at line 356 of file Watchtower.c.

357 {
358 super.OnPartBuiltServer(player, part_name, action_id);
359 //update visuals (server)
361 }

References UpdateVisuals().

◆ OnPartDestroyedServer() [1/3]

override void BaseBuildingBase::OnPartDestroyedServer ( Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part = false )
inlineprotected

Definition at line 315 of file Fence.c.

316 {
317 super.OnPartDestroyedServer(player, part_name, action_id);
318
319 //check gate state
321 if (constrution_part.IsGate() && destroyed_by_connected_part) //avoids attachment dropping on regular hinges destruction
322 {
323 //drop regular attachments
328
329 //rotate back to place
330 if (IsOpened())
331 CloseFence();
332 }
333 if (part_name == "wall_base_down")
334 {
337 }
338 if (part_name == "wall_base_up")
339 {
343 }
344
346 //update visuals (server)
348 }
void CloseFence()
Definition Fence.c:461

References CheckGateState(), CloseFence(), GetBarbedWire1(), GetBarbedWire2(), GetCamoNet(), GetCombinationLock(), GetConstruction(), HandleDropAttachment(), IsOpened(), SetGateState(), and UpdateVisuals().

◆ OnPartDestroyedServer() [2/3]

override void BaseBuildingBase::OnPartDestroyedServer ( Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part = false )
inlineprotected

Definition at line 243 of file Totem.c.

244 {
245 super.OnPartDestroyedServer(player, part_name, action_id);
246
247 //update visuals (server)
249 }

References UpdateVisuals().

◆ OnPartDestroyedServer() [3/3]

override void BaseBuildingBase::OnPartDestroyedServer ( Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part = false )
inlineprivate

Definition at line 370 of file Watchtower.c.

371 {
372 super.OnPartDestroyedServer(player, part_name, action_id);
373 //update visuals (server)
375 }

References UpdateVisuals().

◆ OnPartDismantledServer() [1/3]

override void BaseBuildingBase::OnPartDismantledServer ( notnull Man player,
string part_name,
int action_id )
inlineprotected

Definition at line 293 of file Fence.c.

294 {
296
297 //check gate state
298 if (constrution_part.IsGate())
299 {
300 if (IsLocked())
301 {
303 combination_lock.UnlockServer(player, this);
304 }
305 }
306
307 super.OnPartDismantledServer(player, part_name, action_id);
308
310
311 //update visuals (server)
313 }

References CheckGateState(), GetConstruction(), IsLocked(), SetGateState(), and UpdateVisuals().

◆ OnPartDismantledServer() [2/3]

override void BaseBuildingBase::OnPartDismantledServer ( notnull Man player,
string part_name,
int action_id )
inlineprotected

Definition at line 233 of file Totem.c.

234 {
236
237 super.OnPartDismantledServer(player, part_name, action_id);
238
239 //update visuals (server)
241 }

References GetConstruction(), and UpdateVisuals().

◆ OnPartDismantledServer() [3/3]

override void BaseBuildingBase::OnPartDismantledServer ( notnull Man player,
string part_name,
int action_id )
inlineprivate

Definition at line 363 of file Watchtower.c.

364 {
365 super.OnPartDismantledServer(player, part_name, action_id);
366 //update visuals (server)
368 }

References UpdateVisuals().

◆ OnStoreLoad() [1/2]

override bool BaseBuildingBase::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 212 of file Fence.c.

213 {
214 if (!super.OnStoreLoad(ctx, version))
215 return false;
216
217 //--- Fence data ---
218 //has gate
219 if (version < 110)
220 {
221 if (!ctx.Read(m_ToDiscard))
222 {
223 m_ToDiscard = false;
224 return false;
225 }
227 }
228 else if (!ctx.Read(m_GateState))
229 {
231 return false;
232 }
233
234 //is opened
235 if (!ctx.Read(m_IsOpened))
236 {
237 m_IsOpened = false;
238 return false;
239 }
240
241 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreLoad - build=" + m_GateState + " opened=" + m_IsOpened);
242 //---
243
244 return true;
245 }
bool m_ToDiscard
Definition Fence.c:28

References bsbDebugPrint(), GATE_STATE_NONE, LogManager::IsBaseBuildingLogEnable(), and m_IsOpened.

◆ OnStoreLoad() [2/2]

override bool BaseBuildingBase::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 105 of file Totem.c.

106 {
107 if (!super.OnStoreLoad(ctx, version))
108 return false;
109
110 //int loaded_frequency;
112
113 if (!ctx.Read(m_RefresherTimeRemaining))
114 return false;
115
116 if (!ctx.Read(m_RefreshTimeCounter))
117 return false;
118
119 if (!ctx.Read(loaded_max_duration))
120 return false;
121
122 if (version >= 118 && !ctx.Read(m_RefresherActive))
123 return false;
124
127
128 return true;
129 }
void CheckLoadedVariables(int max_duration)
Definition Totem.c:517

References AnimateFlag(), CheckLoadedVariables(), and GetRefresherTime01().

◆ OnStoreSave() [1/2]

override void BaseBuildingBase::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 202 of file Fence.c.

203 {
204 super.OnStoreSave(ctx);
205
206 //write
207 ctx.Write(m_GateState);
208 ctx.Write(m_IsOpened);
209 if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] OnStoreSave - build=" + m_GateState + " opened=" + m_IsOpened);
210 }

References bsbDebugPrint(), LogManager::IsBaseBuildingLogEnable(), and m_IsOpened.

◆ OnStoreSave() [2/2]

override void BaseBuildingBase::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 95 of file Totem.c.

96 {
97 super.OnStoreSave(ctx);
98
102 ctx.Write(m_RefresherActive);
103 }

◆ OnVariablesSynchronized() [1/2]

override void BaseBuildingBase::OnVariablesSynchronized ( )
inlineprotected

Definition at line 264 of file Fence.c.

265 {
266 super.OnVariablesSynchronized();
267
269 {
271
273 OpenFence();
274 else
275 CloseFence();
276 }
277 }
bool m_IsOpenedClient
Definition Fence.c:30

References CloseFence(), m_IsOpened, m_IsOpened, and OpenFence().

◆ OnVariablesSynchronized() [2/2]

override void BaseBuildingBase::OnVariablesSynchronized ( )
inlineprotected

Definition at line 210 of file Totem.c.

211 {
212 super.OnVariablesSynchronized();
213
215 {
218 }
219 }
void HandleRefreshers()
Client-side, saves positions of active lifetime refreshers to MissionGameplay.
Definition Totem.c:163
bool m_RefresherActiveLocal
Definition Totem.c:7

References HandleRefreshers(), and m_RefresherActive.

◆ OpenFence()

void BaseBuildingBase::OpenFence ( )
inlineprotected

Definition at line 419 of file Fence.c.

420 {
421 //server or single player
422 if (GetGame().IsServer())
423 {
425 SetAnimationPhase("Wall_Interact_Rotate", value);
426 SetAnimationPhase("Wall_Barbedwire_1_Mounted_Rotate", value);
427 SetAnimationPhase("Wall_Barbedwire_2_Mounted_Rotate", value);
428 SetAnimationPhase("Wall_Camonet_Rotate", value);
429 SetAnimationPhase("Wall_Gate_Rotate", value);
430 SetAnimationPhase("Wall_Base_Down_Rotate", value);
431 SetAnimationPhase("Wall_Base_Up_Rotate", value);
432 SetAnimationPhase("Wall_Wood_Down_Rotate", value);
433 SetAnimationPhase("Wall_Wood_Up_Rotate", value);
434 SetAnimationPhase("Wall_Metal_Down_Rotate", value);
435 SetAnimationPhase("Wall_Metal_Up_Rotate", value);
436
437 SetOpenedState(true);
438
439 //regenerate navmesh
441
442 //synchronize
444 }
445
446 //client or single player
447 if (!GetGame().IsDedicatedServer())
448 {
449 //play sound
451 }
452
453 //remove BarbedWire AreaDamageTrigger
455
456 //add check
457 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(CheckFenceClosed);
458 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckFenceOpened, 0, true);
459 }
void SoundGateOpenStart()
Definition Fence.c:678

References CALL_CATEGORY_GAMEPLAY, GATE_ROTATION_ANGLE_DEG, GetGame(), SetOpenedState(), SoundGateOpenStart(), SynchronizeBaseState(), UpdateBarbedWireAreaDamagePos(), and UpdateNavmesh().

Referenced by AfterStoreLoad(), and OnVariablesSynchronized().

◆ PerformRoofCheckForBase()

override bool BaseBuildingBase::PerformRoofCheckForBase ( string partName,
PlayerBase player,
out bool result )
inlineprivate

Definition at line 133 of file Watchtower.c.

134 {
136 return false;
137
138 if (partName != "level_1_base" && partName != "level_2_base" && partName != "level_3_base" && partName != "level_3_roof")
139 return false;
140
144 vector min_max[2];
147
148 excluded_objects.Insert(this);
149 excluded_objects.Insert(player);
150
151 if (partName == "level_2_base")
152 {
153 min_max[0] = GetMemoryPointPos("level_2_wall_1_down_min");
154 min_max[1] = GetMemoryPointPos("level_2_roof_max");
155 }
156 else if (partName == "level_3_base")
157 {
158 min_max[0] = GetMemoryPointPos("level_3_wall_1_down_min");
159 min_max[1] = GetMemoryPointPos("level_3_wall_2_up_max");
160 }
161 else if (partName == "level_3_roof")
162 {
163 min_max[0] = GetMemoryPointPos("level_3_roof_min");
164 min_max[1] = GetMemoryPointPos("level_3_roof_max");
165 }
166 else
167 {
168 //min_max[0] = GetMemoryPointPos( "level_1_wall_1_up_min" );
169 //min_max[0] = GetMemoryPointPos( "level_1_wall_1_down_min" );
170 min_max[0] = GetMemoryPointPos("level_1_collisioncheck_min");
171 min_max[1] = GetMemoryPointPos("level_1_roof_max");
172 }
174 center[1] = center[1] + (min_max[1][1] + min_max[0][1]) / 2;
175
176 edge_length[0] = min_max[1][0] - min_max[0][0];
177 edge_length[2] = min_max[1][2] - min_max[0][2];
178 edge_length[1] = min_max[1][1] - min_max[0][1];
179
180 result = false;
182 if (collided_objects.Count() > 0)
183 {
184 foreach (Object o : collided_objects)
185 {
186 if (Building.Cast(o))
187 result = true;
188 }
189 }
190 return true;
191 }
vector GetOrientation()
static bool GetDisablePerformRoofCheck()

References CfgGameplayHandler::GetDisablePerformRoofCheck(), GetGame(), GetOrientation(), and GetPosition.

◆ PostAreaDamageActions()

override void BaseBuildingBase::PostAreaDamageActions ( )
inlineprotected

Definition at line 565 of file Fence.c.

566 {
567 /*if (GetBarbedWire1())
568 {
569 //DecreaseHealth("Wall_BarbedWire_1", "", 1000); //why no dmg to wire???
570 //BarbedWire wire = GetBarbedWire1();
571 //wire.PostAreaDamageActions();
572 //Print(GetHealth("BarbedWire1", ""));
573 }*/
574 }

◆ RemoveRefresherPosition()

void BaseBuildingBase::RemoveRefresherPosition ( int idx = -2)
inlineprotected

Definition at line 194 of file Totem.c.

195 {
196 if (!GetGame() || (GetGame().IsMultiplayer() && GetGame().IsServer()))
197 return;
198
199 Mission mission = GetGame().GetMission();
201 return;
202
203 if (idx == -2)
205
206 if (idx > -1)
208 }

References GetGame(), GetPosition, Mission::m_ActiveRefresherLocations, and mission.

Referenced by HandleRefreshers(), and ~TerritoryFlag().

◆ SetActions() [1/4]

override void BaseBuildingBase::SetActions ( )
inlineprotected

Definition at line 763 of file Fence.c.

764 {
765 super.SetActions();
766
770 //AddAction(ActionDialCombinationLockOnTarget);
771 //AddAction(ActionNextCombinationLockDialOnTarget);
774 }
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
void AddAction(typename actionName)

References ActionFoldBaseBuildingObject(), and AddAction().

◆ SetActions() [2/4]

override void BaseBuildingBase::SetActions ( )
inlineprivate

◆ SetActions() [3/4]

override void BaseBuildingBase::SetActions ( )
inlineprotected

◆ SetActions() [4/4]

override void BaseBuildingBase::SetActions ( )
inlineprivate

Definition at line 497 of file Watchtower.c.

References ActionFoldBaseBuildingObject(), and AddAction().

◆ SetGateState()

void BaseBuildingBase::SetGateState ( int state)
inlineprotected

Definition at line 66 of file Fence.c.

67 {
69 SetSynchDirty();
70 }

Referenced by AfterStoreLoad(), OnPartBuiltServer(), OnPartDestroyedServer(), and OnPartDismantledServer().

◆ SetOpenedState()

void BaseBuildingBase::SetOpenedState ( bool state)
inlineprotected

Definition at line 101 of file Fence.c.

102 {
104 }

References m_IsOpened.

Referenced by CloseFence(), and OpenFence().

◆ SetRefresherActive()

void BaseBuildingBase::SetRefresherActive ( bool state)
inlineprotected

Definition at line 176 of file Totem.c.

177 {
179 {
181 SetSynchDirty();
182
183 //update on refresher activation / last update on refresher deactivation
184 GetCEApi().RadiusLifetimeReset(GetPosition(), GameConstants.REFRESHER_RADIUS); //TODO spammable!!!
185 }
186 }

References GetCEApi(), GetPosition, and GameConstants::REFRESHER_RADIUS.

Referenced by AddRefresherTime01(), and OnCEUpdate().

◆ SetRefreshTimer01()

void BaseBuildingBase::SetRefreshTimer01 ( float fraction)
inlineprotected

Definition at line 491 of file Totem.c.

References Math::Clamp(), and Math::Round().

◆ ShelterSite()

void BaseBuildingBase::ShelterSite ( )
inlineprivate

Definition at line 6 of file ShelterSite.c.

7 {
8 }

◆ SoundGateCloseEnd()

void BaseBuildingBase::SoundGateCloseEnd ( )
inlineprotected

Definition at line 692 of file Fence.c.

693 {
694 //client or single player
695 if (!GetGame().IsDedicatedServer())
696 PlaySoundSet(m_SoundGate_End, SOUND_GATE_CLOSE_END, 0.1, 0.1);
697 }
const string SOUND_GATE_CLOSE_END
Definition Fence.c:10
EffectSound m_SoundGate_End
Definition Fence.c:34

References GetGame().

Referenced by CheckFenceClosed().

◆ SoundGateCloseStart()

void BaseBuildingBase::SoundGateCloseStart ( )
inlineprotected

Definition at line 685 of file Fence.c.

686 {
687 //client or single player
688 if (!GetGame().IsDedicatedServer())
689 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_CLOSE_START, 0.1, 0.1);
690 }
EffectSound m_SoundGate_Start
Definition Fence.c:33
const string SOUND_GATE_CLOSE_START
Definition Fence.c:9

References GetGame().

Referenced by CloseFence().

◆ SoundGateOpenStart()

void BaseBuildingBase::SoundGateOpenStart ( )
inlineprotected

Definition at line 678 of file Fence.c.

679 {
680 //client or single player
681 if (!GetGame().IsDedicatedServer())
682 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_OPEN_START, 0.1, 0.1);
683 }
const string SOUND_GATE_OPEN_START
Definition Fence.c:8

References GetGame().

Referenced by OpenFence().

◆ TerritoryFlag()

void BaseBuildingBase::TerritoryFlag ( )
inlineprotected

Definition at line 15 of file Totem.c.

16 {
17 m_RefresherActive = false;
21
22 if (GetCEApi())
24 RegisterNetSyncVariableBool("m_RefresherActive");
25 }

References GetCEApi(), and InitRefresherData().

◆ TranslateSlotFromSelection()

override bool BaseBuildingBase::TranslateSlotFromSelection ( string selection_name,
out int slot_id )
inlineprotected

Definition at line 753 of file Fence.c.

754 {
755 if (selection_name == "wall_camonet_attach")
756 {
758 return true;
759 }
760 return false;
761 }

References InventorySlots::GetSlotIdFromString().

◆ UpdateBarbedWireAreaDamagePos()

void BaseBuildingBase::UpdateBarbedWireAreaDamagePos ( float rotation_angle = 0,
bool to_delete = false )
inlineprotected

Definition at line 539 of file Fence.c.

540 {
541 int slot_id;
542 string slot_name;
543 string slot_name_mounted;
544 if (GetBarbedWire1() && GetBarbedWire1().IsMounted())
545 {
546 GetBarbedWire1().GetInventory().GetCurrentAttachmentSlotInfo(slot_id, slot_name);
547 slot_name_mounted = slot_name + "_Mounted";
548 if (to_delete)
550 else
551 super.CreateAreaDamage(slot_name_mounted, rotation_angle);
552 }
553 if (GetBarbedWire2() && GetBarbedWire2().IsMounted())
554 {
555 GetBarbedWire2().GetInventory().GetCurrentAttachmentSlotInfo(slot_id, slot_name);
556 slot_name_mounted = slot_name + "_Mounted";
557 if (to_delete)
559 else
560 super.CreateAreaDamage(slot_name_mounted, rotation_angle);
561 }
562 }
void DestroyAreaDamage()

References DestroyAreaDamage(), GetBarbedWire1(), and GetBarbedWire2().

Referenced by CheckFenceClosed(), CheckFenceOpened(), CloseFence(), and OpenFence().

◆ UpdateVisuals()

override void BaseBuildingBase::UpdateVisuals ( )
inlineprivate

Definition at line 44 of file Watchtower.c.

45 {
46 super.UpdateVisuals();
47
48 SetAnimationPhase("level_1", 0); //always visible
49 SetAnimationPhase("level_1_wall_1", 0); //always visible
50 SetAnimationPhase("level_1_wall_2", 0); //always visible
51 SetAnimationPhase("level_1_wall_3", 0); //always visible
52
53 string part_name = "";
54 bool built = false;
55
56 for (int i = 1; i < MAX_WATCHTOWER_FLOORS; ++i)
57 {
58 //roof checks
60 built = GetConstruction().IsPartConstructed(part_name);
61 //Print(part_name);
62 //Print(built);
63
64 //string tmp = "";
65
66 if (built)
67 {
68 SetAnimationPhase(BASE_VIEW_NAME + (i + 1), 0); //show
69 for (int j = 1; j < MAX_WATCHTOWER_WALLS + 1; ++j)
70 {
71 //tmp = BASE_VIEW_NAME + (i + 1) + BASE_WALL_NAME + j;
72 //Print(tmp);
73 SetAnimationPhase(BASE_VIEW_NAME + (i + 1) + BASE_WALL_NAME + j, 0); //show
74 }
75 }
76 else
77 {
78 SetAnimationPhase(BASE_VIEW_NAME + (i + 1), 1); //hide
79 for (j = 1; j < MAX_WATCHTOWER_WALLS + 1; ++j)
80 {
81 //tmp = BASE_VIEW_NAME + (i + 1) + BASE_WALL_NAME + j;
82 //Print(tmp);
83 SetAnimationPhase(BASE_VIEW_NAME + (i + 1) + BASE_WALL_NAME + j, 1); //hide
84 }
85 }
86 }
87 }
static const string BASE_WALL_NAME
Definition Watchtower.c:12
static const string BASE_VIEW_NAME
Definition Watchtower.c:11
static const string BASE_ROOF_NAME
Definition Watchtower.c:13

References BASE_ROOF_NAME, GetConstruction(), and MAX_WATCHTOWER_FLOORS.

Referenced by AfterStoreLoad(), ItemBase::EEItemAttached(), ItemBase::EEItemDetached(), ItemBase::OnPartBuiltServer(), OnPartBuiltServer(), ItemBase::OnPartDestroyedServer(), OnPartDestroyedServer(), ItemBase::OnPartDismantledServer(), OnPartDismantledServer(), and ItemBase::OnSynchronizedClient().

◆ Watchtower()

void BaseBuildingBase::Watchtower ( )
inlineprivate

Definition at line 17 of file Watchtower.c.

18 {
19 }

Member Data Documentation

◆ ATTACHMENT_BARBED_WIRE

BaseBuildingBase::ATTACHMENT_BARBED_WIRE = BarbedWire
private

Definition at line 3 of file Watchtower.c.

◆ ATTACHMENT_CAMONET

BaseBuildingBase::ATTACHMENT_CAMONET = CamoNet
private

Definition at line 4 of file Watchtower.c.

◆ ATTACHMENT_COMBINATION_LOCK

BaseBuildingBase::ATTACHMENT_COMBINATION_LOCK = CombinationLock
private

Definition at line 20 of file Fence.c.

◆ ATTACHMENT_SLOT_COMBINATION_LOCK

const string BaseBuildingBase::ATTACHMENT_SLOT_COMBINATION_LOCK = "Att_CombinationLock"
private

Definition at line 7 of file Fence.c.

◆ ATTACHMENT_WOODEN_LOG

BaseBuildingBase::ATTACHMENT_WOODEN_LOG = WoodenLog
private

Definition at line 19 of file Fence.c.

◆ ATTSLOT_BARBEDWIRE_DOWN

string BaseBuildingBase::ATTSLOT_BARBEDWIRE_DOWN = "Wall_Barbedwire_1"
private

Definition at line 23 of file Fence.c.

◆ ATTSLOT_BARBEDWIRE_UP

string BaseBuildingBase::ATTSLOT_BARBEDWIRE_UP = "Wall_Barbedwire_2"
private

Definition at line 24 of file Fence.c.

◆ ATTSLOT_CAMONET

string BaseBuildingBase::ATTSLOT_CAMONET = "Wall_Camonet"
private

Definition at line 22 of file Fence.c.

◆ BASE_ROOF_NAME

const string BaseBuildingBase::BASE_ROOF_NAME = "_roof"
staticprivate

Definition at line 13 of file Watchtower.c.

Referenced by UpdateVisuals().

◆ BASE_VIEW_NAME

const string BaseBuildingBase::BASE_VIEW_NAME = "level_"
staticprivate

Definition at line 11 of file Watchtower.c.

◆ BASE_WALL_NAME

const string BaseBuildingBase::BASE_WALL_NAME = "_wall_"
staticprivate

Definition at line 12 of file Watchtower.c.

◆ GATE_ROTATION_ANGLE_DEG

const float BaseBuildingBase::GATE_ROTATION_ANGLE_DEG = 100
private

Definition at line 13 of file Fence.c.

Referenced by OpenFence().

◆ GATE_ROTATION_TIME_APPROX

const float BaseBuildingBase::GATE_ROTATION_TIME_APPROX = 2000
private

Definition at line 14 of file Fence.c.

◆ GATE_STATE_FULL

const int BaseBuildingBase::GATE_STATE_FULL = 2
private

Definition at line 5 of file Fence.c.

Referenced by CheckGateState(), and HasFullyConstructedGate().

◆ GATE_STATE_NONE

const int BaseBuildingBase::GATE_STATE_NONE = 0
private

Definition at line 3 of file Fence.c.

Referenced by CheckGateState(), HasHinges(), and OnStoreLoad().

◆ GATE_STATE_PARTIAL

const int BaseBuildingBase::GATE_STATE_PARTIAL = 1
private

Definition at line 4 of file Fence.c.

Referenced by CheckGateState().

◆ m_FlagRefresherFrequency

int BaseBuildingBase::m_FlagRefresherFrequency = GameConstants.REFRESHER_FREQUENCY_DEFAULT
protected

Definition at line 12 of file Totem.c.

◆ m_FlagRefresherMaxDuration

int BaseBuildingBase::m_FlagRefresherMaxDuration = GameConstants.REFRESHER_MAX_DURATION_DEFAULT
protected

Definition at line 13 of file Totem.c.

Referenced by GetRefresherTime01().

◆ m_GateState

int BaseBuildingBase::m_GateState = 0
protected

Definition at line 31 of file Fence.c.

Referenced by GetGateState().

◆ m_IsOpened

bool BaseBuildingBase::m_IsOpened = false
protected

Definition at line 29 of file Fence.c.

Referenced by IsOpened(), and OnVariablesSynchronized().

◆ m_IsOpenedClient

bool BaseBuildingBase::m_IsOpenedClient = false
protected

Definition at line 30 of file Fence.c.

◆ m_RefresherActive

bool BaseBuildingBase::m_RefresherActive
private

Definition at line 6 of file Totem.c.

Referenced by OnVariablesSynchronized().

◆ m_RefresherActiveLocal

bool BaseBuildingBase::m_RefresherActiveLocal
private

Definition at line 7 of file Totem.c.

◆ m_RefresherInitialized

bool BaseBuildingBase::m_RefresherInitialized
private

Definition at line 8 of file Totem.c.

◆ m_RefresherTimeRemaining

int BaseBuildingBase::m_RefresherTimeRemaining
private

Definition at line 9 of file Totem.c.

◆ m_RefreshTimeCounter

int BaseBuildingBase::m_RefreshTimeCounter
private

Definition at line 10 of file Totem.c.

◆ m_SoundGate_End

EffectSound BaseBuildingBase::m_SoundGate_End
protected

Definition at line 34 of file Fence.c.

◆ m_SoundGate_Start

EffectSound BaseBuildingBase::m_SoundGate_Start
protected

Definition at line 33 of file Fence.c.

◆ m_ToDiscard

bool BaseBuildingBase::m_ToDiscard = false
protected

Definition at line 28 of file Fence.c.

◆ MAX_ACTION_DETECTION_ANGLE_RAD

const float BaseBuildingBase::MAX_ACTION_DETECTION_ANGLE_RAD = 1.3
private

Definition at line 16 of file Fence.c.

◆ MAX_ACTION_DETECTION_DISTANCE

const float BaseBuildingBase::MAX_ACTION_DETECTION_DISTANCE = 2.0
private

Definition at line 17 of file Fence.c.

◆ MAX_FLOOR_VERTICAL_DISTANCE

const float BaseBuildingBase::MAX_FLOOR_VERTICAL_DISTANCE = 0.5
private

Definition at line 6 of file Watchtower.c.

◆ MAX_WATCHTOWER_FLOORS

const int BaseBuildingBase::MAX_WATCHTOWER_FLOORS = 3
staticprivate

Definition at line 14 of file Watchtower.c.

Referenced by UpdateVisuals().

◆ MAX_WATCHTOWER_WALLS

const int BaseBuildingBase::MAX_WATCHTOWER_WALLS = 3
staticprivate

Definition at line 15 of file Watchtower.c.

Referenced by OnDebugSpawn().

◆ MIN_ACTION_DETECTION_ANGLE_RAD

const float BaseBuildingBase::MIN_ACTION_DETECTION_ANGLE_RAD = 0.35
private

Definition at line 8 of file Watchtower.c.

◆ SOUND_GATE_CLOSE_END

const string BaseBuildingBase::SOUND_GATE_CLOSE_END = "DoorWoodTowerClose_end_SoundSet"
private

Definition at line 10 of file Fence.c.

◆ SOUND_GATE_CLOSE_START

const string BaseBuildingBase::SOUND_GATE_CLOSE_START = "DoorWoodTowerClose_start_SoundSet"
private

Definition at line 9 of file Fence.c.

◆ SOUND_GATE_OPEN_START

const string BaseBuildingBase::SOUND_GATE_OPEN_START = "DoorWoodTowerOpen_SoundSet"
private

Definition at line 8 of file Fence.c.


The documentation for this class was generated from the following files: