This commit is contained in:
Aaron Clark
2012-11-04 20:28:50 -06:00
commit 76e9a0582e
1049 changed files with 94406 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
private["_location","_isOk","_dir","_classname","_item"];
_location = player modeltoworld [0,1,0];
_location set [2,0];
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater _location) or dayz_isSwimming;
if(_isWater) exitWith {cutText [localize "str_player_26", "PLAIN DOWN"];};
if(_onLadder) exitWith {cutText [localize "str_player_21", "PLAIN DOWN"];};
if (vehicle player != player) exitWith {cutText ["You may not build while in a vehicle", "PLAIN DOWN"]};
_item = _this;
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]};
_dir = getDir player;
player removeMagazine _item;
player playActionNow "Medic";
sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
player allowDamage false;
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
player reveal _object;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname];
publicVariable "dayzPublishObj";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
sleep 2;
player allowDamage true;

View File

@@ -0,0 +1,36 @@
private["_hasFoodMeat","_hasFoodTin","_item","_wait"];
player removeAction s_player_cook;
s_player_cook = -1;
_qty = {_x == "FoodSteakRaw"} count magazines player;
_wait = 5 - _qty;
if ("FoodSteakRaw" in magazines player) then {
player playActionNow "Medic";
[player,"cook",0,false] call dayz_zombieSpeak;
_id = [player,70,true,(getPosATL player)] spawn player_alertZombies;
sleep _wait;
for "_x" from 1 to _qty do {
_hasFoodMeat = "FoodSteakRaw" in magazines player;
if (!_hasFoodMeat) exitWith {cutText [format[(localize "str_player_31"),_text,"cook"] , "PLAIN DOWN"]};
player removeMagazine "FoodSteakRaw";
player addMagazine "FoodSteakCooked";
sleep 1;
};
cutText [format[(localize "str_success_cooked"),_qty,(localize "STR_EQUIP_NAME_24")], "PLAIN DOWN"];
};
/*
_hasFoodMeat = "FoodSteakRaw" in magazines player;
_qty = {_x == "ItemWaterbottleUnfilled"} count magazines player;
if (_hasFoodMeat) then {
player removeMagazine "FoodSteakRaw";
player playActionNow "Medic";
[player,"eat",0,false] call dayz_zombieSpeak;
sleep 6;
player addMagazine "FoodSteakCooked";
cutText [localize "str_success_cooked_steak", "PLAIN DOWN"];
};
*/

View File

@@ -0,0 +1,9 @@
_array = _this select 3;
_object = _array select 0;
_inventory = _array select 1;
player playActionNow "Medic";
sleep 8;
{player addMagazine _x} forEach _inventory;
deleteVehicle _object;
r_action = false;
call fnc_usec_medic_removeActions;

View File

@@ -0,0 +1,21 @@
_dog = _this select 0;
_array = _this select 3;
_handle = _array select 0;
_type = _array select 1;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
player playActionNow "PutDown";
switch (_type) do {
case 0: {
player removeMagazine "FoodSteakRaw";
_handle setFSMVariable ["_hunger",0];
};
case 1: {
player removeMagazine "ItemWaterbottle";
player addMagazine "ItemWaterbottleUnfilled";
_handle setFSMVariable ["_hunger",0];
};
};

View File

@@ -0,0 +1,13 @@
_dog = _this select 0;
_array = _this select 3;
_handle = _array select 0;
_whistle = _array select 1;
if(_whistle) then {
[nil,player,rSAY,["dog_callBack", 120]] call RE;
};
sleep 1;
_handle setFSMVariable ["_command","none"];

View File

@@ -0,0 +1,19 @@
_dog = _this select 0;
_dog playActionNow "GestureBark";
[_dog,"dog_bark",0,false] call dayz_zombieSpeak;
/*
_anim = animationState _dog;
_sitDown = false;
if(_anim == "Dog_SitDown") then {
[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
sleep 1;
_sitDown = true;
};
[objNull, _dog, rSwitchMove,"Dog_StopV2"] call RE;
if (_sitDown) then {
waitUntil{(animationState _dog) != "Dog_StopV2"};
[objNull, _dog, rSwitchMove,"Dog_SitDown"] call RE;
};
*/

View File

