11 static float m_DigStashSlopeTolerance = 0.6;
23 override void CreateConditionComponents()
29 override bool Can(
PlayerBase player, ActionTarget target,
ItemBase item,
int condition_mask)
31 if (!super.Can(player, target, item, condition_mask))
34 return player.CheckFreeSpace(
vector.Forward, 1.0,
false);
40 if (
Class.CastTo(targetIB, target.GetObject()) && targetIB.CanBeDigged())
42 if (player.IsPlacingLocal())
47 if (targetIB.IsRuined() || targetIB.GetInventory().IsAttachment())
52 if (targetIB.GetInventory().IsAttachment())
57 if (targetIB.IsInherited(UndergroundStash))
64 if (targetIB.GetInventory().IsInCargo())
65 entityToCheck = player;
69 excludedObjects.Insert(targetIB);
72 if (
GetGame().IsBoxColliding(entityToCheck.GetPosition(), entityToCheck.GetOrientation(),
"2 2 2", excludedObjects, nearbyObjects))
74 foreach (
Object nearbyObject : nearbyObjects)
76 if (nearbyObject.IsInherited(UndergroundStash))
85 if (!
GetGame().IsSurfaceDigable(surfaceType))
92 vector position = entityToCheck.GetPosition();
95 positions.Insert(position +
"0.5 0 0.5");
96 positions.Insert(position +
"-0.5 0 0.5");
97 positions.Insert(position +
"0.5 0 -0.5");
98 positions.Insert(position +
"-0.5 0 -0.5");
102 return difference < m_DigStashSlopeTolerance;
109 override void OnExecuteClient(ActionData action_data)
111 super.OnExecuteClient(action_data);
113 SpawnParticleShovelRaise(action_data);
116 override void OnExecuteServer(ActionData action_data)
118 super.OnExecuteServer(action_data);
120 if (!
GetGame().IsMultiplayer())
122 SpawnParticleShovelRaise(action_data);
126 void SpawnParticleShovelRaise(ActionData action_data)
131 override void OnFinishProgressServer(ActionData action_data)
136 ErrorEx(
"Cannot get entity=" + targetEntity);
141 if (!targetEntity.GetInventory().GetCurrentInventoryLocation(targetIL))
143 ErrorEx(
"Cannot get inventory location of entity=" + targetEntity);
147 EntityAI entityToCheck = targetEntity;
148 if (targetEntity.GetInventory().IsInCargo())
149 entityToCheck = action_data.m_Player;
154 string undergroundStashType;
158 if (undergroundStashType ==
"")
159 undergroundStashType =
"UndergroundStash";
161 UndergroundStash stash = UndergroundStash.Cast(
GetGame().CreateObjectEx(undergroundStashType, targetEntity.GetPosition(),
ECE_PLACE_ON_SURFACE));
165 stash.PlaceOnGround();
167 stash.GetInventory().GetCurrentInventoryLocation(ilj);
171 GetGame().AddInventoryJunctureEx(action_data.m_Player, targetEntity, ilj,
true, 10000);
172 GetGame().ClearJunctureEx(action_data.m_Player, targetEntity);
174 if (!
GetGame().IsMultiplayer())
177 action_data.m_Player.LocalTakeEntityToTargetCargo(stash, targetEntity);
180 action_data.m_Player.ServerTakeEntityToTargetCargo(stash, targetEntity);
184 Debug.Log(
string.Format(
"Cannot remove entity=%1 obj from current location=%2", targetEntity,
InventoryLocation.DumpToStringNullSafe(targetIL)));
193 MiscGameplayFunctions.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 10);
196 override string GetAdminLogMessage(ActionData action_data)
198 return string.Format(
"Player %1 Dug in %2 at position %3", action_data.m_Player, action_data.m_Target.GetObject(), action_data.m_Target.GetObject().GetPosition());
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)