mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-20 10:26:28 +03:00
1.0.1.8 DEV TEST
This commit is contained in:
@@ -5,12 +5,11 @@ TradeInprogress = true;
|
||||
|
||||
_isVehicle = false;
|
||||
|
||||
_vehicleSrc = _this select 0;
|
||||
_vehicleSrc = _this select 3;
|
||||
|
||||
if(_vehicleSrc != objNull) then {
|
||||
if(!(isNull _vehicleSrc)) 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");
|
||||
@@ -21,7 +20,8 @@ if(_vehicleSrc != objNull) then {
|
||||
_findNearestVehicles = nearestObjects [player, ["AllVehicles"], 30];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
if (alive _x and _vehicleSrc != _x and !(_x isKindOf "Man")) then {
|
||||
//diag_log ("FILL = " + str(_x) + " = " + str(_vehicleSrc));
|
||||
if (alive _x and !(_x == _vehicleSrc) and !(_x isKindOf "Man")) exitWith {
|
||||
_findNearestVehicle set [(count _findNearestVehicle),_x];
|
||||
};
|
||||
} foreach _findNearestVehicles;
|
||||
|
||||
@@ -27,6 +27,7 @@ _classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >>
|
||||
_classnametmp = _classname;
|
||||
_require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
|
||||
|
||||
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
|
||||
|
||||
@@ -150,7 +151,7 @@ if (_hasrequireditem) then {
|
||||
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 {
|
||||
|
||||
@@ -20,20 +20,7 @@ _findNearestTree = [];
|
||||
|
||||
if (alive _x) then {
|
||||
|
||||
_objInfo = toArray(str(_x));
|
||||
_lenInfo = count _objInfo - 1;
|
||||
_objName = [];
|
||||
_i = 0;
|
||||
// determine where the object name starts
|
||||
{
|
||||
if (58 == _objInfo select _i) exitWith {};
|
||||
_i = _i + 1;
|
||||
} forEach _objInfo;
|
||||
_i = _i + 2; // skip the ": " part
|
||||
for "_k" from _i to _lenInfo do {
|
||||
_objName = _objName + [_objInfo select _k];
|
||||
};
|
||||
_objName = toLower(toString(_objName));
|
||||
_objName = _x call DZE_getModelName;
|
||||
|
||||
// Exit since we found a tree
|
||||
if (_objName in _trees) exitWith {
|
||||
|
||||
122
SQF/dayz_code/actions/player_harvestPlant.sqf
Normal file
122
SQF/dayz_code/actions/player_harvestPlant.sqf
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
DayZ Harvest Plant
|
||||
Usage: spawn player_harvestPlant;
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_isOk","_i","_objName","_objInfo","_lenInfo","_started","_finished","_animState","_isMedic","_proceed","_counter","_itemOut","_countOut","_tree","_distance2d","_distance3d","_trees","_findNearestTree"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText ["Harvest already in progress." , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
// allowed trees list move this later
|
||||
_trees = ["pumpkin.p3d","p_helianthus.p3d","p_fiberplant_ep1.p3d"];
|
||||
_treesOutput = ["FoodPumpkin","FoodSunFlowerSeed","ItemKiloHemp"];
|
||||
|
||||
//_item = _this;
|
||||
call gear_ui_init;
|
||||
|
||||
_countOut = 0;
|
||||
|
||||
_findNearestTree = [];
|
||||
{
|
||||
if("" == typeOf _x) then {
|
||||
|
||||
if (alive _x) then {
|
||||
|
||||
_objName = _x call DZE_getModelName;
|
||||
|
||||
// Exit since we found a tree
|
||||
if (_objName in _trees) exitWith {
|
||||
_findNearestTree set [(count _findNearestTree),_x];
|
||||
|
||||
_index = _trees find _objName;
|
||||
|
||||
_itemOut = _treesOutput select _index;
|
||||
|
||||
_countOut = 1;
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
} foreach nearestObjects [getPos player, [], 20];
|
||||
|
||||
//diag_log format["DEBUG TREES: %1", _findNearestTree];
|
||||
|
||||
if (count(_findNearestTree) >= 1) then {
|
||||
|
||||
_tree = _findNearestTree select 0;
|
||||
|
||||
// Start chop tree loop
|
||||
_isOk = true;
|
||||
_proceed = false;
|
||||
while {_isOk} do {
|
||||
|
||||
player playActionNow "Medic";
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
_finished = 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;
|
||||
[player,"chopwood",0,false] call dayz_zombieSpeak;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
|
||||
sleep 0.1;
|
||||
|
||||
};
|
||||
|
||||
if(!_finished) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = false;
|
||||
};
|
||||
|
||||
if(_finished) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_proceed) then {
|
||||
|
||||
for "_x" from 1 to _countOut do {
|
||||
player addMagazine _itemOut;
|
||||
};
|
||||
|
||||
// chop down tree
|
||||
if("" == typeOf _tree) then {
|
||||
_tree setDamage 1;
|
||||
};
|
||||
//diag_log format["DEBUG TREE DAMAGE: %1", _tree];
|
||||
|
||||
cutText [format["%1 of %2 has been successfully added to your inventory.", _countOut,_itemOut], "PLAIN DOWN"];
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
if (vehicle player == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
cutText ["Canceled Harvesting.", "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
cutText [localize "str_player_23", "PLAIN DOWN"];
|
||||
};
|
||||
TradeInprogress = false;
|
||||
@@ -17,7 +17,7 @@ hintSilent parseText format ["
|
||||
(player getVariable['humanKills', 0]),
|
||||
(player getVariable['banditKills', 0]),
|
||||
(player getVariable['humanity', 0]),
|
||||
(dayz_skilllevel)
|
||||
(dayz_Survived)
|
||||
];
|
||||
|
||||
/*
|
||||
|
||||
@@ -39,7 +39,7 @@ if(_removed == _countIn) then {
|
||||
_textRemoved = getText(configFile >> "CfgMagazines" >> _selected >> "displayName");
|
||||
|
||||
// add failure rate based on skill level variable (days alive)
|
||||
_chanceToFail = (((random 1) + (dayz_skilllevel/100)) > 0.5);
|
||||
_chanceToFail = (((random 1) + (dayz_Survived/100)) > 0.5);
|
||||
|
||||
if(!_chanceToFail) then {
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_co
|
||||
if(TradeInprogress) exitWith { cutText ["Already in progress." , "PLAIN DOWN"] };
|
||||
TradeInprogress = true;
|
||||
|
||||
player removeAction s_player_towing;
|
||||
s_player_towing = 1;
|
||||
|
||||
// Tow Truck
|
||||
_towTruck = _this select 3;
|
||||
_towTruckSize = (sizeOf typeOf _towTruck);
|
||||
@@ -10,7 +13,7 @@ _towTruckSize = (sizeOf typeOf _towTruck);
|
||||
_allowedSize = _towTruckSize-(_towTruckSize/3);
|
||||
|
||||
// Get all nearby vehicles within 10m
|
||||
_findNearestVehicles = nearestObjects [_towTruck, ["Car"], 10];
|
||||
_findNearestVehicles = nearestObjects [_towTruck, ["Car","Motorcycle"], 10];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
if (alive _x and _towTruck != _x and (sizeOf typeOf _x) <= _allowedSize) then {
|
||||
@@ -92,4 +95,5 @@ if(_IsNearVehicle >= 1) then {
|
||||
} else {
|
||||
cutText ["No Vehicles Nearby.", "PLAIN DOWN"];
|
||||
};
|
||||
TradeInprogress = false;
|
||||
TradeInprogress = false;
|
||||
s_player_towing = -1;
|
||||
@@ -3,6 +3,9 @@ private ["_vehicle","_started","_finished","_animState","_isMedic","_configVeh",
|
||||
if(TradeInprogress) exitWith { cutText ["Already in progress." , "PLAIN DOWN"] };
|
||||
TradeInprogress = true;
|
||||
|
||||
player removeAction s_player_towing;
|
||||
s_player_towing = 1;
|
||||
|
||||
// Tow Truck
|
||||
_towTruck = _this select 3;
|
||||
|
||||
@@ -11,61 +14,67 @@ _inTow = _towTruck getVariable ["DZEinTow", false];
|
||||
|
||||
if(_inTow) then {
|
||||
|
||||
// select the nearest one
|
||||
_vehicle = _towTruck getVariable ["DZEvehicleInTow", false];
|
||||
// select vehicl in tow
|
||||
_vehicle = _towTruck getVariable ["DZEvehicleInTow", objNull];
|
||||
|
||||
// Static vehicle fuel information
|
||||
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
|
||||
_nameText = getText(_configVeh >> "displayName");
|
||||
if(!(isNull _towTruck)) then {
|
||||
|
||||
// alert zombies
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
// Static vehicle fuel information
|
||||
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
|
||||
_nameText = getText(_configVeh >> "displayName");
|
||||
|
||||
_finished = false;
|
||||
// alert zombies
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
// force animation
|
||||
player playActionNow "Medic";
|
||||
_finished = false;
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
// force animation
|
||||
player playActionNow "Medic";
|
||||
|
||||
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";
|
||||
_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 {
|
||||
if(!_finished) then {
|
||||
r_interrupt = false;
|
||||
|
||||
if (vehicle player == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
};
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
detach _vehicle;
|
||||
detach _vehicle;
|
||||
_towTruck setVariable ["DZEinTow", false, true];
|
||||
_towTruck setVariable ["DZEvehicleInTow", objNull, true];
|
||||
cutText [format["%1 has been detached from Tow Truck.",_nameText], "PLAIN DOWN"];
|
||||
};
|
||||
} else {
|
||||
_towTruck setVariable ["DZEinTow", false, true];
|
||||
_towTruck setVariable ["DZEvehicleInTow", objNull, true];
|
||||
cutText [format["%1 has been detached from Tow Truck.",_nameText], "PLAIN DOWN"];
|
||||
_towTruck setVariable ["DZEvehicleInTow", objNull, true];
|
||||
};
|
||||
|
||||
} else {
|
||||
cutText ["No Vehicles In Tow.", "PLAIN DOWN"];
|
||||
};
|
||||
TradeInprogress = false;
|
||||
TradeInprogress = false;
|
||||
s_player_towing = -1;
|
||||
Reference in New Issue
Block a user