@@ -0,0 +1,33 @@
//_dog = _this select 0;
_array = _this select 3;
_handle = _array select 0;
_whistle = _array select 1;
_forceWalk = _array select 2;
_dog = _handle getFSMVariable "_dog";
_maxSpeed = _handle getFSMVariable "_maxSpeed";
if(player distance _dog < 5) then {
_whistle = false;
};
if(_forceWalk) then {
_maxSpeed = _maxSpeed - 1;
if (_maxSpeed < 0) then {
_maxSpeed = 0;
};
if(_whistle) then {
[nil,player,rSAY,["dog_slowDown", 120]] call RE;
};
} else {
_maxSpeed = _maxSpeed + 1;
if (_maxSpeed > 2) then {
_maxSpeed = 2;
};
if(_whistle) then {
[nil,player,rSAY,["dog_speedUp", 120]] call RE;
};
};
_handle setFSMVariable ["_maxSpeed",_maxSpeed];
_handle setFSMVariable ["_forceChange",true];

View File

@@ -0,0 +1,12 @@
_dog = _this select 0;
_handle = _this select 3;
_standing = _handle getFSMVariable "_standing";
_handle setFSMVariable ["_command","stay"];
_watchDog = _handle getFSMVariable "_watchDog";
_anim = animationState _dog;
if (_anim == "Dog_SitDown" and _watchDog) then {
[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
sleep 0.5;
[objNull, _dog, rSwitchMove,"Dog_LieDown"] call RE;
};

View File

@@ -0,0 +1,8 @@
_array = _this select 3;
_handle = _array;
//_target = _array select 1;
_target = target1;
_handle setFSMVariable ["_command","track"];
_handle setFSMVariable ["_target",_target];

View File

@@ -0,0 +1,40 @@
_dog = _this select 0;
_array = _this select 3;
_handle = _array select 0;
_watchDog = _array select 1;
_handle setFSMVariable ["_watchDog",_watchDog];
_actionWarn = _handle getFSMVariable "_actionWarn";
_actionDir = _handle getFSMVariable "_actionDir";
_dog removeAction _actionWarn;
if (_watchDog) then {
_actionWarn = _dog addAction ["Quiet",_actionDir + "warn.sqf",[_handle,false], 2, false, true];
_handle setFSMVariable ["_actionWarn",_actionWarn];
_handle setFSMVariable ["_idleTime",5];
while {_watchDog and alive _dog} do {
_watchDog = _handle getFSMVariable "_watchDog";
_senseSkill = _handle getFSMVariable "_senseSkill";
if (_watchDog) then {
_nearby = (getPosATL _dog) nearEntities ["CAManBase",_senseSkill];
_nearby = _nearby - [player];
if (count _nearby > 0) then {
//_chance = (3 - (count _nearby));
//hintSilent str(_chance);
[_dog,"dog_growl",2,false] call dayz_zombieSpeak;
} else {
/*
_nearby = (getPosATL _dog) nearEntities ["CAAnimalBase",_senseSkill];
_nearby = _nearby - [_dog];
[_dog,"dog_bark",1,false] call dayz_zombieSpeak;
*/
};
};
sleep 2;
};
} else {
_actionWarn = _dog addAction ["Alert",_actionDir + "warn.sqf",[_handle,true], 2, false, true];
_handle setFSMVariable ["_actionWarn",_actionWarn];
_handle setFSMVariable ["_idleTime",1];
};

View File

@@ -0,0 +1,14 @@
_array = _this select 3;
_location = player modeltoworld [0,0.5,0];
_dir = (getDir player) + 180;
_classname = _array select 0;
_magazine = _array select 1;
player removeMagazine _magazine;
player playActionNow "Medic";
call fnc_usec_engineer_removeActions;
r_action_engineer = false;
sleep 8;
_weapon = _classname createVehicle _location;
_weapon setDir _dir;
_weapon setpos _location;
player reveal _weapon;

View File

@@ -0,0 +1,23 @@
_array = _this select 3;
_object = _array select 0;
_magazine = _array select 1;
_classname = _array select 2;
_dir = direction _object;
_location = getPosATL _object;
player removeMagazine _magazine;
player playActionNow "Medic";
r_action = false;
call fnc_usec_medic_removeActions;
sleep 8;
//Delete old Object
deleteVehicle _object;
//New Object
_weapon = _classname createVehicle _location;
_weapon setDir _dir;
_weapon setpos _location;
player reveal _weapon;

View File

@@ -0,0 +1,17 @@
private["_location","_isOk","_dir","_classname"];
_location = player modeltoworld [0,1,0];
_location set [2,0];
_isOk = count (_location isFlatEmpty [0.5,0,0,4,0,false,player]) > 0;
if (_isOk) then {
_dir = getDir player;
_classname = "Land_Fire";
player playActionNow "Medic";
sleep 6;
dayz_hasFire = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
dayz_hasFire setDir _dir;
player reveal dayz_hasFire;
cutText [localize "str_fireplace_01", "PLAIN DOWN"];
} else {
cutText [localize "str_fireplace_02", "PLAIN DOWN"];
};

View File

@@ -0,0 +1,11 @@
private["_obj"];
_obj = _this select 3;
player playActionNow "Medic";
sleep 6;
if(_obj isKindOf "Land_fire") then {
dayz_hasFire = objNull;
deleteVehicle _obj;
};
cutText [localize "str_fireplace_removed", "PLAIN DOWN"];
player removeAction s_player_fireout;
s_player_fireout = -1;

View File

@@ -0,0 +1,8 @@
private["_flare"];
_flare = _this select 3;
player removeAction s_player_dropflare;
detach _flare;
s_player_grabflare = -1;
s_player_removeflare = -1;
_flare setVariable ["owner",objNull,true];
dayz_hasLight = false;

View File

@@ -0,0 +1,25 @@
private["_flare"];
_flare = _this select 3;
player playActionNow "PutDown";
sleep 2;
_flare attachTo [player,[0,0,0],"granat2"];
[_flare, -90, -10] call object_setpitchbank;
_flare setPos (getPos _flare);
_flare setVariable ["owner",player,true];
player removeAction s_player_grabflare;
player removeAction s_player_removeflare;
dayz_hasLight = true;
//Add Drop Action
_text = getText (configFile >> "CfgAmmo" >> (typeOf _flare) >> "displayName");
s_player_dropflare = player addAction [format[localize "str_actions_medical_16",_text], "\z\addons\dayz_code\actions\flare_drop.sqf",_flare, 1, false, true, "", ""];
while {(alive _flare) and dayz_hasLight} do {
sleep 0.1;
};
if (dayz_hasLight) then {
dayz_hasLight = false;
player removeAction s_player_dropflare;
s_player_grabflare = -1;
s_player_removeflare = -1;
};

View File

@@ -0,0 +1,7 @@
private["_flare"];
_flare = _this select 3;
deleteVehicle _flare;
player removeAction s_player_grabflare;
player removeAction s_player_removeflare;
s_player_grabflare = -1;
s_player_removeflare = -1;

View File

@@ -0,0 +1,7 @@
private["_object"];
dayzUpdateVehicle = [_this select 3,"all"];
publicVariable "dayzUpdateVehicle";
if (isServer) then {
dayzUpdateVehicle call server_updateObject;
};

View File

@@ -0,0 +1,40 @@
private["_hasKnife","_qty","_item","_text","_string","_type","_loop","_meat","_timer"];
_item = _this select 3;
_hasKnife = "ItemKnife" in items player;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
player removeAction s_player_butcher;
s_player_butcher = -1;
if (_hasKnife and !_hasHarvested) then {
//Get Animal Type
_loop = true;
_isListed = isClass (_config);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
player playActionNow "Medic";
[player,"gut",0,false] call dayz_zombieSpeak;
_item setVariable["meatHarvested",true,true];
_qty = 1;
if (_isListed) then {
_qty = getNumber (_config >> "yield");
};
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
_array = [_item,_qty];
if (local _item) then {
_array spawn local_gutObject;
} else {
dayzGutBody = _array;
publicVariable "dayzGutBody";
};
sleep 6;
_string = format[localize "str_success_gutted_animal",_text,_qty];
cutText [_string, "PLAIN DOWN"];
};

View File

@@ -0,0 +1,17 @@
private["_hasFood","_item","_text","_qty"];
player removeAction s_player_fillfuel;
s_player_fillfuel = -1;
_qty = {_x == "ItemJerrycanEmpty"} count magazines player;
if ("ItemJerrycanEmpty" in magazines player) then {
for "_x" from 1 to _qty do {
player removeMagazine "ItemJerrycanEmpty";
player addMagazine "ItemJerrycan";
};
[player,"refuel",0,false] call dayz_zombieSpeak;
cutText [format[(localize "str_player_09"),_qty], "PLAIN DOWN"];
} else {
cutText [(localize "str_player_10") , "PLAIN DOWN"];
};

View File

@@ -0,0 +1,60 @@
private["_array","_type","_classname","_holder","_config","_isOk","_muzzles","_playerID","_claimedBy","_text"];
_array = _this select 3;
_type = _array select 0;
_classname = _array select 1;
_holder = _array select 2;
_playerID = getPlayerUID player;
_text = getText (configFile >> _type >> _classname >> "displayName");
_holder setVariable["claimed",_playerID,true];
player playActionNow "PutDown";
if (_classname == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
} else {
if (_classname == "MeleeHatchet") then {
player addMagazine 'hatchet_swing';
};
};
sleep 0.25;
_claimedBy = _holder getVariable["claimed",0];
if (_claimedBy != _playerID) exitWith {cutText [format[(localize "str_player_beinglooted"),_text] , "PLAIN DOWN"]};
if(_classname isKindOf "Bag_Base_EP1") then {
diag_log("Picked up a bag: " + _classname);
};
_config = (configFile >> _type >> _classname);
_isOk = [player,_config] call BIS_fnc_invAdd;
if (_isOk) then {
deleteVehicle _holder;
/*
if (_classname in ["MeleeHatchet","MeleeCrowbar"]) then {
if (_type == "cfgWeapons") then {
_muzzles = getArray(configFile >> "cfgWeapons" >> _classname >> "muzzles");
//_wtype = ((weapons player) select 0);
if (count _muzzles > 1) then {
player selectWeapon (_muzzles select 0);
} else {
player selectWeapon _classname;
};
};
};
*/
} else {
_holder setVariable["claimed",0,true];
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];
if (_classname == "MeleeCrowbar") then {
player removeMagazine 'crowbar_swing';
} else {
if (_classname == "MeleeHatchet") then {
player removeMagazine 'hatchet_swing';
};
};
};

