3 override void CreateActionComponent()
11 static float m_DigStashSlopeTolerance = 0.6;
23 override void CreateConditionComponents()
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 for (
int i = 0; i < nearbyObjects.Count(); i++)
76 if (nearbyObjects[i].IsInherited(UndergroundStash))
86 GetGame().SurfaceUnderObject(entityToCheck, surfaceType, liquidType);
87 if (!
GetGame().IsSurfaceDigable(surfaceType))
94 vector position = entityToCheck.GetPosition();
97 positions.Insert(position +
"0.5 0 0.5");
98 positions.Insert(position +
"-0.5 0 0.5");
99 positions.Insert(position +
"0.5 0 -0.5");
100 positions.Insert(position +
"-0.5 0 -0.5");
102 float difference =
GetGame().GetHighestSurfaceYDifference(positions);
104 return difference < m_DigStashSlopeTolerance;
111 override void OnExecuteClient(
ActionData action_data)
113 super.OnExecuteClient(action_data);
115 SpawnParticleShovelRaise(action_data);
118 override void OnExecuteServer(
ActionData action_data)
120 super.OnExecuteServer(action_data);
122 if (!
GetGame().IsMultiplayer())
124 SpawnParticleShovelRaise(action_data);
128 void SpawnParticleShovelRaise(
ActionData action_data)
133 override void OnFinishProgressServer(
ActionData action_data)
138 ErrorEx(
"Cannot get entity=" + targetEntity);
143 if (!targetEntity.GetInventory().GetCurrentInventoryLocation(targetIL))
145 ErrorEx(
"Cannot get inventory location of entity=" + targetEntity);
149 UndergroundStash stash = UndergroundStash.Cast(
GetGame().CreateObjectEx(
"UndergroundStash", targetEntity.GetPosition(),
ECE_PLACE_ON_SURFACE));
152 stash.PlaceOnGround();
155 action_data.m_Player.ServerTakeEntityToTargetCargo(stash, targetEntity);
159 Debug.Log(
string.Format(
"Cannot remove entity=%1 obj from current location=%2", targetEntity,
InventoryLocation.DumpToStringNullSafe(targetIL)));
168 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 10);
172 override string GetAdminLogMessage(
ActionData action_data)
174 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());