mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-27 18:21:50 +03:00
1.0.1.7 DEV TEST
+ [CHANGED] Can now fill empty fuel barrels on standard fuel tanks. + [CHANGED] Increased range of crafting from 2m to 3m + [FIXED] Removed repair action from tow truck with VIL_asistvan_DZE + [ADDED] Tow truck VIL_asistvan_DZE can tow vehicles that fit within the bounding box of the model. + [ADDED] Ability for fuel trucks to fill nearby vehicles 30m when engine is running. + [CHANGED] Reworked Epoch events scheduler and made it more accurate. + [REMOVED] Road debris no longer spawn loot, helps with performance and we have added extra loot positions in the world. + and more
This commit is contained in:
@@ -3,11 +3,25 @@ private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_
|
||||
if(TradeInprogress) exitWith { cutText ["Refuel already in progress." , "PLAIN DOWN"] };
|
||||
TradeInprogress = true;
|
||||
|
||||
// Get all nearby vehicles within 10m
|
||||
_findNearestVehicles = nearestObjects [player, ["AllVehicles"], 10];
|
||||
_isVehicle = false;
|
||||
|
||||
_vehicleSrc = _this select 0;
|
||||
|
||||
if(_vehicleSrc != objNull) then {
|
||||
|
||||
_isVehicle = ((_vehicleSrc isKindOf "AllVehicles") and !(_vehicleSrc isKindOf "Man"));
|
||||
|
||||
// If fuel source is vehicle get actual capacity
|
||||
_configSrcVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicleSrc);
|
||||
_capacitySrc = getNumber(_configVeh >> "fuelCapacity");
|
||||
_nameTextSrc = getText(_configVeh >> "displayName");
|
||||
};
|
||||
|
||||
// Get all nearby vehicles within 30m
|
||||
_findNearestVehicles = nearestObjects [player, ["AllVehicles"], 30];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
if (alive _x and !(_x isKindOf "Man")) then {
|
||||
if (alive _x and _vehicleSrc != _x and !(_x isKindOf "Man")) then {
|
||||
_findNearestVehicle set [(count _findNearestVehicle),_x];
|
||||
};
|
||||
} foreach _findNearestVehicles;
|
||||
@@ -24,7 +38,6 @@ if(_IsNearVehicle >= 1) then {
|
||||
_capacity = getNumber(_configVeh >> "fuelCapacity");
|
||||
_nameText = getText(_configVeh >> "displayName");
|
||||
|
||||
|
||||
_isOk = true;
|
||||
// perform fuel up
|
||||
while {_isOk} do {
|
||||
@@ -76,25 +89,44 @@ if(_IsNearVehicle >= 1) then {
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
// Get vehicle fuel levels again
|
||||
_curFuel = ((fuel _vehicle) * _capacity);
|
||||
_newFuel = (_curFuel + _canSize);
|
||||
_isFillok = true;
|
||||
|
||||
if (_newFuel > _capacity) then {_newFuel = _capacity; _abort = true; };
|
||||
// add checks for fuel level
|
||||
if(_isVehicle) then {
|
||||
_curFuelSrc = ((fuel _vehicleSrc) * _capacitySrc);
|
||||
_newFuelSrc = (_curFuelSrc - _canSize);
|
||||
|
||||
// calculate minimum needed fuel
|
||||
_newFuel = (_newFuel / _capacity);
|
||||
|
||||
dayzSetFuel = [_vehicle,_newFuel];
|
||||
if (local _vehicle) then {
|
||||
dayzSetFuel spawn local_setFuel;
|
||||
// calculate new fuel
|
||||
_newFuelSrc = (_newFuelSrc / _capacitySrc);
|
||||
if (_newFuelSrc > 0) then {
|
||||
dayzSetFuel = [_vehicleSrc,_newFuelSrc];
|
||||
dayzSetFuel spawn local_setFuel;
|
||||
publicVariable "dayzSetFuel";
|
||||
} else {
|
||||
_isFillok = false;
|
||||
_abort = true;
|
||||
};
|
||||
};
|
||||
publicVariable "dayzSetFuel";
|
||||
|
||||
if (_isFillok) then {
|
||||
// Get vehicle fuel levels again
|
||||
_curFuel = ((fuel _vehicle) * _capacity);
|
||||
_newFuel = (_curFuel + _canSize);
|
||||
|
||||
// Play sound
|
||||
[player,"refuel",0,false] call dayz_zombieSpeak;
|
||||
if (_newFuel > _capacity) then {_newFuel = _capacity; _abort = true; };
|
||||
|
||||
cutText [format["%1 filled to %2 percent capacity.",_nameText,round(_newFuel*100)], "PLAIN DOWN"];
|
||||
// calculate minimum needed fuel
|
||||
_newFuel = (_newFuel / _capacity);
|
||||
|
||||
dayzSetFuel = [_vehicle,_newFuel];
|
||||
dayzSetFuel spawn local_setFuel;
|
||||
publicVariable "dayzSetFuel";
|
||||
|
||||
// Play sound
|
||||
[player,"refuel",0,false] call dayz_zombieSpeak;
|
||||
|
||||
cutText [format["%1 filled to %2 percent capacity.",_nameText,round(_newFuel*100)], "PLAIN DOWN"];
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {};
|
||||
|
||||
@@ -9,18 +9,23 @@ s_player_fillfuel = 1;
|
||||
_fillCounter = 0;
|
||||
_abort = false;
|
||||
|
||||
_qty = {_x == "ItemJerrycanEmpty"} count magazines player;
|
||||
_fuelCans = [];
|
||||
|
||||
for "_x" from 1 to _qty do {
|
||||
{
|
||||
if(_x == "ItemJerrycanEmpty" or _x == "ItemFuelBarrelEmpty") then {
|
||||
_fuelCans set [(count _fuelCans),_x];
|
||||
};
|
||||
} forEach magazines player;
|
||||
|
||||
_qty = count _fuelCans;
|
||||
|
||||
{
|
||||
_displayName = getText (configFile >> "cfgMagazines" >> _x >> "displayName");
|
||||
|
||||
_fillCounter = _fillCounter + 1;
|
||||
|
||||
if(_qty == 1) then {
|
||||
cutText ["Preparing to siphon, stand still to fill empty jerry can.", "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [format[("Preparing to siphon, stand still to fill empty jerry can %1 of %2."),_fillCounter,_qty] , "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
cutText [format["Preparing to siphon, stand still to fill %1.",_displayName], "PLAIN DOWN"];
|
||||
|
||||
// force animation
|
||||
player playActionNow "Medic";
|
||||
// Play sound and alert zombies
|
||||
@@ -64,22 +69,22 @@ for "_x" from 1 to _qty do {
|
||||
};
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
if ("ItemJerrycanEmpty" in magazines player) then {
|
||||
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
|
||||
cutText [format[(localize "str_player_09"),1], "PLAIN DOWN"];
|
||||
if(([player,_x] call BIS_fnc_invRemove) == 1) then {
|
||||
if (_x == "ItemFuelBarrelEmpty") then {
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
} else {
|
||||
player addMagazine "ItemJerrycan";
|
||||
};
|
||||
cutText [format["You have filled %1 with fuel.",_displayName], "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [(localize "str_player_10") , "PLAIN DOWN"];
|
||||
_abort = true;
|
||||
};
|
||||
};
|
||||
|
||||
sleep 1;
|
||||
if(_abort) exitWith {};
|
||||
};
|
||||
|
||||
} forEach _fuelCans;
|
||||
|
||||
s_player_fillfuel = -1;
|
||||
TradeInprogress = false;
|
||||
@@ -2,7 +2,7 @@
|
||||
DayZ Base Building
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_isBuilding","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_buildings","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole"];
|
||||
private ["_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Building already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
@@ -12,6 +12,9 @@ _isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||
_cancel = false;
|
||||
_reason = "";
|
||||
_canBuildOnPlot = false;
|
||||
DZE_BuildingZ = 0;
|
||||
|
||||
DZE_5 = false;
|
||||
|
||||
call gear_ui_init;
|
||||
|
||||
@@ -21,6 +24,7 @@ if(player getVariable["combattimeout", 0] >= time) exitWith {TradeInprogress = f
|
||||
|
||||
_item = _this;
|
||||
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
|
||||
_classnametmp = _classname;
|
||||
_require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||
|
||||
@@ -35,7 +39,6 @@ if(_isPole) then {
|
||||
_distance = 45;
|
||||
};
|
||||
|
||||
|
||||
// check for near plot
|
||||
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
|
||||
_findNearestPole = [];
|
||||
@@ -54,35 +57,24 @@ if(_isPole and _IsNearPlot > 0) exitWith { TradeInprogress = false; cutText ["C
|
||||
if(_IsNearPlot == 0) then {
|
||||
_canBuildOnPlot = true;
|
||||
} else {
|
||||
// Since there are plots nearby we check for ownership and then for friend status
|
||||
|
||||
// check nearby plots ownership and then for friend status
|
||||
_nearestPole = _findNearestPole select 0;
|
||||
|
||||
if("Plastic_Pole_EP1_DZ" in _needNearby) then {
|
||||
_nearestPole = _findNearestPole select 0;
|
||||
// Find owner
|
||||
_ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
|
||||
// Find owner
|
||||
_ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
|
||||
|
||||
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
|
||||
|
||||
// check if friendly to owner
|
||||
if(dayz_characterID == _ownerID) then {
|
||||
// owner can build anything within his plot except other plots
|
||||
if(!_isPole) then {
|
||||
_canBuildOnPlot = true;
|
||||
};
|
||||
|
||||
} else {
|
||||
// disallow building plot
|
||||
if(!_isPole) then {
|
||||
_friendlies = player getVariable ["friendlyTo",[]];
|
||||
// check if friendly to owner
|
||||
if(_ownerID in _friendlies) then {
|
||||
_canBuildOnPlot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
// check if friendly to owner
|
||||
if(dayz_characterID == _ownerID) then {
|
||||
_canBuildOnPlot = true;
|
||||
} else {
|
||||
_canBuildOnPlot = true;
|
||||
_friendlies = player getVariable ["friendlyTo",[]];
|
||||
// check if friendly to owner
|
||||
if(_ownerID in _friendlies) then {
|
||||
_canBuildOnPlot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -103,75 +95,118 @@ if (!_hasrequireditem) exitWith {TradeInprogress = false; cutText [format["Missi
|
||||
if (_hasrequireditem) then {
|
||||
|
||||
_location = [0,0,0];
|
||||
_dir = getDir player;
|
||||
|
||||
player allowDamage false;
|
||||
|
||||
_position = player modeltoworld _offset;
|
||||
_position = [(_position select 0),(_position select 1), 0];
|
||||
|
||||
|
||||
if(isText (configFile >> "CfgVehicles" >> _classname >> "GhostPreview")) then {
|
||||
_ghost = getText(configFile >> "CfgVehicles" >> _classname >> "GhostPreview");
|
||||
};
|
||||
|
||||
// if ghost preview available use that instead
|
||||
if(_ghost != "") then {
|
||||
|
||||
_classnametmp = _classname;
|
||||
_classname = _ghost;
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
_classname = _classnametmp;
|
||||
|
||||
} else {
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
};
|
||||
|
||||
_object setDir _dir;
|
||||
|
||||
_object setPos _position;
|
||||
|
||||
_object allowDamage false;
|
||||
|
||||
_object attachTo [player];
|
||||
|
||||
_counter = 0;
|
||||
_isOk = true;
|
||||
|
||||
while {_isOk} do {
|
||||
|
||||
if (player getVariable["combattimeout", 0] >= time) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = "Cannot build while in combat.";
|
||||
|
||||
|
||||
if(_counter == 0) then {
|
||||
// get inital players position
|
||||
_location1 = getPosATL player;
|
||||
_dir = getDir player;
|
||||
_position = player modeltoworld _offset;
|
||||
_position = [(_position select 0),(_position select 1), (_position select 2)];
|
||||
hintSilent str (_position);
|
||||
|
||||
// if ghost preview available use that instead
|
||||
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
|
||||
if (_ghost == "") then {
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
} else {
|
||||
_classname = _ghost;
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
};
|
||||
|
||||
_object setDir _dir;
|
||||
_object setPos _position;
|
||||
_object attachTo [player];
|
||||
};
|
||||
|
||||
cutText ["Planning construction stand still 5 seconds to build.", "PLAIN DOWN"];
|
||||
_zheightchanged = false;
|
||||
|
||||
if (DZE_Q) then {
|
||||
DZE_Q = false;
|
||||
DZE_BuildingZ = DZE_BuildingZ + 0.1;
|
||||
_zheightchanged = true;
|
||||
};
|
||||
if (DZE_Z) then {
|
||||
DZE_Z = false;
|
||||
DZE_BuildingZ = DZE_BuildingZ - 0.1;
|
||||
|
||||
_zheightchanged = true;
|
||||
};
|
||||
|
||||
_location1 = getPosATL player;
|
||||
sleep 5;
|
||||
if(_zheightchanged) then {
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
|
||||
_dir = getDir player;
|
||||
_position = player modeltoworld _offset;
|
||||
_position = [(_position select 0),(_position select 1), (_position select 2)+DZE_BuildingZ];
|
||||
|
||||
hintSilent str (_position);
|
||||
|
||||
// if ghost preview available use that instead
|
||||
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
|
||||
if (_ghost == "") then {
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
} else {
|
||||
_classname = _ghost;
|
||||
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
|
||||
};
|
||||
|
||||
_object setDir _dir;
|
||||
_object setPos _position;
|
||||
_object attachTo [player];
|
||||
};
|
||||
|
||||
cutText ["Planning construction numpad 8 = up, numpad 2 = down, and numpad 5 to start building.", "PLAIN DOWN"];
|
||||
|
||||
_location0 = getPosATL player;
|
||||
|
||||
sleep 1;
|
||||
|
||||
_location2 = getPosATL player;
|
||||
|
||||
if(_location1 distance _location2 < 0.1) exitWith {
|
||||
if(DZE_5) exitWith {
|
||||
_isOk = false;
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
if(_location1 distance _location2 > 5) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = "Moving to fast.";
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
if(_counter >= 3) exitWith {
|
||||
if(_counter >= 45) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = "Ran out of time to find position.";
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
};
|
||||
_counter = _counter + 1;
|
||||
|
||||
if (player getVariable["combattimeout", 0] >= time) exitWith {
|
||||
_isOk = false;
|
||||
_cancel = true;
|
||||
_reason = "Cannot build while in combat.";
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
};
|
||||
};
|
||||
|
||||
detach _object;
|
||||
deleteVehicle _object;
|
||||
|
||||
_classname = _classnametmp;
|
||||
|
||||
|
||||
|
||||
|
||||
// Start Build
|
||||
@@ -182,31 +217,19 @@ if (_hasrequireditem) then {
|
||||
|
||||
// Get position based on player
|
||||
_location = player modeltoworld _offset;
|
||||
|
||||
_location = [(_location select 0),(_location select 1),(_position select 2)];
|
||||
|
||||
hintSilent str (_location);
|
||||
|
||||
_tmpbuilt setpos _location;
|
||||
|
||||
// No building on roads
|
||||
if (isOnRoad _location) then { _cancel = true; _reason = "Cannot build on a road."; };
|
||||
|
||||
// set building with ground
|
||||
_location = [(_location select 0),(_location select 1), 0];
|
||||
_tmpbuilt setpos _location;
|
||||
|
||||
// set building with offset
|
||||
// _tmpbuilt setpos _location;
|
||||
|
||||
player allowDamage true;
|
||||
|
||||
// testing new way of finding building
|
||||
_buildings = nearestObjects [(vehicle player), ["Building"], 100];
|
||||
{
|
||||
_isBuilding = [(vehicle player),_x] call fnc_isInsideBuilding;
|
||||
if(_isBuilding) exitWith {
|
||||
_cancel = true;
|
||||
_reason = "Cannot build inside another building.";
|
||||
};
|
||||
} forEach _buildings;
|
||||
|
||||
// No building in trader zones
|
||||
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
|
||||
if(!placevault) then { _cancel = true; _reason = "Cannot build in a city."; };
|
||||
|
||||
if(!_cancel) then {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ TradeInprogress = true;
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_distance = 3;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ TradeInprogress = true;
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_distance = 3;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ TradeInprogress = true;
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_distance = 3;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ TradeInprogress = true;
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_distance = 3;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ TradeInprogress = true;
|
||||
// temp array of removed parts
|
||||
_temp_removed_array = [];
|
||||
_abort = false;
|
||||
_distance = 2;
|
||||
_distance = 3;
|
||||
_reason = "";
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
|
||||
87
SQF/dayz_code/actions/tow_AttachStraps.sqf
Normal file
87
SQF/dayz_code/actions/tow_AttachStraps.sqf
Normal file
@@ -0,0 +1,87 @@
|
||||
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_abort","_canSize","_configVeh","_capacity","_nameText","_isOk","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Already in progress." , "PLAIN DOWN"] };
|
||||
TradeInprogress = true;
|
||||
|
||||
// Tow Truck
|
||||
_towTruck = _this;
|
||||
|
||||
// Get all nearby vehicles within 10m
|
||||
_findNearestVehicles = nearestObjects [_towTruck, ["Car"], 10];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
if (alive _x and _towTruck != _x) then {
|
||||
// within brounding box
|
||||
if([_x,_towTruck] call fnc_isInsideBuilding2) then {
|
||||
_findNearestVehicle set [(count _findNearestVehicle),_x];
|
||||
};
|
||||
};
|
||||
} foreach _findNearestVehicles;
|
||||
|
||||
_IsNearVehicle = count (_findNearestVehicle);
|
||||
|
||||
if(_IsNearVehicle >= 1) then {
|
||||
|
||||
// select the nearest one
|
||||
_vehicle = _findNearestVehicle select 0;
|
||||
|
||||
// Static vehicle fuel information
|
||||
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
|
||||
_nameText = getText(_configVeh >> "displayName");
|
||||
|
||||
// alert zombies
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_finished = false;
|
||||
|
||||
// force animation
|
||||
player playActionNow "Medic";
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
|
||||
while {r_doLoop} do {
|
||||
_animState = animationState player;
|
||||
_isMedic = ["medic",_animState] call fnc_inString;
|
||||
if (_isMedic) then {
|
||||
_started = true;
|
||||
};
|
||||
if (_started and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if(!_finished) then {
|
||||
r_interrupt = false;
|
||||
|
||||
if (vehicle player == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
_abort = true;
|
||||
};
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
if(typeOf _towTruck == "VIL_asistvan_DZE" ) then {
|
||||
_vehicle attachTo [_towTruck];
|
||||
_towTruck setVariable ["DZEinTow", true, true];
|
||||
_towTruck setVariable ["DZEvehicleInTow", _vehicle, true];
|
||||
cutText [format["%1 has been attached to Tow Truck.",_nameText], "PLAIN DOWN"];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
cutText ["No Vehicles Nearby.", "PLAIN DOWN"];
|
||||
};
|
||||
TradeInprogress = false;
|
||||
72
SQF/dayz_code/actions/tow_DetachStraps.sqf
Normal file
72
SQF/dayz_code/actions/tow_DetachStraps.sqf
Normal file
@@ -0,0 +1,72 @@
|
||||
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_abort","_canSize","_configVeh","_capacity","_nameText","_isOk","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Already in progress." , "PLAIN DOWN"] };
|
||||
TradeInprogress = true;
|
||||
|
||||
// Tow Truck
|
||||
_towTruck = _this;
|
||||
|
||||
// exit if no vehicle is in tow.
|
||||
_inTow = _towTruck getVariable ["DZEinTow", false]
|
||||
|
||||
if(!_inTow) then {
|
||||
|
||||
// select the nearest one
|
||||
_vehicle = _towTruck getVariable ["DZEvehicleInTow", false];
|
||||
|
||||
// Static vehicle fuel information
|
||||
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
|
||||
_nameText = getText(_configVeh >> "displayName");
|
||||
|
||||
// alert zombies
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
_finished = false;
|
||||
|
||||
// force animation
|
||||
player playActionNow "Medic";
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
|
||||
while {r_doLoop} do {
|
||||
_animState = animationState player;
|
||||
_isMedic = ["medic",_animState] call fnc_inString;
|
||||
if (_isMedic) then {
|
||||
_started = true;
|
||||
};
|
||||
if (_started and !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
sleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
|
||||
if(!_finished) then {
|
||||
r_interrupt = false;
|
||||
|
||||
if (vehicle player == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
_abort = true;
|
||||
};
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
detach _vehicle;
|
||||
_towTruck setVariable ["DZEinTow", false, true];
|
||||
_towTruck setVariable ["DZEvehicleInTow", objNull, true];
|
||||
cutText [format["%1 has been dettached from Tow Truck.",_nameText], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
cutText ["No Vehicles In Tow.", "PLAIN DOWN"];
|
||||
};
|
||||
TradeInprogress = false;
|
||||
Reference in New Issue
Block a user