View File

@@ -0,0 +1,9 @@
_array = _this select 3;
_object = _array select 0;
_type = TypeOf(_object);
player playActionNow "Medic";
sleep 8;
player addBackpack format["%1_US_Bag_EP1",_type];
deleteVehicle _object;
r_action = false;
call fnc_usec_medic_removeActions;

View File

@@ -0,0 +1,60 @@
private["_item","_config","_onLadder","_create","_isOk","_config2","_consume"];
_item = _this;
_config = configFile >> "CfgWeapons" >> _item;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
_hastoolweapon = _this in weapons player;
_text = getText (_config >> "displayName");
if (!_hastoolweapon) exitWith {cutText [format[(localize "str_player_30"),_text] , "PLAIN DOWN"]};
call gear_ui_init;
//Add new item
_create = getArray (_config >> "ItemActions" >> "Toolbelt" >> "output") select 0;
_config2 = configFile >> "CfgWeapons" >> _create;
//Remove magazines if needed
if (_item in ["MeleeHatchet","MeleeCrowbar"]) then {
_magType = ([] + getArray (configFile >> "CfgWeapons" >> _item >> "magazines")) select 0;
_meleeNum = ({_x == _magType} count magazines player);
for "_i" from 1 to _meleeNum do {
player removeMagazine _magType;
};
};
_isOk = [player,_config2] call BIS_fnc_invAdd;
if (_isOk) then {
//Remove item
player removeWeapon _item;
//Add magazines if needed
if (_create in ["MeleeHatchet","MeleeCrowbar"]) then {
if (_create == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
} else {
player addMagazine 'hatchet_swing';
};
if (_type == "cfgWeapons") then {
_muzzles = getArray(configFile >> "cfgWeapons" >> _create >> "muzzles");
_wtype = ((weapons player) select 0);
if (count _muzzles > 1) then {
player selectWeapon (_muzzles select 0);
} else {
player selectWeapon _wtype;
};
};
};
} else {
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];
//Add magazines back
if (_item in ["MeleeHatchet","MeleeCrowbar"]) then {
if (_item == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
} else {
player addMagazine 'hatchet_swing';
};
};
};

