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;
30 protected int m_OpeningMask = 0;
31 protected int m_OpeningMaskLocal = -1;
48 RegisterNetSyncVariableInt(
"m_State");
49 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
50 RegisterNetSyncVariableBool(
"m_IsEntrance");
51 RegisterNetSyncVariableBool(
"m_IsWindow");
52 RegisterNetSyncVariableBool(
"m_IsToggle");
53 RegisterNetSyncVariableBool(
"m_IsDeploySound");
54 RegisterNetSyncVariableInt(
"m_OpeningMask");
55 RegisterNetSyncVariableBool(
"m_IsBeingPacked");
64 DestroyClutterCutter();
72 return "disableContainerDamage";
97 super.OnStoreSave(ctx);
100 ctx.
Write(m_OpeningMask);
105 if (!super.OnStoreLoad(ctx, version))
111 if (!ctx.
Read(m_OpeningMask))
112 Print(
"ERROR: no opening mask found! Default openinng settings initialized.");
127 RefreshAttachements();
140 super.RefreshPhysics();
144 TryPitch(
false,
true);
154 super.OnItemLocationChanged(old_owner, new_owner);
156 if (new_owner || old_owner)
158 if (GetInventory().CountInventory() == 1)
165 super.OnVariablesSynchronized();
183 SoundTentClosePlay();
190 SoundTentOpenWindowPlay();
194 SoundTentCloseWindowPlay();
220 if ((m_OpeningMaskLocal != m_OpeningMask))
222 HandleOpeningsPhysics();
223 m_OpeningMaskLocal = m_OpeningMask;
234 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
240 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(
this,
m_HalfExtents);
242 if (zone !=
"Body" && zone !=
"Inventory" && zone !=
"")
247 DamageSystem.GetComponentNamesFromDamageZone(
this,zone,selections);
248 for (
int j = 0; j < selections.Count(); j++)
250 if (selections.Get(j) !=
"")
252 RemoveProxyPhysics(selections.Get(j));
270 string cfg_path =
"cfgVehicles " +
GetType() +
" AnimationSources";
272 if (
GetGame().ConfigIsExisting(cfg_path))
275 string proxy_selection_name;
277 for (
int i = 0; i < selections; i++)
279 string selection_name;
283 SetAnimationPhase(selection_name, 1);
286 proxy_selection_name = selection_name;
287 proxy_selection_name.
ToLower();
290 RemoveProxyPhysics(proxy_selection_name);
298 return CanBeManipulated();
303 if (!super.CanPutIntoHands(parent))
308 return CanBeManipulated();
313 if (!super.CanPutInCargo(parent))
318 return CanBeManipulated();
323 return CanBeManipulated();
338 m_CamoNet = CamoNet.Cast(GetInventory().FindAttachment(slot_id_camo));
341 eai_xlights = GetInventory().FindAttachment(slot_id_xlights);
348 if (!IsKindOf (
"MediumTent"))
350 AddProxyPhysics(
"camonet");
356 SetAnimationPhase(
"Xlights", 0);
357 SetAnimationPhase(
"Xlights_glass_r", 0);
358 SetAnimationPhase(
"Xlights_glass_g", 0);
359 SetAnimationPhase(
"Xlights_glass_b", 0);
360 SetAnimationPhase(
"Xlights_glass_y", 0);
366 super.EEItemAttached(item, slot_name);
368 if (item.IsKindOf (
"CamoNet"))
370 m_CamoNet = CamoNet.Cast(item);
374 if (!IsKindOf (
"MediumTent"))
376 AddProxyPhysics(
"camonet");
380 if (item.IsKindOf (
"XmasLights"))
382 SetAnimationPhase(
"Xlights", 0);
383 SetAnimationPhase(
"Xlights_glass_r", 0);
384 SetAnimationPhase(
"Xlights_glass_g", 0);
385 SetAnimationPhase(
"Xlights_glass_b", 0);
386 SetAnimationPhase(
"Xlights_glass_y", 0);
388 XmasLights xlights = XmasLights.Cast(item);
389 xlights.AttachToObject(
this);
395 super.EEItemDetached(item, slot_name);
397 if (item.IsKindOf (
"CamoNet"))
403 if (!IsKindOf (
"MediumTent"))
405 RemoveProxyPhysics(
"camonet");
409 if (item.IsKindOf (
"XmasLights"))
411 SetAnimationPhase(
"Xlights", 1);
412 SetAnimationPhase(
"Xlights_glass_r", 1);
413 SetAnimationPhase(
"Xlights_glass_g", 1);
414 SetAnimationPhase(
"Xlights_glass_b", 1);
415 SetAnimationPhase(
"Xlights_glass_y", 1);
417 XmasLights xlights = XmasLights.Cast(item);
418 xlights.DetachFromObject(
this);
424 if (MemoryPointExists(
"invView2"))
427 GetInventory().GetCurrentInventoryLocation(il);
508 if (GetInventory().GetCargo().GetItemCount() == 0 && GetInventory().AttachmentCount() == 0)
531 if (item.IsKindOf (
"CamoNet") &&
GetState() == PITCHED)
546 HideAllAnimationsAndProxyPhysics();
549 m_IsEntrance = PACKED;
555 GetInventory().LockInventory(HIDE_INV_FROM_SCRIPT);
562 DestroyClutterCutter();
565 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(
this,
m_HalfExtents);
571 GetOnViewIndexChanged().Invoke();
577 HideAllAnimationsAndProxyPhysics();
580 m_IsEntrance = PITCHED;
581 m_IsWindow = PITCHED;
582 m_IsToggle = PITCHED;
586 GetInventory().UnlockInventory(HIDE_INV_FROM_SCRIPT);
597 GetOnViewIndexChanged().Invoke();
603 if (GetHierarchyRootPlayer())
605 if (
GetGame().IsDedicatedServer())
607 Pack(update_navmesh,
init);
613 Pitch(update_navmesh,
init);
618 string proxy_selection_name;
619 string animation_name;
623 for (
int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
625 animation_name = m_ShowAnimationsWhenPitched.
Get(i);
627 SetAnimationPhase(animation_name, 0);
630 HandleOpeningsVisuals();
634 for (
int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
636 animation_name = m_ShowAnimationsWhenPacked.
Get(j);
638 SetAnimationPhase(animation_name, 0);
645 string proxy_selection_name;
646 string animation_name;
650 for (
int i = 0; i < m_ShowAnimationsWhenPitched.Count(); i++)
652 animation_name = m_ShowAnimationsWhenPitched.
Get(i);
654 proxy_selection_name = animation_name;
655 proxy_selection_name.
ToLower();
656 AddProxyPhysics(proxy_selection_name);
663 for (
int j = 0; j < m_ShowAnimationsWhenPacked.Count(); j++)
665 animation_name = m_ShowAnimationsWhenPacked.
Get(j);
667 proxy_selection_name = animation_name;
668 proxy_selection_name.
ToLower();
669 AddProxyPhysics(proxy_selection_name);
683 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
691 if (toggle_off == selection || toggle_on == selection)
694 DamageSystem.GetDamageZoneFromComponentName(
this,selection,zone);
704 m_IsEntrance =
false;
740 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
749 if (toggle_off == selection || toggle_on == selection)
758 m_ToggleAnimations.Set(toggle,
false);
760 m_OpeningMask &= ~toggle.GetOpeningBit();
769 ManipulateEntrance();
780 m_ToggleAnimations.Set(toggle,
true);
791 ManipulateEntrance();
804 SetAnimationPhase(
"CamoNet", hide);
845 SetAffectPathgraph(
true,
false);
875 super.OnPlacementComplete(player, position, orientation);
887 if (!
GetGame().IsDedicatedServer())
898 if (!
GetGame().IsDedicatedServer())
923 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
925 toggle = m_ToggleAnimations.GetKey(i);
929 DamageSystem.GetDamageZoneFromComponentName(
this,
component,zone);
936 m_ToggleAnimations.Set(toggle,
false);
942 m_ToggleAnimations.Set(toggle,
true);
957 for (
int i = 0; i < m_ToggleAnimations.Count(); i++)
959 toggle = m_ToggleAnimations.GetKey(i);
963 DamageSystem.GetDamageZoneFromComponentName(
this,
component,zone);
970 if (!is_ruined &&
GetState() == PITCHED)
994 return super.CanReceiveItemIntoCargo(item);
999 if (!super.CanLoadItemIntoCargo(item))
1012 return super.CanReceiveAttachment(attachment, slotId);
1020 return super.CanLoadAttachment(attachment);
1025 vector playerpos = player.GetPosition();
1026 float delta1 = playerpos[1] - position[1];
1028 if (delta1 > MAX_PLACEMENT_HEIGHT_DIFF || delta1 < -MAX_PLACEMENT_HEIGHT_DIFF)
1035 m_IsBeingPacked = isBeingPacked;
eBleedingSourceType GetType()
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
void AddAction(typename actionName)
override string GetInvulnerabilityTypeString()
const int ECE_PLACE_ON_SURFACE
Container_Base m_HalfExtents
protected Object m_ClutterCutter
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override bool IsHologram()
void SetIsDeploySound(bool is_deploy_sound)
bool CanPlayDeployLoopSound()
bool m_FixDamageSystemInit
bool IsSoundSynchRemote()
enum MagnumStableStateID init
protected float m_DrainThreshold protected bool m_State
protected ref EffectSound m_DeployLoopSound
void PlayDeployLoopSound()
void StopDeployLoopSound()
class JsonUndergroundAreaTriggerData GetPosition
proto native void ObjectDelete(Object obj)
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native Object CreateObjectEx(string type, vector pos, int iFlags, int iRotation=RF_DEFAULT)
Creates object of certain type.
override ScriptCallQueue GetCallQueue(int call_category)
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
Wrapper class for managing sound through SEffectManager.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
void SoundStop()
Stops sound.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
proto native int GetType()
returns type of InventoryLocation
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override void OnStoreSave(ParamsWriteContext ctx)
void AnimateCamonetByOpeningSelection(string opening_selection)
void HideAllAnimationsAndProxyPhysics(bool hide_animations=true, bool hide_physics=true)
override bool CanReceiveItemIntoCargo(EntityAI item)
protected Object m_ClutterCutter
override bool CanBeRepairedToPristine()
void HandleCamoNetAttachment(bool hide)
override bool CanLoadItemIntoCargo(EntityAI item)
void RefreshAttachements()
void SetIsBeingPacked(bool isBeingPacked)
override int GetViewIndex()
protected ref array< string > m_ShowAnimationsWhenPitched
protected bool m_IsToggle
protected ref array< string > m_ShowAnimationsWhenPacked
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
void PlayDeployLoopSound()
void StopDeployLoopSound()
void Pack(bool update_navmesh, bool init=false)
protected bool m_IsEntrance
void DestroyClutterCutter()
override void RefreshPhysics()
override bool CanPutInCargo(EntityAI parent)
override bool CanBePlaced(Man player, vector position)
protected void TryPitch(bool update_navmesh, bool init=false)
void SoundTentClosePlay()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
protected ref map< ref ToggleAnimations, bool > m_ToggleAnimations
override int GetMeleeTargetType()
string GetSoundOpenWindow()
string GetSoundCloseWindow()
void HandleOpeningsPhysics()
override void EEItemDetached(EntityAI item, string slot_name)
override int GetDamageSystemVersionChange()
protected CamoNet m_CamoNet
string GetClutterCutter()
void Pitch(bool update_navmesh, bool init=false)
override bool HasProxyParts()
override bool CanPutIntoHands(EntityAI parent)
override bool IsIgnoredByConstruction()
override bool IsItemTent()
bool ConditionIntoInventory(EntityAI player)
bool IsManipulatedWindow()
override bool IsDeployable()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
void SoundTentCloseWindowPlay()
bool CanToggleAnimations(string selection)
protected vector m_HalfExtents
protected bool m_IsWindow
override void EEItemAttached(EntityAI item, string slot_name)
void SoundTentOpenWindowPlay()
bool IsManipulatedEntrance()
override void OnVariablesSynchronized()
void HandleOpeningsVisuals()
bool CanAttach(ItemBase item)
void ToggleAnimation(string selection)
bool ConditionOutOfHands(EntityAI player)
void AnimateCamonetToggle(ToggleAnimations toggle)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanBeRepairedByCrafting()
void ManipulateEntrance()
override bool CanLoadAttachment(EntityAI attachment)
override string GetInvulnerabilityTypeString()
override void SetActions()
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
override void AnimateCamonetByOpeningSelection(string opening_selection)
override bool HasClutterCutter()
override string GetLoopDeploySoundset()
override string GetSoundClose()
override string GetClutterCutter()
override void HandleCamoNetAttachment(bool hide)
override string GetSoundOpen()
override string GetSoundCloseWindow()
override void AnimateCamonetToggle(ToggleAnimations toggle)
override string GetSoundOpenWindow()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
string Get(int index)
Gets n-th character from string.
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.
proto native int GetState()
returns one of STATE_...