mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
86 lines
1.9 KiB
Plaintext
86 lines
1.9 KiB
Plaintext
_init = {
|
|
//if (isServer) then {
|
|
[_trap] call setup_trap;
|
|
|
|
if (_trap getVariable ["armed", false]) then {
|
|
[] call _arm;
|
|
} else {
|
|
[] call _disarm;
|
|
};
|
|
//};
|
|
};
|
|
|
|
_arm = {
|
|
//if (isServer) then {
|
|
_pos = getPosATL _trap;
|
|
_pos1 = _trap modelToWorld (_trap selectionPosition "TripA");
|
|
_pos2 = _trap modelToWorld (_trap selectionPosition "TripB");
|
|
|
|
_trigger = createTrigger ["EmptyDetector", _pos];
|
|
_trigger setpos _pos;
|
|
_trigger setTriggerArea [1, ([_pos1, _pos2] call BIS_fnc_distance2D) / 2, [_pos1, _pos2] call BIS_fnc_dirTo, true];
|
|
_trigger setTriggerActivation ["ANY", "PRESENT", false];
|
|
_trigger setTriggerStatements [
|
|
"this",
|
|
"['trigger', thisTrigger, thisList] spawn tripcans;",
|
|
""
|
|
];
|
|
|
|
[_trap, _trigger] call arm_trap;
|
|
//} else {
|
|
_trap setVariable ["armed", true, true];
|
|
//};
|
|
};
|
|
|
|
_disarm = {
|
|
if (isServer) then {
|
|
[_trap] call disarm_trap;
|
|
} else {
|
|
_trap setVariable ["armed", false, true];
|
|
};
|
|
};
|
|
|
|
_remove = {
|
|
if (isServer) then {
|
|
[_trap] call remove_trap;
|
|
} else {
|
|
[_trap] call remove_trap;
|
|
[0,0,0,["cfgMagazines","ItemTrapTripwireCans",_trap]] spawn object_pickup;
|
|
};
|
|
};
|
|
|
|
_trigger = {
|
|
if (isServer) then {
|
|
private ["_entity"];
|
|
_entity = _this select 0;
|
|
|
|
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
|
|
[nil,_trap,rSAY,[format["z_trap_cans_%1", round (random 2)],60]] call RE;
|
|
|
|
[_trap] call trigger_trap;
|
|
};
|
|
};
|
|
|
|
private ["_event", "_trap", "_args"];
|
|
_event = _this select 0;
|
|
_trap = if (typeOf (_this select 1) == "EmptyDetector") then { dayz_traps_active select (dayz_traps_trigger find (_this select 1)) } else { _this select 1 };
|
|
_args = if (count _this > 2) then { _this select 2 } else { [] };
|
|
|
|
switch (_event) do {
|
|
case "init": {
|
|
[] call _init;
|
|
};
|
|
case "remove": {
|
|
[] call _remove;
|
|
};
|
|
case "arm": {
|
|
[] call _arm;
|
|
};
|
|
case "disarm": {
|
|
[] call _disarm;
|
|
};
|
|
case "trigger": {
|
|
_args call _trigger;
|
|
};
|
|
};
|