View File

@@ -0,0 +1,43 @@
private["_location","_isOk","_dir","_classname","_item"];
_location = player modeltoworld [0,1,0];
_location set [2,0];
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater _location) or dayz_isSwimming;
call gear_ui_init;
if(_isWater) exitWith {cutText [localize "str_player_26", "PLAIN DOWN"];};
if(_onLadder) exitWith {cutText [localize "str_player_21", "PLAIN DOWN"];};
_item = _this;
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]};
_dir = getDir player;
player removeMagazine _item;
player playActionNow "Medic";
sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
player allowDamage false;
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
player reveal _object;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname];
publicVariable "dayzPublishObj";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
sleep 2;
player allowDamage true;

View File

@@ -0,0 +1,15 @@
private["_location","_isOk","_dir","_classname"];
private["_item"];
_item = _this;
call gear_ui_init;
if (["forest",dayz_surfaceType] call fnc_inString) then {
_result = [player,"PartWoodPile"] call BIS_fnc_invAdd;
if (_result) then {
cutText [localize "str_player_25", "PLAIN DOWN"];
} else {
cutText [localize "str_player_24", "PLAIN DOWN"];
};
} else {
cutText [localize "str_player_23", "PLAIN DOWN"];
};

View File

@@ -0,0 +1,55 @@
/*
count player magazines with ammo count
value = call player_countmagazines;
return all player magazines with ammo count
*/
private ["_dialog","_control","_magazineArray","_item","_val","_max","_created"];
disableSerialization;
disableUserInput true;
_dialog = findDisplay 106;
_created = false;
if ( isNull _dialog ) then {
startLoadingScreen [""];
createGearDialog [player, "RscDisplayGear"];
_dialog = findDisplay 106;
_created = true;
};
_magazineArray = [];
for "_i" from 109 to 120 do
{
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
_magazineArray set [count _magazineArray,[_item,_val]];
} else {
_magazineArray set [count _magazineArray,_item];
};
};
};
for "_i" from 122 to 129 do
{
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
_magazineArray set [count _magazineArray,[_item,_val]];
} else {
_magazineArray set [count _magazineArray,_item];
};
};
};
if ( _created ) then {
closeDialog 0;
endLoadingScreen;
};
disableUserInput false;
dayz_Magazines=_magazineArray;
_magazineArray

