mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-12 11:12:56 +03:00
Traps and Utill Folders/Files
This commit is contained in:
92
SQF/dayz_code/traps/beartrap.sqf
Normal file
92
SQF/dayz_code/traps/beartrap.sqf
Normal file
@@ -0,0 +1,92 @@
|
||||
_init = {
|
||||
//if (isServer) then {
|
||||
[_trap] call setup_trap;
|
||||
|
||||
if (_trap getVariable ["armed", false]) then {
|
||||
[] call _arm;
|
||||
} else {
|
||||
[] call _disarm;
|
||||
};
|
||||
//};
|
||||
};
|
||||
|
||||
_arm = {
|
||||
//if (isServer) then {
|
||||
_trap animate ["LeftShutter", 0];
|
||||
_trap animate ["RightShutter", 0];
|
||||
|
||||
_trigger = createTrigger ["EmptyDetector", getPosATL _trap];
|
||||
_trigger setpos getPosATL _trap;
|
||||
_trigger setTriggerArea [0.5, 0.5, 0, false];
|
||||
_trigger setTriggerActivation ["ANY", "PRESENT", false];
|
||||
_trigger setTriggerStatements [
|
||||
"this",
|
||||
"['trigger', thisTrigger, thisList] spawn beartrap;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","TrapBear",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
_trap animate ["LeftShutter", 1];
|
||||
_trap animate ["RightShutter", 1];
|
||||
|
||||
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
|
||||
|
||||
if (_entity isKindOf "Animal") then {
|
||||
_entity setDamage 1;
|
||||
} else {
|
||||
[_entity, "Legs", [_entity]] call server_sendToClient;
|
||||
};
|
||||
|
||||
[_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;
|
||||
};
|
||||
};
|
||||
111
SQF/dayz_code/traps/beartrapflare.sqf
Normal file
111
SQF/dayz_code/traps/beartrapflare.sqf
Normal file
@@ -0,0 +1,111 @@
|
||||
_init = {
|
||||
//if (isServer) then {
|
||||
[_trap] call setup_trap;
|
||||
|
||||
if (_trap getVariable ["armed", false]) then {
|
||||
[] call _arm;
|
||||
} else {
|
||||
[] call _disarm;
|
||||
};
|
||||
//};
|
||||
};
|
||||
|
||||
_arm = {
|
||||
//if (isServer) then {
|
||||
// don't work (due to proxies n stuff)
|
||||
//_trap animate ["LeftShutter", 0];
|
||||
//_trap animate ["RightShutter", 0];
|
||||
|
||||
_trigger = createTrigger ["EmptyDetector", getPosATL _trap];
|
||||
_trigger setpos getPosATL _trap;
|
||||
_trigger setTriggerArea [0.5, 0.5, 0, false];
|
||||
_trigger setTriggerActivation ["ANY", "PRESENT", false];
|
||||
_trigger setTriggerStatements [
|
||||
"this",
|
||||
"['trigger', thisTrigger, thisList] spawn beartrapflare;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","ItemTrapBearTrapFlare",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
// don't work (due to proxies n stuff)
|
||||
//_trap animate ["LeftShutter", 1];
|
||||
//_trap animate ["RightShutter", 1];
|
||||
|
||||
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
|
||||
|
||||
if (_entity isKindOf "Animal") then {
|
||||
_entity setDamage 1;
|
||||
} else {
|
||||
[_entity, "Legs", [_entity]] call server_sendToClient;
|
||||
};
|
||||
|
||||
_flare = createVehicle ["RoadFlare", getPosATL _trap, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
[_flare,0] spawn object_roadFlare;
|
||||
PVDZ_obj_RoadFlare = [_flare,0];
|
||||
publicVariable "PVDZ_obj_RoadFlare";
|
||||
|
||||
[_trap] call trigger_trap;
|
||||
|
||||
// allow rSAY to finish actually playing the sound
|
||||
_timeout = diag_tickTime + 2;
|
||||
waitUntil { diag_tickTime >= _timeout };
|
||||
|
||||
// needs to be after trigger_trap because of DB removal
|
||||
_pos = getPosATL _trap;
|
||||
deleteVehicle _trap;
|
||||
|
||||
_lootpile = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
|
||||
_lootpile addMagazineCargoGlobal ["TrapBear", 1];
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
107
SQF/dayz_code/traps/beartrapsmoke.sqf
Normal file
107
SQF/dayz_code/traps/beartrapsmoke.sqf
Normal file
@@ -0,0 +1,107 @@
|
||||
_init = {
|
||||
//if (isServer) then {
|
||||
[_trap] call setup_trap;
|
||||
|
||||
if (_trap getVariable ["armed", false]) then {
|
||||
[] call _arm;
|
||||
} else {
|
||||
[] call _disarm;
|
||||
};
|
||||
//};
|
||||
};
|
||||
|
||||
_arm = {
|
||||
//if (isServer) then {
|
||||
// don't work (due to proxies n stuff)
|
||||
//_trap animate ["LeftShutter", 0];
|
||||
//_trap animate ["RightShutter", 0];
|
||||
|
||||
_trigger = createTrigger ["EmptyDetector", getPosATL _trap];
|
||||
_trigger setpos getPosATL _trap;
|
||||
_trigger setTriggerArea [0.5, 0.5, 0, false];
|
||||
_trigger setTriggerActivation ["ANY", "PRESENT", false];
|
||||
_trigger setTriggerStatements [
|
||||
"this",
|
||||
"['trigger', thisTrigger, thisList] spawn beartrapsmoke;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","ItemTrapBearTrapSmoke",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
// don't work (due to proxies n stuff)
|
||||
//_trap animate ["LeftShutter", 1];
|
||||
//_trap animate ["RightShutter", 1];
|
||||
|
||||
[nil,_trap,rSAY,["trap_bear_0",60]] call RE;
|
||||
|
||||
if (_entity isKindOf "Animal") then {
|
||||
_entity setDamage 1;
|
||||
} else {
|
||||
[_entity, "Legs", [_entity]] call server_sendToClient;
|
||||
};
|
||||
|
||||
createVehicle ["SmokeShell", getPosATL _trap, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
[_trap] call trigger_trap;
|
||||
|
||||
// allow rSAY to finish actually playing the sound
|
||||
_timeout = diag_tickTime + 2;
|
||||
waitUntil { diag_tickTime >= _timeout };
|
||||
|
||||
// needs to be after trigger_trap because of DB removal
|
||||
_pos = getPosATL _trap;
|
||||
deleteVehicle _trap;
|
||||
|
||||
_lootpile = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
|
||||
_lootpile addMagazineCargoGlobal ["TrapBear", 1];
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
12
SQF/dayz_code/traps/functions/arm.sqf
Normal file
12
SQF/dayz_code/traps/functions/arm.sqf
Normal file
@@ -0,0 +1,12 @@
|
||||
_trap = _this select 0;
|
||||
_trigger = _this select 1;
|
||||
|
||||
_trap animate ['LeftShutter', 0];
|
||||
_trap animate ['RightShutter', 0];
|
||||
|
||||
_trap setVariable ["armed", true, true];
|
||||
PVDZ_veh_Save = [_trap, "gear"];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
|
||||
dayz_traps_active set [count dayz_traps_active, _trap];
|
||||
dayz_traps_trigger set [count dayz_traps_trigger, _trigger];
|
||||
14
SQF/dayz_code/traps/functions/disarm.sqf
Normal file
14
SQF/dayz_code/traps/functions/disarm.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
_trap = _this select 0;
|
||||
|
||||
_trap animate ['LeftShutter', 1];
|
||||
_trap animate ['RightShutter', 1];
|
||||
|
||||
_trap setVariable ["armed", false, true];
|
||||
PVDZ_veh_Save = [_trap, "gear"];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
|
||||
if (_trap in dayz_traps_active) then {
|
||||
deleteVehicle (dayz_traps_trigger select (dayz_traps_active find _trap));
|
||||
dayz_traps_trigger = dayz_traps_trigger - [dayz_traps_trigger select (dayz_traps_active find _trap)];
|
||||
dayz_traps_active = dayz_traps_active - [_trap];
|
||||
};
|
||||
1
SQF/dayz_code/traps/functions/remove.sqf
Normal file
1
SQF/dayz_code/traps/functions/remove.sqf
Normal file
@@ -0,0 +1 @@
|
||||
[nil,nil,nil,_this select 0] call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf"
|
||||
18
SQF/dayz_code/traps/functions/setup.sqf
Normal file
18
SQF/dayz_code/traps/functions/setup.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
private ["_id", "_uid", "_armed"];
|
||||
_trap = _this select 0;
|
||||
|
||||
if (!isNull _trap) then {
|
||||
while { true } do {
|
||||
_id = _trap getVariable ["ObjectID", "0"];
|
||||
_uid = _trap getVariable ["ObjectUID", "0"];
|
||||
_armed = _trap getVariable "armed";
|
||||
|
||||
if (isNull _trap) exitWith { /* break from loop */ };
|
||||
|
||||
if (((parseNumber _id > 0) || (parseNumber _uid > 0)) && !isNil "_armed") exitWith {
|
||||
dayz_traps set [count dayz_traps, _trap];
|
||||
};
|
||||
|
||||
sleep 0.5;
|
||||
};
|
||||
};
|
||||
7
SQF/dayz_code/traps/functions/trigger.sqf
Normal file
7
SQF/dayz_code/traps/functions/trigger.sqf
Normal file
@@ -0,0 +1,7 @@
|
||||
_trap = _this select 0;
|
||||
|
||||
if (getNumber (configFile >> "CfgVehicles" >> typeOf _trap >> "singleUse") > 0) then {
|
||||
[_trap] call remove_trap;
|
||||
} else {
|
||||
[_trap] call disarm_trap;
|
||||
};
|
||||
15
SQF/dayz_code/traps/init.sqf
Normal file
15
SQF/dayz_code/traps/init.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
// functions
|
||||
setup_trap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\functions\setup.sqf";
|
||||
arm_trap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\functions\arm.sqf";
|
||||
disarm_trap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\functions\disarm.sqf";
|
||||
remove_trap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\functions\remove.sqf";
|
||||
trigger_trap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\functions\trigger.sqf";
|
||||
|
||||
// traps
|
||||
beartrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\beartrap.sqf";
|
||||
beartrapflare = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\beartrapflare.sqf";
|
||||
beartrapsmoke = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\beartrapsmoke.sqf";
|
||||
tripcans = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\tripcans.sqf";
|
||||
tripflare = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\tripflare.sqf";
|
||||
tripgrenade = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\tripgrenade.sqf";
|
||||
tripsmoke = compile preprocessFileLineNumbers "\z\addons\dayz_code\traps\tripsmoke.sqf";
|
||||
85
SQF/dayz_code/traps/tripcans.sqf
Normal file
85
SQF/dayz_code/traps/tripcans.sqf
Normal file
@@ -0,0 +1,85 @@
|
||||
_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;
|
||||
};
|
||||
};
|
||||
93
SQF/dayz_code/traps/tripflare.sqf
Normal file
93
SQF/dayz_code/traps/tripflare.sqf
Normal file
@@ -0,0 +1,93 @@
|
||||
_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 tripflare;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","ItemTrapTripwireFlare",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
|
||||
|
||||
_position = _trap modelToWorld (_trap selectionPosition "TripA");
|
||||
_position set [2, 0];
|
||||
|
||||
_flare = createVehicle ["RoadFlare", _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
[_flare,0] spawn object_roadFlare;
|
||||
PVDZ_obj_RoadFlare = [_flare,0];
|
||||
publicVariable "PVDZ_obj_RoadFlare";
|
||||
|
||||
[_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;
|
||||
};
|
||||
};
|
||||
89
SQF/dayz_code/traps/tripgrenade.sqf
Normal file
89
SQF/dayz_code/traps/tripgrenade.sqf
Normal file
@@ -0,0 +1,89 @@
|
||||
_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 tripgrenade;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","ItemTrapTripwireGrenade",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
|
||||
|
||||
_position = _trap modelToWorld (_trap selectionPosition "TripA");
|
||||
_position set [2, 0];
|
||||
|
||||
_flare = createVehicle ["GrenadeHandTimedWest_DZ", _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
[_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;
|
||||
};
|
||||
};
|
||||
89
SQF/dayz_code/traps/tripsmoke.sqf
Normal file
89
SQF/dayz_code/traps/tripsmoke.sqf
Normal file
@@ -0,0 +1,89 @@
|
||||
_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 tripsmoke;",
|
||||
""
|
||||
];
|
||||
|
||||
[_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","ItemTrapTripwireSmoke",_trap]] spawn object_pickup;
|
||||
};
|
||||
};
|
||||
|
||||
_trigger = {
|
||||
//if (isServer) then {
|
||||
private ["_entity"];
|
||||
_entity = _this select 0;
|
||||
|
||||
[nil,_trap,rSAY,["z_trap_trigger_0",60]] call RE;
|
||||
|
||||
_position = _trap modelToWorld (_trap selectionPosition "TripA");
|
||||
_position set [2, 0];
|
||||
|
||||
_flare = createVehicle ["SmokeShell", _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
[_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;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user