DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionUnlockContainerDoor.c
См. документацию.
2{
3 //custom condition, wrong key unlock attempt is allowed
4 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
5 {
6 ContainerLockedBase shipCont;
7 if (Class.CastTo(shipCont, target.GetObject()))
8 {
9 int doorIndex = TranslateLockSelectionIntoDoorIdx(target);
10 if (doorIndex != -1)
11 return shipCont.IsDoorLocked(doorIndex);
12 }
13 return false;
14 }
15
16 override void OnFinishProgressServer( ActionData action_data )
17 {
19 ContainerLockedBase shipCont = ContainerLockedBase.Cast(action_data.m_Target.GetObject());
20 if (shipCont && key && ((shipCont.GetLockCompatibilityType(shipCont.GetDoorIndex(action_data.m_Target.GetComponentIndex())) & key.GetKeyCompatibilityType()) == 0))
21 {
22 key.DestroyKeyServer();
23 }
24 else
25 {
26 UnlockDoor(action_data.m_Target);
27 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, APPLIED_DMG);
28 }
29 }
30
31 override protected void UnlockDoor(ActionTarget target)
32 {
33 Building building;
34 if (Class.CastTo(building, target.GetObject()))
35 {
36 int doorIndex = TranslateLockSelectionIntoDoorIdx(target);
37 if (doorIndex != -1)
38 {
39 building.UnlockDoor(doorIndex,false);
40 }
41 }
42 }
43
46 {
47 //side1_lock
48 ContainerLockedBase shipCont;
49 if (Class.CastTo(shipCont, target.GetObject()))
50 {
51 string selectionName = shipCont.GetActionComponentName( target.GetComponentIndex() );
52
53 if (selectionName.Contains("_lock"))
54 return (selectionName.Substring(4,1).ToInt() - 1);
55 }
56
57 return -1;
58 }
59};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
const float APPLIED_DMG
Определения ActionUnlockDoors.c:11
void ActionUnlockDoors()
Определения ActionUnlockDoors.c:13
int TranslateLockSelectionIntoDoorIdx(ActionTarget target)
Returns door idx.
Определения ActionUnlockContainerDoor.c:45
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionUnlockContainerDoor.c:4
void UnlockDoor(ActionTarget target)
Определения ActionUnlockContainerDoor.c:31
override void OnFinishProgressServer(ActionData action_data)
Определения ActionUnlockContainerDoor.c:16
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native int ToInt()
Converts string to integer.
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.