View File

@@ -0,0 +1,45 @@
private["_hasFood","_item","_text","_key","_config","_sfx"];
disableserialization;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
if (vehicle player != player) exitWith {cutText ["You may not drink while in a vehicle", "PLAIN DOWN"]};
_item = _this;
_hasdrinkitem = _this in magazines player;
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
_sfx = getText (_config >> "sfx");
if (!_hasdrinkitem) exitWith {cutText [format[(localize "str_player_31"),_text,"drink"] , "PLAIN DOWN"]};
player playActionNow "PutDown";
player removeMagazine _item;
sleep 1;
[player,_sfx,0,false] call dayz_zombieSpeak;
if (_item == "ItemWaterbottle") then {
player addMagazine "ItemWaterbottleUnfilled";
};
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
/*
_update = player getVariable["updatePlayer",[false,false,false,false,false]];
_update set [4,true];
player setVariable["updatePlayer",_update,true];
*/
_id = [player,20,true,(getPosATL player)] spawn player_alertZombies;
dayz_lastDrink = time;
dayz_thirst = 0;
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1302;
_control ctrlShow true;
cutText [format[(localize "str_player_consumed"),_text], "PLAIN DOWN"];

View File

@@ -0,0 +1,21 @@
private["_item"];
_item = _this;
_config = configFile >> "CfgWeapons" >> _item;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
call gear_ui_init;
_consume = ([] + getArray (_config >> "magazines")) select 0;
_meleeNum = ({_x == _consume} count magazines player);
for "_i" from 1 to _meleeNum do {
player removeMagazine _consume;
};
player removeWeapon _item;
_bag = createVehicle [format["WeaponHolder_%1",_item],getPosATL player,[], 0, "CAN_COLLIDE"];
_bag setdir (getDir player);
player reveal _bag;

View File

@@ -0,0 +1,57 @@
private["_hasFood","_item","_text","_key"];
disableserialization;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
if (vehicle player != player) exitWith {cutText ["You may not eat while in a vehicle", "PLAIN DOWN"]};
_item = _this;
_hasfoodmag = _this in magazines player;
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
_regen = getNumber (_config >> "bloodRegen");
if (!_hasfoodmag) exitWith {cutText [format[(localize "str_player_31"),_text,"consume"] , "PLAIN DOWN"]};
player playActionNow "PutDown";
player removeMagazine _item;
sleep 1;
r_player_blood = r_player_blood + _regen;
if (r_player_blood > r_player_bloodTotal) then {
r_player_blood = r_player_bloodTotal;
};
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
player setVariable["USEC_BloodQty",r_player_blood,true];
player setVariable["medForceUpdate",true];
[player,"eat",0,false] call dayz_zombieSpeak;
/*
_update = player getVariable["updatePlayer",[false,false,false,false,false]];
_update set [3,true];
player setVariable["updatePlayer",_update,true];
*/
dayzPlayerSave = player;
publicVariable "dayzPlayerSave";
if (isServer) then {
dayzPlayerSave call server_updatePlayer;
};
dayz_lastMeal = time;
dayz_hunger = 0;
_id = [player,20,true,(getPosATL player)] spawn player_alertZombies;
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1301;
_control ctrlShow true;
_bloodVal = r_player_blood / r_player_bloodTotal;
if (_bloodVal >= 0.2) then {
_ctrlBlood ctrlShow true;
};
cutText [format[(localize "str_player_consumed"),_text], "PLAIN DOWN"];

View File

@@ -0,0 +1,29 @@
private["_location","_isOk","_dir","_classname"];
_location = player modeltoworld [0,0.3,0];
if ((_location select 2) < 0) then {
_location set [2,0];
};
//_location set [2,0];
_isOk = true; //count (_location isFlatEmpty [0.3,0,0,4,0,false,player]) > 0;
_hasWood = "PartWoodPile" in magazines player;
if (_hasWood) then {
if (_isOk) then {
player removeMagazine "PartWoodPile";
_dir = getDir player;
_classname = "Land_Fire_DZ";
player playActionNow "Medic";
sleep 6;
_fire = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_fire setDir _dir;
player reveal _fire;
_id = _fire spawn player_fireMonitor;
cutText [localize "str_fireplace_01", "PLAIN DOWN"];
} else {
cutText [localize "str_fireplace_02", "PLAIN DOWN"];
};
} else {
cutText [localize "str_player_22", "PLAIN DOWN"];
};

