3 const int OPENING_0 = 1;
4 const int OPENING_1 = 2;
5 const int OPENING_2 = 4;
6 const int OPENING_3 = 8;
7 const int OPENING_4 = 16;
8 const int OPENING_5 = 32;
9 const int OPENING_6 = 64;
10 const int OPENING_7 = 128;
11 const int OPENING_8 = 256;
12 const int OPENING_9 = 512;
13 const int OPENING_10 = 1024;
14 const int OPENING_11 = 2048;
15 const int OPENING_12 = 4096;
16 const int OPENING_13 = 8192;
17 const int OPENING_14 = 16384;
18 const int OPENING_15 = 32768;
20 static const int PACKED = 0;
21 static const int PITCHED = 1;
22 const float MAX_PLACEMENT_HEIGHT_DIFF = 1.5;
25 protected int m_StateLocal = -1;
29 protected bool m_IsBeingPacked =
false;
31 protected int m_OpeningMaskLocal = -1;
47 RegisterNetSyncVariableInt(
"m_State");
48 RegisterNetSyncVariableBool(
"m_IsEntrance");
49 RegisterNetSyncVariableBool(
"m_IsWindow");
50 RegisterNetSyncVariableBool(
"m_IsToggle");
51 RegisterNetSyncVariableInt(
"m_OpeningMask");
52 RegisterNetSyncVariableBool(
"m_IsBeingPacked");
61 DestroyClutterCutter();
67 return "disableContainerDamage";
98 super.OnStoreSave(ctx);
106 if (!super.OnStoreLoad(ctx, version))
113 Print(
"ERROR: no opening mask found! Default openinng settings initialized.");
128 RefreshAttachements();
141 super.RefreshPhysics();
145 TryPitch(
false,
true);
155 super.OnItemLocationChanged(old_owner, new_owner);
157 if (new_owner || old_owner)
159 if (GetInventory().CountInventory() == 1)
166 super.OnVariablesSynchronized();
180 HandleOpeningsPhysics();
192 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
197 if (zone ==
"" && GetState() == PITCHED && newLevel ==
GameConstants.STATE_RUINED &&
GetGame().IsServer())
198 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(
this,
m_HalfExtents);
200 if (zone !=
"Body" && zone !=
"Inventory" && zone !=
"")
205 DamageSystem.GetComponentNamesFromDamageZone(
this,zone,selections);
206 for (
int j = 0; j < selections.Count(); j++)
208 if (selections.Get(j) !=
"")
210 RemoveProxyPhysics(selections.Get(j));
212 AnimateCamonetByOpeningSelection(selections.Get(j));
218 if (GetState() == PITCHED)
228 string cfg_path =
"cfgVehicles " +
GetType() +
" AnimationSources";
230 if (
GetGame().ConfigIsExisting(cfg_path))
232 int selections =
GetGame().ConfigGetChildrenCount(cfg_path);
233 string proxy_selection_name;
235 for (
int i = 0; i < selections; i++)
237 string selection_name;
238 GetGame().ConfigGetChildName(cfg_path, i, selection_name);
241 SetAnimationPhase(selection_name, 1);
244 proxy_selection_name = selection_name;
245 proxy_selection_name.ToLower();
248 RemoveProxyPhysics(proxy_selection_name);
256 return CanBeManipulated();
261 if (!super.IsTakeable())
264 return CanBeManipulated();
269 if (!super.CanPutIntoHands(parent))
274 return CanBeManipulated();
279 if (!super.CanPutInCargo(parent))
284 return CanBeManipulated();
289 if (!super.CanRemoveFromCargo(parent))
292 return CanBeManipulated();
297 if (!super.CanRemoveFromHands(parent))
300 return CanBeManipulated();
305 return CanBeManipulated();
320 m_CamoNet = CamoNet.Cast(GetInventory().FindAttachment(slot_id_camo));
323 eai_xlights = GetInventory().FindAttachment(slot_id_xlights);
327 HandleCamoNetAttachment(
false);
330 if (!IsKindOf(
"MediumTent"))
332 AddProxyPhysics(
"camonet");
338 SetAnimationPhase(
"Xlights", 0);
339 SetAnimationPhase(
"Xlights_glass_r", 0);
340 SetAnimationPhase(
"Xlights_glass_g", 0);
341 SetAnimationPhase(
"Xlights_glass_b", 0);
342 SetAnimationPhase(
"Xlights_glass_y", 0);
348 super.EEItemAttached(item, slot_name);
350 if (item.IsKindOf (
"CamoNet"))
352 m_CamoNet = CamoNet.Cast(item);
353 HandleCamoNetAttachment(
false);
356 if (!IsKindOf (
"MediumTent"))
358 AddProxyPhysics(
"camonet");
362 if (item.IsKindOf (
"XmasLights"))
364 SetAnimationPhase(
"Xlights", 0);
365 SetAnimationPhase(
"Xlights_glass_r", 0);
366 SetAnimationPhase(
"Xlights_glass_g", 0);
367 SetAnimationPhase(
"Xlights_glass_b", 0);
368 SetAnimationPhase(
"Xlights_glass_y", 0);
370 XmasLights xlights = XmasLights.Cast(item);
371 xlights.AttachToObject(
this);
377 super.EEItemDetached(item, slot_name);
379 if (item.IsKindOf (
"CamoNet"))
382 HandleCamoNetAttachment(
true);
385 if (!IsKindOf (
"MediumTent"))
387 RemoveProxyPhysics(
"camonet");
391 if (item.IsKindOf (
"XmasLights"))
393 SetAnimationPhase(
"Xlights", 1);
394 SetAnimationPhase(
"Xlights_glass_r", 1);
395 SetAnimationPhase(
"Xlights_glass_g", 1);
396 SetAnimationPhase(
"Xlights_glass_b", 1);
397 SetAnimationPhase(
"Xlights_glass_y", 1);
399 XmasLights xlights = XmasLights.Cast(item);
400 xlights.DetachFromObject(
this);
406 if (MemoryPointExists(
"invView2"))
409 GetInventory().GetCurrentInventoryLocation(il);
412 if (GetState() == PACKED)
450 if (GetState() == PITCHED)
452 if (GetInventory().GetCargo().GetItemCount() == 0 && GetInventory().AttachmentCount() == 0)
463 if (GetState() == PACKED)
475 if (item.IsKindOf (
"CamoNet") && GetState() == PITCHED)
490 HideAllAnimationsAndProxyPhysics();
493 m_IsEntrance = PACKED;
499 GetInventory().LockInventory(HIDE_INV_FROM_SCRIPT);
506 DestroyClutterCutter();
508 if (
GetGame().IsServer() && !IsHologram())
509 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(
this,
m_HalfExtents);
515 GetOnViewIndexChanged().Invoke();
521 HideAllAnimationsAndProxyPhysics();
524 m_IsEntrance = PITCHED;
525 m_IsWindow = PITCHED;
526 m_IsToggle = PITCHED;
530 GetInventory().UnlockInventory(HIDE_INV_FROM_SCRIPT);
541 GetOnViewIndexChanged().Invoke();
547 if (GetHierarchyRootPlayer())
549 if (
GetGame().IsDedicatedServer())
551 Pack(update_navmesh,
init);
557 Pitch(update_navmesh,
init);
562 string proxy_selection_name;
563 string animation_name;
565 if (GetState() == PITCHED)
567 for (
int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
569 animation_name = m_ShowAnimationsWhenPitched.Get(i);
571 SetAnimationPhase(animation_name, 0);
574 HandleOpeningsVisuals();
578 for (
int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
580 animation_name = m_ShowAnimationsWhenPacked.Get(j);
582 SetAnimationPhase(animation_name, 0);
589 string proxy_selection_name;
590 string animation_name;
592 if (GetState() == PITCHED)
594 for (
int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
596 animation_name = m_ShowAnimationsWhenPitched.Get(i);
598 proxy_selection_name = animation_name;
599 proxy_selection_name.ToLower();
600 AddProxyPhysics(proxy_selection_name);
607 for (
int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
609 animation_name = m_ShowAnimationsWhenPacked.Get(j);
611 proxy_selection_name = animation_name;
612 proxy_selection_name.ToLower();
613 AddProxyPhysics(proxy_selection_name);
627 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
631 toggle_off.ToLower();
635 if (toggle_off == selection || toggle_on == selection)
638 DamageSystem.GetDamageZoneFromComponentName(
this,selection,zone);
648 m_IsEntrance =
false;
684 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
689 toggle_off.ToLower();
693 if (toggle_off == selection || toggle_on == selection)
702 m_ToggleAnimations.Set(toggle,
false);
706 if (selection.Contains(
"window"))
709 if (GetSoundOpenWindow() !=
string.
Empty)
713 if (selection.Contains(
"entrance") || selection.Contains(
"door"))
715 ManipulateEntrance();
716 if (GetSoundOpen() !=
string.
Empty)
720 AnimateCamonetToggle(toggle);
728 m_ToggleAnimations.Set(toggle,
true);
732 if (selection.Contains(
"window"))
735 if (GetSoundCloseWindow() !=
string.
Empty)
739 if (selection.Contains(
"entrance") || selection.Contains(
"door"))
741 ManipulateEntrance();
742 if (GetSoundClose() !=
string.
Empty)
746 AnimateCamonetToggle(toggle);
755 SetAnimationPhase(
"CamoNet", hide);
772 SetAffectPathgraph(
true,
false);
802 super.OnPlacementComplete(player, position, orientation);
812 super.InitItemSounds();
816 if (GetSoundOpen() !=
string.
Empty)
817 handler.AddSound(SoundConstants.ITEM_TENT_OPEN, GetSoundOpen());
819 if (GetSoundClose() !=
string.
Empty)
820 handler.AddSound(SoundConstants.ITEM_TENT_CLOSE, GetSoundClose());
822 if (GetSoundOpenWindow() !=
string.
Empty)
823 handler.AddSound(SoundConstants.ITEM_TENT_WINDOW_OPEN, GetSoundOpenWindow());
825 if (GetSoundCloseWindow() !=
string.
Empty)
826 handler.AddSound(SoundConstants.ITEM_TENT_WINDOW_CLOSE, GetSoundCloseWindow());
847 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
849 toggle = m_ToggleAnimations.GetKey(i);
853 DamageSystem.GetDamageZoneFromComponentName(
this,
component,zone);
860 m_ToggleAnimations.Set(toggle,
false);
866 m_ToggleAnimations.Set(toggle,
true);
881 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
883 toggle = m_ToggleAnimations.GetKey(i);
887 DamageSystem.GetDamageZoneFromComponentName(
this,
component,zone);
888 is_ruined = (GetHealthLevel(zone) ==
GameConstants.STATE_RUINED);
894 if (!is_ruined && GetState() == PITCHED)
915 if (GetHealthLevel() ==
GameConstants.STATE_RUINED || m_IsBeingPacked)
918 return super.CanReceiveItemIntoCargo(item);
923 if (!super.CanLoadItemIntoCargo(item))
936 return super.CanReceiveAttachment(attachment, slotId);
944 return super.CanLoadAttachment(attachment);
949 vector playerpos = player.GetPosition();
950 float delta1 = playerpos[1] - position[1];
952 if (delta1 > MAX_PLACEMENT_HEIGHT_DIFF || delta1 < -MAX_PLACEMENT_HEIGHT_DIFF)
959 m_IsBeingPacked = isBeingPacked;
eBleedingSourceType GetType()
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
void AddAction(typename actionName)
override string GetInvulnerabilityTypeString()
const int ECE_PLACE_ON_SURFACE
Wrapper class for managing sound through SEffectManager.
provides access to slot configuration
override int GetMeleeTargetType()
override void EEItemAttached(EntityAI item, string slot_name)
bool CanToggleAnimations(string selection)
bool IsManipulatedWindow()
bool CanAttach(ItemBase item)
void HandleOpeningsPhysics()
void SoundTentClosePlay()
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
void HandleOpeningsVisuals()
bool IsManipulatedEntrance()
void SoundTentOpenPlay()
DEPRECATED.
override int GetViewIndex()
override bool CanProxyObstructSelf()
prevents showing cargo when outside the tent geometry
override bool HasProxyParts()
override bool CanBeRepairedByCrafting()
bool ConditionOutOfHands(EntityAI player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
string GetSoundCloseWindow()
override bool CanPutIntoHands(EntityAI parent)
void PlayDeployLoopSound()
override bool IsItemTent()
override void SetActions()
void HideAllAnimationsAndProxyPhysics(bool hide_animations=true, bool hide_physics=true)
override string GetInvulnerabilityTypeString()
override bool CanLoadAttachment(EntityAI attachment)
string GetClutterCutter()
override int GetDamageSystemVersionChange()
ref array< string > m_ShowAnimationsWhenPacked
string GetSoundOpenWindow()
override bool CanRemoveFromHands(EntityAI parent)
void Pack(bool update_navmesh, bool init=false)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
void Pitch(bool update_navmesh, bool init=false)
void SoundTentOpenWindowPlay()
override bool CanLoadItemIntoCargo(EntityAI item)
void ManipulateEntrance()
void HandleCamoNetAttachment(bool hide)
override void EEItemDetached(EntityAI item, string slot_name)
void AnimateCamonetToggle(ToggleAnimations toggle)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanRemoveFromCargo(EntityAI parent)
void SetIsBeingPacked(bool isBeingPacked)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
void RefreshAttachements()
ref array< string > m_ShowAnimationsWhenPitched
void TryPitch(bool update_navmesh, bool init=false)
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override bool IsTakeable()
void SoundTentCloseWindowPlay()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
ref map< ref ToggleAnimations, bool > m_ToggleAnimations
void StopDeployLoopSound()
DEPRECATED.
bool ConditionIntoInventory(EntityAI player)
override bool CanBePlaced(Man player, vector position)
void AnimateCamonetByOpeningSelection(string opening_selection)
override bool CanBeRepairedToPristine()
override bool IsDeployable()
void DestroyClutterCutter()
void ToggleAnimation(string selection)
Serialization general interface. Serializer API works with:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Container_Base m_HalfExtents
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
class JsonUndergroundAreaTriggerData GetPosition
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
void StartItemSoundServer(int id)
ItemSoundHandler GetItemSoundHandler()
bool m_FixDamageSystemInit
void ItemSoundHandler(ItemBase parent)
enum MagnumStableStateID init
enum EObjectTemperatureState m_State
ref EffectSound m_DeployLoopSound
DEPRECATED.