From e8606d76898fc801dc63206688ea8901102f8688 Mon Sep 17 00:00:00 2001 From: vbawol Date: Fri, 22 Mar 2013 15:32:53 -0500 Subject: [PATCH] 0.998a + Crafting now only requires a fire within 2m. + Safe should now drop items on ground when packed. + Changed humanity gains/losses based on player death so that humanity is accounted for. + Fixed broken humanity hit and freetarget with player damage since 1.7.6.1. + Potential fix for swimming in ground. + !isNull and Distance checks for player zombie "feed" option. + Added open crate option for supply crates. Requires crowbar in toolbelt. --- dayz_code/actions/player_loadCrate.sqf | 56 ++++++++++++++ dayz_code/compile/fn_selfActions.sqf | 23 ++++-- dayz_code/init/compiles.sqf | 8 +- dayz_code/system/player_monitor.fsm | 6 +- dayz_equip/config.cpp | 103 +++++++++++++++++++++++-- 5 files changed, 173 insertions(+), 23 deletions(-) create mode 100644 dayz_code/actions/player_loadCrate.sqf diff --git a/dayz_code/actions/player_loadCrate.sqf b/dayz_code/actions/player_loadCrate.sqf new file mode 100644 index 000000000..8dd416e72 --- /dev/null +++ b/dayz_code/actions/player_loadCrate.sqf @@ -0,0 +1,56 @@ +private ["_dir","_classname","_box","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool"]; + +if(TradeInprogress) exitWith { cutText ["Repair already in progress." , "PLAIN DOWN"]; }; +TradeInprogress = true; + +_hasTool = "ItemCrowbar" in items player; +if(!_hasTool) exitWith { + cutText ["You need a crowbar to open this.", "PLAIN DOWN"]; + TradeInprogress = false; +}; + +_item = _this; +_hasCrate = _item in magazines player; +if (!_hasCrate) then { + cutText ["Missing supply crate.", "PLAIN DOWN"]; + TradeInprogress = false; +}; + +_config = configFile >> "CfgMagazines" >> _item; +_create_raw = getArray (_config >> "ItemActions" >> "CreateMags" >> "output"); +_create = _create_raw select 0; +_qty = _create_raw select 1; +_type = _create_raw select 2; + +_location = player modeltoworld [0,0.3,0]; +if ((_location select 2) < 0) then { + _location set [2,0]; +}; + +player removeMagazine _item; +_dir = getDir player; +_classname = "CardboardBox"; + +// Change to optional wait to complete +player playActionNow "Medic"; +sleep 6; + +_box = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; +_box setDir _dir; + +// Fill box with Items from config. +if(_type == "magazine") then { + _box addMagazineCargoGlobal [_create,_qty]; +}; +if(_type == "weapon") then { + _box addWeaponCargoGlobal [_create,_qty]; +}; +if(_type == "backpack") then { + _box addBackpackCargoGlobal [_create,_qty]; +}; + +player reveal _box; + +cutText ["Opened supply crate.", "PLAIN DOWN"]; + +TradeInprogress = false; \ No newline at end of file diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index 9bab9b33b..c1f5c877c 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -53,6 +53,7 @@ if (_canPickLight and !dayz_hasLight and !_isPZombie) then { s_player_removeflare = -1; }; +hint str(typeOf cursorTarget); if(_isPZombie) then { //_state = animationState player; @@ -60,19 +61,25 @@ if(_isPZombie) then { if (s_player_callzombies < 0) then { s_player_callzombies = player addAction ["Raise Horde", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""]; }; + if (s_player_pzombiesattack < 0) then { s_player_pzombiesattack = player addAction ["Attack", "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf",cursorTarget, 6, true, false, "",""]; }; - _isAnimal = cursorTarget isKindOf "Animal"; - _isZombie = cursorTarget isKindOf "zZombie_base"; - _isHarvested = cursorTarget getVariable["meatHarvested",false]; - _isMan = cursorTarget isKindOf "Man"; + if (!isNull cursorTarget and (player distance cursorTarget < 3)) then { //Has some kind of target + _isAnimal = cursorTarget isKindOf "Animal"; + _isZombie = cursorTarget isKindOf "zZombie_base"; + _isHarvested = cursorTarget getVariable["meatHarvested",false]; + _isMan = cursorTarget isKindOf "Man"; - // Pzombie Gut human corpse or animal - if (!alive cursorTarget and (_isAnimal or _isMan) and !_isZombie and !_isHarvested and _canDo) then { - if (s_player_pzombiesfeed < 0) then { - s_player_pzombiesfeed = player addAction ["Feed", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""]; + // Pzombie Gut human corpse or animal + if (!alive cursorTarget and (_isAnimal or _isMan) and !_isZombie and !_isHarvested and _canDo) then { + if (s_player_pzombiesfeed < 0) then { + s_player_pzombiesfeed = player addAction ["Feed", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""]; + }; + } else { + player removeAction s_player_pzombiesfeed; + s_player_pzombiesfeed = -1; }; } else { player removeAction s_player_pzombiesfeed; diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index 1188d878f..c6c64512d 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -73,6 +73,7 @@ if (!isDedicated) then { player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf"; player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf"; player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf"; + player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf"; player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf"; player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf"; player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf"; @@ -236,11 +237,8 @@ if (!isDedicated) then { if (_dikCode in (actionKeys "GetOver")) then { if (player isKindOf "PZombie_VB") exitWith { - //player action ["sitDown", player]; - player switchAction "sitDown"; - //player playMoveNow "ZombieStandingAttack1"; - //player switchMove "AmovPercMstpSnonWnonDnon"; - diag_log "Saved player zombie from animation lockup?"; + [objNull, player, rSwitchMove,""] call RE; + player playActionNow "stop"; }; if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then { _inBuilding = [player] call fnc_isInsideBuilding; diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index 757f2d756..304376d03 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -36,7 +36,7 @@ item31[] = {"ERROR__Bad_Versi",2,250,175.000000,650.000000,275.000000,700.000000 item32[] = {"Display_Ready",4,218,-175.000000,900.000000,-75.000000,950.000000,0.000000,"Display" \n "Ready"}; item33[] = {"Preload_Display",2,250,-75.000000,950.000000,25.000000,1000.000000,0.000000,"Preload" \n "Display"}; item34[] = {"Preload_Done",4,218,-175.000000,1000.000000,-75.000000,1050.000000,0.000000,"Preload" \n "Done"}; -item35[] = {"Initialize",2,250,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; +item35[] = {"Initialize",2,4346,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; item36[] = {"Finish",1,250,-75.000000,1150.000000,25.000000,1200.000000,0.000000,"Finish"}; item37[] = {"True",8,218,25.000000,1100.000000,125.000000,1150.000000,0.000000,"True"}; item38[] = {"Too_Long",4,218,300.000000,150.000000,400.000000,200.000000,0.000000,"Too" \n "Long"}; @@ -119,8 +119,8 @@ link59[] = {51,52}; link60[] = {52,29}; link61[] = {53,54}; link62[] = {54,20}; -globals[] = {25.000000,1,0,0,0,640,480,1,85,6316128,1,-442.430725,330.314087,740.948608,133.929596,1062,880,1}; -window[] = {2,-1,-1,-1,-1,760,137,1108,0,3,1080}; +globals[] = {25.000000,1,0,0,0,640,480,1,85,6316128,1,-442.430725,330.314087,1379.589600,739.273743,1062,880,1}; +window[] = {2,-1,-1,-1,-1,890,130,1101,130,3,1080}; *//*%FSM*/ class FSM { diff --git a/dayz_equip/config.cpp b/dayz_equip/config.cpp index cd6628824..b54eb5cdd 100644 --- a/dayz_equip/config.cpp +++ b/dayz_equip/config.cpp @@ -915,19 +915,15 @@ class CfgMagazines text = "Load %1"; script = "spawn player_loadMag;"; outputOriented = "true"; - output[] = {"20Rnd_556x45_Stanag","cfgMagazines"}; + output[] = {"30Rnd_556x45_Stanag",10,"cfgMagazines"}; }; class CreateMag2: CreateMag1 { - output[] = {"30Rnd_556x45_Stanag","cfgMagazines"}; + output[] = {"30Rnd_556x45_G36",10,"cfgMagazines"}; }; class CreateMag3: CreateMag1 { - output[] = {"30Rnd_556x45_G36","cfgMagazines"}; - }; - class CreateMag4: CreateMag1 - { - output[] = {"200Rnd_556x45_M249","cfgMagazines"}; + output[] = {"100Rnd_556x45_M249",3,"cfgMagazines"}; }; }; }; @@ -1727,42 +1723,135 @@ class CfgMagazines class bulk_NVGoggles: bulk { descriptionShort = "12 x NV Goggles"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"NVGoggles",12,"weapon"}; + // types magazine, weapon, backpack + }; + }; + }; class bulk_DZ_Backpack_EP1: bulk { descriptionShort = "12 x DZ_Backpack_EP1"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"DZ_Backpack_EP1",12,"backpack"}; + // types magazine, weapon, backpack + }; + }; }; class bulk_30Rnd_9x19_MP5SD: bulk { descriptionShort = "12 x 30Rnd_9x19_MP5SD"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"30Rnd_9x19_MP5SD",12,"magazine"}; + }; + }; }; class bulk_15Rnd_9x19_M9SD: bulk { descriptionShort = "12 x 15Rnd_9x19_M9SD"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"15Rnd_9x19_M9SD",12,"magazine"}; + }; + }; }; class bulk_30Rnd_556x45_StanagSD: bulk { descriptionShort = "12 x 30Rnd_556x45_StanagSD"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"30Rnd_556x45_StanagSD",12,"magazine"}; + }; + }; }; class bulk_ItemSandbag: bulk { descriptionShort = "12 x SandBag"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"ItemSandbag",12,"magazine"}; + }; + }; }; class bulk_ItemGPS: bulk { descriptionShort = "12 x GPS"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"ItemGPS",12,"weapon"}; + }; + }; }; class bulk_ItemMap: bulk { descriptionShort = "12 x Map"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"ItemMap",12,"weapon"}; + }; + }; }; class bulk_ItemEtool: bulk { descriptionShort = "12 x E-Tool"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"ItemEtool",12,"weapon"}; + }; + }; }; class bulk_17Rnd_9x19_glock17: bulk { descriptionShort = "12 x 17Rnd_9x19_glock17"; + class ItemActions + { + class CreateMags + { + text = "Open %1"; + script = "spawn player_loadCrate;"; + output[] = {"17Rnd_9x19_glock17",12,"magazine"}; + }; + }; };