View File

@@ -0,0 +1,44 @@
private["_item"];
disableSerialization;
_item = _this;
_config = configFile >> "CfgMagazines" >> _item;
_consume = getArray (_config >> "ItemActions" >> "ReloadMag" >> "use");
_create = getArray (_config >> "ItemActions" >> "ReloadMag" >> "output");
_textConsume = getText(configFile >> "CfgMagazines" >> (_consume select 0) >> "displayName");
_textCreate = getText(configFile >> "CfgMagazines" >> (_create select 0) >> "displayName");
//_qtyConsume = getText(configFile >> "CfgMagazines" >> (_consume select 0) >> "count");
//_qtyCreate = getText(configFile >> "CfgMagazines" >> (_create select 0) >> "count");
_amountNeed = count _consume;
_amountHas = {_x == (_consume select 0)} count magazines player;
_amountMake = count _create;
_qty = 0;
if (_amountNeed == 1 and _amountMake == 1) then {
_control = uiNamespace getVariable 'uiControl';
_qty = gearSlotAmmoCount _control;
};
_hasInput = (_amountNeed <= _amountHas);
player playActionNow "PutDown";
if (_hasInput) then {
//Take Items
{
player removeMagazine _x;
} forEach _consume;
sleep 1;
//Give Items
{
if (_qty > 0) then {
player addMagazine [_x,_qty];
} else {
player addMagazine _x;
};
} forEach _create;
cutText [format[(localize "str_player_29"),_amountMake,_textCreate], "PLAIN DOWN"];
} else {
cutText [format[(localize "str_player_28"),_amountNeed,_textConsume], "PLAIN DOWN"];
};

View File

@@ -0,0 +1,28 @@
private["_item"];
_item = _this;
_config = configFile >> "CfgWeapons" >> _item;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
call gear_ui_init;
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_consume = ([] + getArray (_config >> "magazines")) select 0;
_hastrapitem = _this in magazines player;
if (!_hastrapitem) exitWith {cutText [format[(localize "str_player_31"),_text,"place"] , "PLAIN DOWN"]};
player removeMagazine _item;
_location = getPosATL player;
player playActionNow "PutDown";
sleep 1;
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
player reveal _object;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];

View File

@@ -0,0 +1,32 @@
private["_item"];
_item = _this;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
_hasmeditem = _this in magazines player;
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hasmeditem) exitWith {cutText [format[(localize "str_player_31"),_text,"use"] , "PLAIN DOWN"]};
switch (_item) do {
case "ItemBandage": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\bandage.sqf";
};
case "ItemMorphine": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\morphine.sqf";
};
case "ItemPainkiller": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\painkiller.sqf";
};
case "ItemAntibiotic": {
_id = [0,0,0,[player]] execVM "\z\addons\dayz_code\medical\antibiotics.sqf";
};
case "ItemHeatPack": {
player removeMagazine "ItemHeatPack";
dayz_temperatur = (dayz_temperatur + 5) max dayz_temperaturmax;
cutText [localize "str_player_27", "PLAIN DOWN"];
};
};

View File

@@ -0,0 +1,73 @@
private["_item","_isFemale","_itemNew","_item","_onLadder"];
_item = _this;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
_hasclothesitem = _this in magazines player;
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hasclothesitem) exitWith {cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};
if (vehicle player != player) exitWith {cutText ["You may not change clothes while in a vehicle", "PLAIN DOWN"]};
_isFemale = ((typeOf player == "SurvivorW2_DZ")||(typeOf player == "BanditW1_DZ"));
if (_isFemale) then {
if (_item != "Skin_Survivor2_DZ") exitWith {cutText ["Currently Female Characters cannot change to this skin. This will change in a future update.", "PLAIN DOWN"]};
};
_myModel = (typeOf player);
_itemNew = "Skin_Survivor2_DZ";
player removeMagazine _item;
_humanity = player getVariable ["humanity",0];
switch (_item) do {
case "Skin_Sniper1_DZ": {
_itemNew = "Skin_" + _myModel;
[dayz_playerUID,dayz_characterID,"Sniper1_DZ"] spawn player_humanityMorph;
};
case "Skin_Camo1_DZ": {
_itemNew = "Skin_" + _myModel;
[dayz_playerUID,dayz_characterID,"Camo1_DZ"] spawn player_humanityMorph;
};
case "Skin_Rocket_DZ": {
_itemNew = "Skin_" + _myModel;
[dayz_playerUID,dayz_characterID,"Rocket_DZ"] spawn player_humanityMorph;
};
case "Skin_Survivor2_DZ": {
_model = "Survivor2_DZ";
if (_isFemale) then {
_model = "SurvivorW2_DZ";
};
if (_humanity < -2000) then {
_model = "Bandit1_DZ";
if (_isFemale) then {
_model = "BanditW1_DZ";
};
};
if (_humanity > 5000) then {
_model = "Survivor3_DZ";
if (_isFemale) then {
_model = "SurvivorW2_DZ";
};
};
if (_model != _myModel) then {
[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
};
case "Skin_Soldier1_DZ": {
_itemNew = "Skin_" + _myModel;
[dayz_playerUID,dayz_characterID,"Soldier1_DZ"] spawn player_humanityMorph;
};
};
_config = configFile >> "CfgMagazines" >> _itemNew;
_isClass = isClass (_config);
if (_isClass) then {
player addMagazine _itemNew;
};
player setVariable ["humanity",_humanity,true];

View File

@@ -0,0 +1,31 @@
private["_vehicle","_curFuel","_newFuel","_timeLeft"];
_vehicle = cursorTarget;
_canSize = getNumber(configFile >> "cfgMagazines" >> "ItemJerrycan" >> "fuelQuantity");
_configVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicle);
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameType = getText(_configVeh >> "displayName");
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel + _canSize);
if (_newFuel > _capacity) then {_newFuel = _capacity};
_newFuel = (_newFuel / _capacity);
player removeMagazine "ItemJerrycan";
player addMagazine "ItemJerrycanEmpty";
player playActionNow "Medic";
[player,"refuel",0,false] call dayz_zombieSpeak;
_id = [player,20,true,(getPosATL player)] spawn player_alertZombies;
sleep 6;
dayzSetFuel = [_vehicle,_newFuel];
dayzSetFuel spawn local_sefFuel;
publicVariable "dayzSetFuel";
cutText [format[localize "str_player_05",_nameType,_canSize], "PLAIN DOWN"];
sleep 1;
call fnc_usec_medic_removeActions;
r_action = false;

View File

@@ -0,0 +1,22 @@
/*
delete object from db
parameters: _obj
*/
private["_obj","_objectID","_objectUID"];
_obj = _this select 3;
_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
player playActionNow "Medic";
sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
dayzDeleteObj = [_objectID,_objectUID];
publicVariable "dayzDeleteObj";
if (isServer) then {
dayzDeleteObj call local_deleteObj;
};
deleteVehicle _obj;

View File

@@ -0,0 +1,75 @@
private["_vehicle","_part","_hitpoint","_type","_selection","_array"];
_id = _this select 2;
_array = _this select 3;
_vehicle = _array select 0;
_part = _array select 1;
_hitpoint = _array select 2;
_type = typeOf _vehicle;
//
_hasToolbox = "ItemToolbox" in items player;
_section = _part in magazines player;
// moving this here because we need to know which part needed if we don't have it
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
if (_section and _hasToolbox) then {
_damage = [_vehicle,_hitpoint] call object_getHit;
_vehicle removeAction _id;
//dont waste loot on undamaged parts
if (_damage > 0) then {
player removeMagazine _part;
//Fix the part
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
dayzSetFix = [_vehicle,_selection,0];
publicVariable "dayzSetFix";
if (local _vehicle) then {
dayzSetFix call object_setFixServer;
};
player playActionNow "Medic";
sleep 1;
[player,"repair",0,false] call dayz_zombieSpeak;
null = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
_vehicle setvelocity [0,0,1];
//Success!
cutText [format["You have successfully attached %1 to the %2",_namePart,_nameType], "PLAIN DOWN"];
};
} else {
cutText [format["You need %1 to repair this",_namePart], "PLAIN DOWN"];
};
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = objNull;
//check if repaired fully
_hitpoints = _vehicle call vehicle_getHitpoints;
_allFixed = true;
{
_damage = [_vehicle,_x] call object_getHit;
if (_damage > 0) exitWith {
_allFixed = false;
};
} forEach _hitpoints;
//update if repaired
if (_allFixed) then {
_vehicle setDamage 0;
dayzUpdateVehicle = [_vehicle,"repair"];
if (isServer) then {
if (allowConnection) then {
dayzUpdateVehicle call server_updateObject;
};
} else {
publicVariable "dayzUpdateVehicle";
};
};

View File

@@ -0,0 +1,8 @@
private["_body","_name","_method","_methodStr"];
_body = _this select 3;
_name = _body getVariable["bodyName","unknown"];
_method = _body getVariable["deathType","unknown"];
_methodStr = localize format ["str_death_%1",_method];
cutText [format[(localize "str_player_studybody"),_name,_methodStr], "PLAIN DOWN"];

View File

@@ -0,0 +1,3 @@
private["_obj","_bag","_pos"];
_obj = _this select 3;
_obj spawn player_packTent;

View File

@@ -0,0 +1,64 @@
private["_position","_tent","_location","_isOk","_backpack","_tentType","_trg","_key"];
//check if can pitch here
call gear_ui_init;
_item = _this;
_hastentitem = _this in magazines player;
_location = player modeltoworld [0,2.5,0];
_location set [2,0];
_building = nearestObject [(vehicle player), "HouseBase"];
_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;
//_isOk = true;
diag_log ("Pitch Tent: " + str(_isok) );
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"pitch"] , "PLAIN DOWN"]};
//allowed
if (["forest",dayz_surfaceType] call fnc_inString) then { _isOk = false; diag_log ("surface forest"); };
//if (["grass",dayz_surfaceType] call fnc_inString) then { _isOk = false; diag_log ("surface grass"); };
//blocked
if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
//if (["wood",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
diag_log ("Pitch Tent Surface: " + str(_isok) );
if (!_isOk) then {
//remove tentbag
player removeMagazine _item;
_dir = round(direction player);
//wait a bit
player playActionNow "Medic";
sleep 1;
[player,"tentunpack",0,false] call dayz_zombieSpeak;
_id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
sleep 5;
//place tent (local)
_tent = createVehicle ["TentStorage", _location, [], 0, "CAN_COLLIDE"];
_tent setdir _dir;
_tent setpos _location;
player reveal _tent;
_location = getPosATL _tent;
_tent setVariable ["characterID",dayz_characterID,true];
//player setVariable ["tentUpdate",["Land_A_tent",_dir,_location,[dayz_tentWeapons,dayz_tentMagazines,dayz_tentBackpacks]],true];
dayzPublishObj = [dayz_characterID,_tent,[_dir,_location],"TentStorage"];
publicVariable "dayzPublishObj";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
cutText [localize "str_success_tent_pitch", "PLAIN DOWN"];
} else {
cutText [localize "str_fail_tent_pitch", "PLAIN DOWN"];
};

View File

@@ -0,0 +1,13 @@
_array = _this select 3;
_location = player modeltoworld [0,1,0];
_dir = getDir player;
_classname = _array select 0;
removeBackpack player;
player playActionNow "Medic";
sleep 8;
player removeAction r_player_action_bag;
r_action_bag = false;
_weapon = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_weapon setDir _dir;
//_weapon setpos _location;
player reveal _weapon;

View File

@@ -0,0 +1,65 @@
private["_hasFood","_item","_text","_qty"];
call gear_ui_init;
_playerPos = getPosATL player;
_canFill = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank","Land_Misc_Well_L_EP1","Land_Misc_Well_C_EP1"], 4] > 0;
_isPond = false;
_isWell = false;
_pondPos = [];
_objectsWell = [];
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
_hasbottleitem = _this in magazines player;
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hasbottleitem) exitWith {cutText [format[(localize "str_player_31"),_text,"fill"] , "PLAIN DOWN"]};
if (!dayz_isSwimming) then {
player playActionNow "PutDown";
};
if (!_canFill) then {
_objectsWell = nearestObjects [_playerPos, [], 4];
{
//Check for Well
_isWell = ["_well",str(_x),false] call fnc_inString;
if (_isWell) then {_canFill = true};
} forEach _objectsWell;
};
if (!_canFill) then {
_objectsPond = nearestObjects [_playerPos, [], 50];
{
//Check for pond
_isPond = ["pond",str(_x),false] call fnc_inString;
if (_isPond) then {
_pondPos = (_x worldToModel _playerPos) select 2;
if (_pondPos < 0) then {
_canFill = true;
};
};
} forEach _objectsPond;
};
if (_canFill) then {
_qty = {_x == "ItemWaterbottleUnfilled"} count magazines player;
if ("ItemWaterbottleUnfilled" in magazines player) then {
for "_x" from 1 to _qty do {
player removeMagazine "ItemWaterbottleUnfilled";
player addMagazine "ItemWaterbottle";
};
[player,"fillwater",0,false] call dayz_zombieSpeak;
_id = [player,10,true,(getPosATL player)] spawn player_alertZombies;
cutText [format[(localize "str_player_01"),_qty], "PLAIN DOWN"];
} else {
cutText [(localize "str_player_02") , "PLAIN DOWN"];
};
} else {
cutText [(localize "str_player_20") , "PLAIN DOWN"];
};