From f0757b1544fa5a9e04201ec8c9ca7d12b7939e24 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 20 Mar 2016 22:12:11 -0400 Subject: [PATCH] Send dayz_playerName as array This avoids triggering PV value restrictions when the player has keywords or special characters in their name. --- CHANGE LOG 1.0.6.txt | 1 + .../Configs/CfgMagazines/Magazines/Melee.hpp | 2 +- .../CfgWeapons/Melee/MeleeSledgehammer.hpp | 2 +- SQF/dayz_code/NOTE.txt | 8 --- SQF/dayz_code/actions/player_addToolbelt.sqf | 2 +- SQF/dayz_code/compile/fn_damageHandler.sqf | 29 ++++---- SQF/dayz_code/compile/fn_damageHandlerZ.sqf | 2 +- .../compile/fn_isInsideBuilding2.sqf | 35 --------- SQF/dayz_code/compile/fn_temperatur.sqf | 9 ++- SQF/dayz_code/compile/fn_unconscious.sqf | 55 +++----------- SQF/dayz_code/compile/local_gutObject.sqf | 38 +++++----- SQF/dayz_code/compile/local_gutObjectZ.sqf | 14 ++-- SQF/dayz_code/compile/object_monitorGear.sqf | 41 +++++------ SQF/dayz_code/compile/object_speak.sqf | 48 +++++-------- SQF/dayz_code/compile/player_checkStealth.sqf | 23 +----- SQF/dayz_code/compile/player_death.sqf | 71 ++++++++----------- SQF/dayz_code/compile/player_fired.sqf | 20 ++---- .../compile/player_humanityChange.sqf | 4 +- SQF/dayz_code/compile/player_switchModel.sqf | 4 +- .../R3F_Realism/R3F_Weight/R3F_CfgWeight.h | 2 +- SQF/dayz_code/init/compiles.sqf | 1 - SQF/dayz_server/compile/server_playerDied.sqf | 7 +- 22 files changed, 136 insertions(+), 282 deletions(-) delete mode 100644 SQF/dayz_code/compile/fn_isInsideBuilding2.sqf diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 56ac4994a..95995d70f 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -13,6 +13,7 @@ - vehicle_handleKilled --> fnc_veh_handleKilled - Duplicate global variables have been renamed: - dayz_updateObjects --> DayZ_GearedObjects + - freeTarget --> OpenTarget - Duplicate public variables have been renamed: - dayzPlayerLogin --> PVCDZ_plr_Login - dayzPlayerLogin2 --> PVCDZ_plr_Login2 diff --git a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Melee.hpp b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Melee.hpp index 88269dd41..e6ffdcb3e 100644 --- a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Melee.hpp +++ b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Melee.hpp @@ -46,7 +46,7 @@ class Fishing_Swing : Melee_Swing ammo = "Fishing_Swing_Ammo"; }; -class sledge_swing : Melee_Swing { +class Sledge_Swing : Melee_Swing { displayName = "Sledge"; displayNameMagazine = "Sledge"; shortNameMagazine = "Sledge"; diff --git a/SQF/dayz_code/Configs/CfgWeapons/Melee/MeleeSledgehammer.hpp b/SQF/dayz_code/Configs/CfgWeapons/Melee/MeleeSledgehammer.hpp index 52f97b125..2d8616a23 100644 --- a/SQF/dayz_code/Configs/CfgWeapons/Melee/MeleeSledgehammer.hpp +++ b/SQF/dayz_code/Configs/CfgWeapons/Melee/MeleeSledgehammer.hpp @@ -10,7 +10,7 @@ class MeleeSledge: MeleeWeapon droppeditem= "ItemSledge"; magazines[]= { - "sledge_swing" + "Sledge_Swing" }; handAnim[]= { diff --git a/SQF/dayz_code/NOTE.txt b/SQF/dayz_code/NOTE.txt index d46fccbcd..bae0769bb 100644 --- a/SQF/dayz_code/NOTE.txt +++ b/SQF/dayz_code/NOTE.txt @@ -5,8 +5,6 @@ NEW VAR DZE_UseBloodTypes DZE_UseBloodTypes, OFF by default - Enables blood type system, and disables universal bloodbags. you can readily turn this system off and on - -fn_selfActions.sqf player_updateGui.sqf DZE_BloodBags NEEDED ARRAY OF ALL BLOOD BAGS @@ -22,16 +20,10 @@ REMOVE TOOL BREAKING, IT'S STUPID player_craftItem_DZV = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf"; dayz_serverObjectMonitor = []; IS REPLACED WITH PVDZE_serverObjectMonitor = []; -******REPLACE ALL PVCDZ_ AND PVDZ_ with PVCDZE/PVDZE_ - trap_monitor.fsm is no more! NEW FNC PVDZE_hlt_Bleed -- THATS AN L change it to an I -player getVariable ["OpenTarget",false]; CHANGE TO -player getVariable ["freeTarget",false]; - - //////////////////////////////////////// SELF ACTIONS VARIABLES //////////////////////////////////////// diff --git a/SQF/dayz_code/actions/player_addToolbelt.sqf b/SQF/dayz_code/actions/player_addToolbelt.sqf index dac389283..95c6e29cb 100644 --- a/SQF/dayz_code/actions/player_addToolbelt.sqf +++ b/SQF/dayz_code/actions/player_addToolbelt.sqf @@ -47,7 +47,7 @@ if ((_item in ["MeleeHatchet_DZE","MeleeCrowbar","MeleeMachete","MeleeFishingPol }; //Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed) -{player removeMagazines _x} forEach ["Hatchet_Swing","sledge_swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"]; +{player removeMagazines _x} forEach ["Hatchet_Swing","Sledge_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"]; _isOk = [player,_config2] call BIS_fnc_invAdd; if (_isOk) then { diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index 4e33f49d6..6fb4fe495 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -33,7 +33,6 @@ if (_unit == player) then if ((_source != player) and _isPlayer) then { _isBandit = (player getVariable["humanity",0]) <= -5000; - _isPZombie = player isKindOf "PZombie_VB"; //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); //if player is not free to shoot at inform server that _source shot at player @@ -50,22 +49,22 @@ if (_unit == player) then // - Accidental Murder - \\ When wearing the garb of a non-civilian you are taking your life in your own hands // Attackers humanity should not be punished for killing a survivor who has shrouded his identity in military garb. - _punishment = _isBandit || {player getVariable ["OpenTarget",false]} && {!_isPZombie}; + _punishment = + ((_isBandit || + {player getVariable ["OpenTarget",false]}) && + {!_isPZombie}); _humanityHit = 0; if (!_punishment) then { - //_myKills = 200 - (((player getVariable ["humanKills",0]) / 3) * 150); + _myKills = 200 - (((player getVariable ["humanKills",0]) / 3) * 150); // how many non bandit players have I (the shot/damaged player) killed? // punish my killer 200 for shooting a surivor // but subtract 50 for each survivor I've murdered - //_humanityHit = -(_myKills * _damage); - //if (_humanityHit < -2000) then { - // _humanityHit = -2000; - //}; + _humanityHit = -(_myKills * _damage); + if (_humanityHit < -800) then { + _humanityHit = -800; + }; // In the case of outrageous damage (crashes, explosions, desync repeated headshots); cap the limit on humanity lost. - //Process Morality Hit - _myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5); - _humanityHit = -100 * _myKills * _damage; [_source,_humanityHit] spawn { private ["_source","_humanityHit"]; @@ -85,9 +84,9 @@ if (_unit == player) then _unit = _this select 0; cutText [localize "str_player_tranquilized", "PLAIN DOWN"]; //systemChat format ["YOU HAVE BEEN TRANQUILISED"]; - //uiSleep 2; + //uiSleep 2; // 0 fadeSound 0.05; - //uiSleep 5; + //uiSleep 5; [_unit,0.01] call fnc_usec_damageUnconscious; _unit setVariable ["NORRN_unconscious", true, true]; r_player_timeout = round(random 60); @@ -99,7 +98,7 @@ if (_unit == player) then if (_damage > 0.4) then { //Melee knockout system - if ((_isHeadHit) and (_ammo in ["Sledge_Swing_Ammo","Crowbar_Swing_Ammo","Bat_Swing_Ammo"])) then { + if ((_isHeadHit) and (_ammo in ["Crowbar_Swing_Ammo","Bat_Swing_Ammo","Sledge_Swing_Ammo"])) then { [_unit] spawn { _unit = _this select 0; cutText ["you have been knocked out", "PLAIN DOWN"]; @@ -182,7 +181,7 @@ if (_damage > 0.4) then { }; if (_unit == player) then { //diag_log ("DAMAGE: player hit by " + (typeOf _source) + " in " + _hit + " with " + _ammo + " for " + str(_damage) + " scaled " + str(_damage * _scale) + " Conscious " + str (!_unconscious)); - //diag_log format["DAMAGE: player hit by %1 in %2 with %3 for %4 scaled to %5, Conscious %6",(typeOf _source),_hit,if (_ammo == "") then { "" } else { _ammo },(str(_damage)),(str(_damage * _scale)),(str (!_unconscious))]; + diag_log format["DAMAGE: player hit by %1 in %2 with %3 for %4 scaled to %5, Conscious %6",(typeOf _source),_hit,if (_ammo == "") then { "" } else { _ammo },(str(_damage)),(str(_damage * _scale)),(str (!_unconscious))]; r_player_blood = r_player_blood - (_damage * _scale); }; }; @@ -277,7 +276,7 @@ if (_damage > 0.4) then { if (_ammo == "zombie") then { - if(!_isHit and _isbleeding && !_isPZombie) then { + if (!_isHit && _isbleeding && !_isPZombie) then { //Create Wound _unit setVariable["hit_"+_wound,true,true]; diff --git a/SQF/dayz_code/compile/fn_damageHandlerZ.sqf b/SQF/dayz_code/compile/fn_damageHandlerZ.sqf index a9cce613a..8a27a45e4 100644 --- a/SQF/dayz_code/compile/fn_damageHandlerZ.sqf +++ b/SQF/dayz_code/compile/fn_damageHandlerZ.sqf @@ -9,7 +9,7 @@ _damage = _this select 2; _hitter = _this select 3; _projectile = _this select 4; -_meleeAmmo = ["Hatchet_Swing_Ammo","Sledge_Swing_Ammo","Machete_Swing_Ammo","Crowbar_Swing_Ammo","Bat_Swing_Ammo","BatBarbed_Swing_Ammo","Fishing_Swing_Ammo","BatNailed_Swing_Ammo"]; +_meleeAmmo = ["Hatchet_Swing_Ammo","Machete_Swing_Ammo","Crowbar_Swing_Ammo","Bat_Swing_Ammo","BatBarbed_Swing_Ammo","Fishing_Swing_Ammo","BatNailed_Swing_Ammo","Sledge_Swing_Ammo"]; if (_projectile in _meleeAmmo) then { _damage = _damage * 10; diff --git a/SQF/dayz_code/compile/fn_isInsideBuilding2.sqf b/SQF/dayz_code/compile/fn_isInsideBuilding2.sqf deleted file mode 100644 index 5455a2061..000000000 --- a/SQF/dayz_code/compile/fn_isInsideBuilding2.sqf +++ /dev/null @@ -1,35 +0,0 @@ -private ["_unit1","_building","_relPos","_boundingBox","_min","_max","_myX","_myY","_myZ","_inside"]; -_unit1 = _this select 0; -_building = _this select 1; - -//_type = typeOf _building; -_relPos = _building worldToModel (getPosATL _unit1); -_boundingBox = boundingBox _building; -//diag_log ("DEBUG: Building: " + str(_building) ); -//diag_log ("DEBUG: Building Type: " + str(_type) ); -//diag_log ("DEBUG: BoundingBox: " + str(_boundingBox) ); - -_min = _boundingBox select 0; -_max = _boundingBox select 1; - -//diag_log ("Min: " + str(_min) ); -//diag_log ("Max: " + str(_max) ); - -_myX = _relPos select 0; -_myY = _relPos select 1; -_myZ = _relPos select 2; - -//diag_log ("X: " + str(_myX) ); -//diag_log ("Y: " + str(_myY) ); -//diag_log ("Z: " + str(_myZ) ); - -if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then { - if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then { - if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then { - _inside = true; - } else { _inside = false; }; - } else { _inside = false; }; -} else { _inside = false; }; - -//diag_log ("isinBuilding Check: " + str(_inside) ); -_inside \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_temperatur.sqf b/SQF/dayz_code/compile/fn_temperatur.sqf index 5547d32c3..7e0f73f47 100644 --- a/SQF/dayz_code/compile/fn_temperatur.sqf +++ b/SQF/dayz_code/compile/fn_temperatur.sqf @@ -24,11 +24,11 @@ _looptime = _this; //All Values can be seen as x of 100: 100 / x = minutes from min temperetaure to max temperature (without other effects) //Positive effects - _vehicle_factor = 4; + _vehicle_factor = 2; _fire_factor = 15; - _moving_factor = 7; - _building_factor = 7; - _sun_factor = 4; + _moving_factor = 2.1; + _building_factor = 1.5; + _sun_factor = 3; //Negative effects _water_factor = 8; @@ -60,7 +60,6 @@ if((vehicle player) != player) then { //diag_log format["Moving - %1",_difference]; //fire -private ["_fireplaces"]; _pPos = [player] call FNC_GetPos; _fireplaces = nearestObjects [_pPos, ["flamable_DZ","Land_Fire","Land_Campfire"], 8]; if(({inflamed _x} count _fireplaces) > 0 && !_isinvehicle ) then { diff --git a/SQF/dayz_code/compile/fn_unconscious.sqf b/SQF/dayz_code/compile/fn_unconscious.sqf index 9543896bc..6154a7c21 100644 --- a/SQF/dayz_code/compile/fn_unconscious.sqf +++ b/SQF/dayz_code/compile/fn_unconscious.sqf @@ -1,52 +1,10 @@ // (c) facoptere@gmail.com, licensed to DayZMod for the community -private ["_count","_anim","_weapon","_sprint","_stance","_transmove","_start","_timeout","_short","_sandLevel","_veh","_disableHdlr", "_speed"]; +private ["_count","_anim","_weapon","_sprint","_stance","_transmove","_start","_timeout","_short","_sandLevel","_veh","_disableHdlr","_speed"]; if (r_player_unconsciousInProgress) exitWith {}; r_player_unconsciousInProgress = true; -/* - _anim = toArray animationState player; - _weapon = if (count _anim <= 17) then { 0 } else { - switch (_anim select 17) do { - case 114 : { 2 }; // rifle - case 112 : { 1 }; // pistol - default { 0 }; // bare hands / flare - } - }; - _sprint = if (count _anim <= 10) then { false } else { _anim select 10 in [112, 118] }; - _stance = if (count _anim <= 5) then { 2 } else { - switch (_anim select 5) do { - case 107 : { 1 }; // kneel - case 112 : { 0 }; // prone - default { 2 }; // erected - } - }; - - _transmove = (switch true do { - case (player != vehicle player) : {""}; - case (_stance == 1) : { [ // kneeled - "amovpknlmstpsnonwnondnon_amovppnemstpsnonwnondnon", // kneeled stopped bare hands - "amovpknlmstpsraswpstdnon_amovppnemstpsraswpstdnon", // kneeled stopped pistol - "amovpknlmstpsraswrfldnon_amovppnemstpsraswrfldnon" // kneeled stopped rifle - ] select _weapon }; - case (_sprint) : { [ // erected and sprinting - "amovpercmsprsnonwnondf_amovppnemstpsnonwnondnon", // erected sprinting with bare hands - "amovpercmsprslowwpstdf_amovppnemstpsraswpstdnon", // erected sprinting pistol - "amovpercmsprslowwrfldf_amovppnemstpsraswrfldnon" // erected sprinting with rifle - ] select _weapon }; - case (_stance == 2) : {([ // erected and not sprinting - "amovpercmstpsnonwnondnon_amovppnemstpsnonwnondnon", // erected stoped/walking with bare hands - "amovpercmstpsraswpstdnon_amovppnemstpsraswpstdnon", // erected stoped/walking with pistol - "amovpercmstpsraswrfldnon_amovppnemstpsraswrfldnon" // erected stoped/walking with rifle - ] select _weapon)}; - default {""}; // already prone, or swimming, or onladder - }); - - //diag_log [ __FILE__, diag_tickTime, "current player move:",toString _anim, "collapse move:",_transmove, "duration:",r_player_timeout ]; - if (_transmove != "") then { player playmove _transmove; }; -*/ - _start = diag_tickTime; _timeout = abs r_player_timeout; _short = _timeout < 4; @@ -63,7 +21,8 @@ _sandLevel = ctrlPosition ((uiNamespace getVariable 'DAYZ_GUI_waiting') displayC //diag_log [(diag_tickTime - _start) < _timeout , !r_player_unconscious , alive player ]; // delay so that the character does not stop before falling: -_disableHdlr = [] spawn { uiSleep 2; disableUserInput true; r_player_unconsciousInputDisabled = true; }; +_disableHdlr = [] spawn { uiSleep 2; disableUserInput true; r_player_unconsciousInputDisabled = true; }; +autoRunActive = 0; player playAction "CanNotMove"; "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [2]; "dynamicBlur" ppEffectCommit 0; @@ -87,7 +46,7 @@ while { (diag_tickTime - _start) < _timeout and r_player_unconscious and alive p } else { player action ["eject", _veh]; player leaveVehicle _veh; - [] spawn { uiSleep 0.1; player switchmove "amovppnemstpsnonwnondnon"; }; // instant prone + [] spawn { uiSleep 0.1; player playMoveNow "amovppnemstpsnonwnondnon"; }; // instant prone }; }; @@ -115,7 +74,11 @@ waituntil {scriptDone _disableHdlr}; disableUserInput false; r_player_unconsciousInputDisabled = false; 4 cutRsc ["default", "PLAIN",1]; -player switchMove "AmovPpneMstpSnonWnonDnon_healed"; + +[nil, player, rSWITCHMOVE, "AinjPpneMstpSnonWnonDnon"] call RE; +player SWITCHMOVE "AinjPpneMstpSnonWnonDnon"; + +player playMoveNow "AmovPpneMstpSnonWnonDnon_healed"; 10 fadeSound 1; "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; diff --git a/SQF/dayz_code/compile/local_gutObject.sqf b/SQF/dayz_code/compile/local_gutObject.sqf index 1b208ec4e..b2d77ca26 100644 --- a/SQF/dayz_code/compile/local_gutObject.sqf +++ b/SQF/dayz_code/compile/local_gutObject.sqf @@ -1,43 +1,43 @@ -private ["_animalbody","_qty","_rawfoodtype"]; _animalbody = _this select 0; +_qty = _this select 1; +_rawfoodtype = getText (configFile >> "CfgSurvival" >> "Meat" >> typeOf _animalbody >> "rawfoodtype"); if (local _animalbody) then { - _qty = _this select 1; - _rawfoodtype = getText (configFile >> "CfgSurvival" >> "Meat" >> typeOf _animalbody >> "rawfoodtype"); - - for "_x" from 1 to _qty do { + for "_i" from 1 to _qty do { _animalbody addMagazine _rawfoodtype; }; - + if (typeOf _animalbody == "Hen") then { _amount = (floor (random 4)) + 2; for "_x" from 1 to _amount do { _animalbody addMagazine "equip_feathers"; }; - }; - [time, _animalbody] spawn { - private ["_timer", "_body"]; + }; + + [time, _animalbody] spawn { _timer = _this select 0; _body = _this select 1; - _pos = getPosATL _body; - while {(count magazines _body >0) && (time - _timer < 300) } do { + _pos = getPosATL _body; + while {(count magazines _body > 0) && (time - _timer < 300)} do { uiSleep 5; - }; - + }; hideBody _body; - - /* PVS/PVC - Skaronator */ + + //No need to let everyone on the server know. + //PVCDZ_obj_HideBody = _body; + //publicVariable "PVCDZ_obj_HideBody"; // remote player + + //Send to server let everyone in 100 meters of the body know its just been hidden. _inRange = _pos nearEntities ["CAManBase",100]; { - // only send to other players - if(isPlayer _x && _x != player) then { + if ((isPlayer _x) && {_x != player}) then { PVDZ_send = [_x,"HideBody",[_body]]; publicVariableServer "PVDZ_send"; }; } count _inRange; - + uiSleep 5; deleteVehicle _body; - true; + true }; }; \ No newline at end of file diff --git a/SQF/dayz_code/compile/local_gutObjectZ.sqf b/SQF/dayz_code/compile/local_gutObjectZ.sqf index 56413477a..223a83452 100644 --- a/SQF/dayz_code/compile/local_gutObjectZ.sqf +++ b/SQF/dayz_code/compile/local_gutObjectZ.sqf @@ -1,25 +1,24 @@ -private ["_zombiebody"]; +private "_zombiebody"; _zombiebody = _this select 0; // _qty = _this select 1; if (local _zombiebody) then { _zombiebody addMagazine "ItemZombieParts"; - [time, _zombiebody] spawn { - private ["_timer", "_body"]; + [time, _zombiebody] spawn { + private ["_timer","_body"]; _timer = _this select 0; _body = _this select 1; _pos = getPosATL _body; - while {(count magazines _body >0) && (time - _timer < 300) } do { + while {(count magazines _body > 0) && (time - _timer < 300)} do { uiSleep 5; }; hideBody _body; - /* PVS/PVC - Skaronator */ _inRange = _pos nearEntities ["CAManBase",100]; { - if(isPlayer _x && _x != player) then { + if ((isPlayer _x) && {_x != player}) then { PVDZ_send = [_x,"HideBody",[_body]]; publicVariableServer "PVDZ_send"; }; @@ -27,7 +26,6 @@ if (local _zombiebody) then { uiSleep 5; deleteVehicle _body; - true; + true }; - }; \ No newline at end of file diff --git a/SQF/dayz_code/compile/object_monitorGear.sqf b/SQF/dayz_code/compile/object_monitorGear.sqf index 08e4c265d..45aa9645e 100644 --- a/SQF/dayz_code/compile/object_monitorGear.sqf +++ b/SQF/dayz_code/compile/object_monitorGear.sqf @@ -1,57 +1,50 @@ -private["_countMagazines","_countWeapons","_countBackpacks","_countFreeSlots","_getControlText","_setControlText","_object","_objectName","_controlText","_magazinesMax","_weaponsMax","_backpacksMax","_distance","_isVehicle","_isMan","_isStorage","_isOK","_magazines","_weapons","_backpacks","_freeSlots","_timeout"]; +private ["_valueIDCs","_object","_display","_weaponsMax","_magazinesMax","_backpacksMax","_weapons","_magazines","_backpacks","_freeSlots"]; + disableSerialization; _countWeapons = { - private["_weapons","_return"]; _weapons = []; _return = 0; - + _weapons = (getWeaponCargo _object) select 1; { _return = _return + _x } count _weapons; - _return; + _return }; _countMagazines = { - private["_magazines","_return"]; _magazines = []; _return = 0; - + _magazines = (getMagazineCargo _object) select 1; { _return = _return + _x } count _magazines; - _return; + _return }; _countBackpacks = { - private["_backpacks","_return"]; _backpacks = []; _return = 0; - + _backpacks = (getBackpackCargo _object) select 1; { _return = _return + _x } count _backpacks; - _return; + _return }; _countFreeSlots = { - private["_return"]; _return = [(_weaponsMax - _weapons), (_magazinesMax - _magazines), (_backpacksMax - _backpacks)]; - _return; + _return }; _getControlText = { - private["_control","_return"]; - _control = (findDisplay 106) displayCtrl 156; + _control = _display displayCtrl 156; _return = ctrlText _control; - _return; + _return }; _setControlText = { - private["_control"]; - /*for [{_i = 0}, {_i < (count _valueIDCs)}, {_i = _i + 1}] do { + for [{_i = 0}, {_i < (count _valueIDCs)}, {_i = _i + 1}] do { _control = _display displayCtrl (_valueIDCs select _i); _control ctrlSetText format ["%1", (_freeSlots select _i)]; - }; */ - _control = (findDisplay 106) displayCtrl 156; - _control ctrlSetText format["%1 (%2/%3/%4)", _objectName, _freeSlots select 0, _freeSlots select 1, _freeSlots select 2]; + }; }; _titleIDC = 1001; @@ -67,27 +60,25 @@ if (vehicle player != player) then { _isVehicle = _object isKindOf "AllVehicles"; _isMan = _object isKindOf "Man"; _isStorage = _object isKindOf "Land_A_tent"; -_isnewstorage = (typeOf _object) in DZE_isNewStorage; +_isNewStorage = (typeOf _object) in DZE_isNewStorage; _timeout = time + 2; -waitUntil { !(isNull (findDisplay 106)) || (_timeout < time) }; +waitUntil { !(isNull (findDisplay 106)) or (_timeout < time) }; //diag_log format["object_monitorGear.sqf: _object: %1 _isStorage: %4 _isVehicle: %2 _isMan: %3 _display: %5", _object, _isVehicle, _isMan, _isStorage, findDisplay 106]; if (!(isNull (findDisplay 106))) then { _display = findDisplay 106; - if ((_isVehicle or _isStorage || _isnewstorage) and (!_isMan)) then { + if ((_isVehicle or _isStorage or _isNewStorage) && !_isMan) then { _objectName = getText (configFile >> "CfgVehicles" >> (typeof _object) >> "displayName"); _controlText = [] call _getControlText; - if (_objectName == _controlText) then { _weaponsMax = getNumber (configFile >> "CfgVehicles" >> (typeof _object) >> "transportMaxWeapons"); _magazinesMax = getNumber (configFile >> "CfgVehicles" >> (typeof _object) >> "transportMaxMagazines"); _backpacksMax = getNumber (configFile >> "CfgVehicles" >> (typeof _object) >> "transportMaxBackpacks"); - while {!(isNull (findDisplay 106))} do { _weapons = [] call _countWeapons; _magazines = [] call _countMagazines; diff --git a/SQF/dayz_code/compile/object_speak.sqf b/SQF/dayz_code/compile/object_speak.sqf index e4aadce07..97845424c 100644 --- a/SQF/dayz_code/compile/object_speak.sqf +++ b/SQF/dayz_code/compile/object_speak.sqf @@ -1,4 +1,5 @@ -private ["_unit","_type","_chance","_rnd","_sound","_local","_dis","_num","_isWoman"]; +private ["_type","_local","_unit"]; + _unit = _this select 0; _type = _this select 1; _chance = _this select 2; @@ -15,48 +16,37 @@ if (!_local) then { // we override _local according to number of players inside _dis radius _local = { _unit distance _x < _dis; } count playableUnits <= 1; }; + +//diag_log(format["%1 dis:%2 local:%3", __FILE__, _dis, _local]); + _num = switch (_type) do { - default {0}; - case "cough": {2}; - case "chase": {14}; - case "spotted": {13}; - case "hit": {6}; - case "attack": {13}; - case "idle": {35}; - case "scream": {4}; - case "fracture": {1}; - case "eat": {3}; - case "cook": {2}; - case "panic": {1}; + default {0}; + case "cough": {2}; + case "chase": {14}; + case "spotted": {13}; + case "hit": {6}; + case "attack": {13}; + case "idle": {35}; + case "scream": {4}; + case "fracture": {1}; + case "eat": {3}; + case "cook": {2}; + case "panic": {1}; case "dog_bark": {4}; case "dog_growl": {3}; case "dog_qq": {2}; case "keypad_tick": {2}; - case "flysound": {1}; case "open_backpack": {4}; case "open_inventory": {4}; }; -if (count _this > 4) then { - _dis = _this select 4; - _local = ({isPlayer _x} count (_unit nearEntities ["AllVehicles",_dis]) < 2); -} else { - _local = _this select 3; - - if (_type in ["shout","hit","attack","scream","breath","spotted"]) then { - _dis = 100; - } else { - _dis = 40; - }; -}; - _isWoman = getText(configFile >> "cfgVehicles" >> (typeOf _unit) >> "TextPlural") == "Women"; if (_isWoman and (_type in ["scream","panic"])) then { _type = _type + "_w"; }; -if ((round(random _chance) == _chance) || (_chance == 0)) then { - _rnd =(round(random _num)); +if ((round(random _chance) == _chance) or (_chance == 0)) then { + _rnd = round(random _num); _sound = "z_" + _type + "_" + str(_rnd); if (_local) then { _unit say [_sound, _dis]; diff --git a/SQF/dayz_code/compile/player_checkStealth.sqf b/SQF/dayz_code/compile/player_checkStealth.sqf index 128739ee9..c73da4bce 100644 --- a/SQF/dayz_code/compile/player_checkStealth.sqf +++ b/SQF/dayz_code/compile/player_checkStealth.sqf @@ -1,4 +1,3 @@ - private ["_scalePose","_scaleMvmt","_scaleLight","_initial"]; _vel = velocity (vehicle player); _speed = (_vel distance [0,0,0]); @@ -29,23 +28,6 @@ if (["pknl",_anim] call fnc_inString) then { if (_anim4 == "aswm") then { _scaleMvmt = 0.3; dayz_isSwimming = true; - - // if surface is not water abort - _isWater = surfaceIsWater _pos; - if(!_isWater) then { - - // Stops swimming in ground - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - // This sleep was much needed - uiSleep 5; - - dayz_isSwimming = false; - }; - - } else { dayz_isSwimming = false; }; @@ -61,7 +43,6 @@ _scaleLight = ( dayz_scaleLight = _scaleLight; - _scaleSound = (1 - (rain * 0.3) //remove for rain state //+ (fog * 0.3) //add for fog state @@ -144,6 +125,4 @@ _audial = round(_speed * dayz_surfaceNoise * _scaleMvmt * _scaleSound); if ((_audial > DAYZ_disAudial) or ((time - dayz_firedCooldown) > 0.3)) then { DAYZ_disAudial = _audial; }; - - -DAYZ_disVisual = (round((_initial + (_speed * 3)) * _scalePose * _scaleLight)) * 1.5; +DAYZ_disVisual = (round((_initial + (_speed * 3)) * _scalePose * _scaleLight)) * 1.5; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index d672fdf15..7bab328bf 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -1,20 +1,19 @@ -private ["_display","_body","_playerID","_array","_source","_method","_canHitFree","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup"]; +private ["_display","_body","_playerID","_array","_source","_method","_isBandit","_punishment","_humanityHit","_myKills","_humanity","_kills","_killsV","_myGroup"]; disableSerialization; if (deathHandled) exitWith {}; deathHandled = true; -if ((alive player) && {isNil {dayz_playerName}}) then { - dayz_playerName = name player; -}; +if (alive player) then {dayz_playerName = name player;}; + //Prevent client freezes _display = findDisplay 49; -if(!isNull _display) then {_display closeDisplay 0;}; +if (!isNull _display) then {_display closeDisplay 0;}; if (dialog) then {closeDialog 0;}; if (visibleMap) then {openMap false;}; _body = player; _playerID = [player] call FNC_GetPlayerUID; - disableUserInput true; + //add weapon on back to player... if (dayz_onBack != "") then { //Add weapon on back to body. @@ -28,19 +27,13 @@ if (dayz_onBack != "") then { _item addWeaponCargoGlobal [dayz_onBack,1]; */ }; -_infected = 0; -if (r_player_infected && DZE_PlayerZed) then { - _infected = 1; -}; +_infected = if (r_player_infected && DZE_PlayerZed) then {1} else {0}; //Send Death Notice -//["PVDZ_plr_Death",[dayz_characterID,0,_body,_playerID,dayz_playerName]] call callRpcProcedure; -PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,_infected,dayz_playerName]; +PVDZ_plr_Death = [dayz_characterID,0,_body,_playerID,_infected,toArray dayz_playerName]; // Send as array to avoid publicVariable value restrictions publicVariableServer "PVDZ_plr_Death"; _id = [player,20,true,getPosATL player] call player_alertZombies; - uiSleep 0.5; - player setDamage 1; 0.1 fadeSound 0; @@ -49,7 +42,7 @@ player setVariable ["unconsciousTime", 0, true]; player setVariable ["USEC_isCardiac",false,true]; player setVariable ["medForceUpdate",true,true]; player setVariable ["bloodTaken", false, true]; -player setVariable ["startcombattimer", 0]; +player setVariable ["startcombattimer", 0]; //remove combat timer on death r_player_unconscious = false; r_player_cardiac = false; _model = typeOf player; @@ -60,13 +53,21 @@ if (count _array > 0) then { _source = _array select 0; _method = _array select 1; if ((!isNull _source) && (_source != player)) then { - _canHitFree = player getVariable ["freeTarget",false]; _isBandit = (player getVariable["humanity",0]) <= -2000; - _punishment = _canHitFree || _isBandit; //if u are bandit || start first - player will not recieve humanity drop + //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); + + //if you are a bandit or start first - player will not recieve humanity drop + _punishment = + _isBandit || + {player getVariable ["OpenTarget",false]}; _humanityHit = 0; + if (!_punishment) then { - //i'm "not guilty" - kill me && be punished - _myKills = ((player getVariable ["humanKills",0]) / 30) * 1000; + //i'm "not guilty" - kill me and be punished + _myKills = ((player getVariable ["humanKills",0]) / 3) * 1500; + // how many non bandit players have I (the dead player) killed? + // punish my killer 2000 for shooting a surivor + // but subtract 500 for each survivor I've murdered _humanityHit = -(2000 - _myKills); _kills = _source getVariable ["humanKills",0]; _source setVariable ["humanKills",(_kills + 1),true]; @@ -107,47 +108,37 @@ if (count _array > 0) then { terminate dayz_musicH; terminate dayz_slowCheck; -//terminate dayz_animalCheck; terminate dayz_monitor1; -//terminate dayz_medicalH; +//Reset (just in case) +//deleteVehicle dayz_playerTrigger; +//disableUserInput false; r_player_dead = true; -"dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2; - -"colorCorrections" ppEffectEnable true; -"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01], [1, 1, 1, 0.0]]; -"colorCorrections" ppEffectCommit 1; - //Player is Dead! 3 fadeSound 0; uiSleep 1; dayz_originalPlayer enableSimulation true; - addSwitchableUnit dayz_originalPlayer; setPlayable dayz_originalPlayer; selectPlayer dayz_originalPlayer; -//_myGroup = group _body; -//[_body] joinSilent dayz_firstGroup; -//deleteGroup _myGroup; +_myGroup = group _body; +[_body] joinSilent dayz_firstGroup; +deleteGroup _myGroup; 3 cutRsc ["default", "PLAIN",3]; 4 cutRsc ["default", "PLAIN",3]; _body setVariable["combattimeout", 0, true]; - -//["dayzFlies",player] call broadcastRpcCallAll; +//due to a cleanup issue with effects this has been disabled remember to look at the cleanup before adding it back. +//[_body] call spawn_flies; +//dayzFlies = player; +//publicVariable "dayzFlies"; uiSleep 2; - 1 cutRsc ["DeathScreen","BLACK OUT",3]; - playMusic "dayz_track_death_1"; - -"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; -"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5; - uiSleep 2; for "_x" from 5 to 1 step -1 do { @@ -158,4 +149,4 @@ for "_x" from 5 to 1 step -1 do { PVDZ_Server_Simulation = [_body, false]; publicVariableServer "PVDZ_Server_Simulation"; -endMission "END1"; +endMission "END1"; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_fired.sqf b/SQF/dayz_code/compile/player_fired.sqf index 53f6e3ef5..45feb0cbf 100644 --- a/SQF/dayz_code/compile/player_fired.sqf +++ b/SQF/dayz_code/compile/player_fired.sqf @@ -16,16 +16,11 @@ dayz_firedCooldown = time; dayz_combat = 1; if (_ammo isKindOf "Melee") exitWith { - if(!(_ammo isKindOf "Chainsaw_Swing_Ammo")) then { - _unit playActionNow "GestureSwing"; - ["Working",0,[0,1,1,0]] call dayz_NutritionSystem; - }; - // harvest wood check - _this call player_harvest; // Added Nutrition-Factor for work //[Type,Blood[Calories,Hunger,Thrist,Temp] - //["Working",0,[0,1,1,0]] call dayz_NutritionSystem; - //_unit playActionNow "GestureSwing"; + ["Working",0,[0,3,5,0]] call dayz_NutritionSystem; + if !(_ammo isKindOf "Chainsaw_Swing_Ammo") then {_unit playActionNow "GestureSwing";}; + _this call player_harvest; // harvest wood check }; if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or (_ammo isKindOf "G_40mm_HE")) then { @@ -45,8 +40,6 @@ if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or uiSleep 0.01; }; - _listTalk = _pos nearEntities ["zZombie_Base",50]; - { _group = group _x; if (isNull group _x) then { @@ -69,19 +62,16 @@ if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or }; }; }; - } forEach _listTalk; - + } forEach (_pos nearEntities ["zZombie_Base",50]); } else { while { alive _projectile } do { _pos = getPosATL _projectile; uiSleep 0.01; }; - _listTalk = _pos nearEntities ["zZombie_Base",50]; - { _x setVariable ["myDest",_pos]; // removed networked var. targets should be enough - } forEach _listTalk; + } forEach (_pos nearEntities ["zZombie_Base",50]); }; }; } else { diff --git a/SQF/dayz_code/compile/player_humanityChange.sqf b/SQF/dayz_code/compile/player_humanityChange.sqf index 62ebed284..3f7e47f8b 100644 --- a/SQF/dayz_code/compile/player_humanityChange.sqf +++ b/SQF/dayz_code/compile/player_humanityChange.sqf @@ -10,7 +10,7 @@ if (_object == player) then { player setVariable["humanity",_humanity,true]; if (_change < 0) then { //non-bandit player can be "punished" in next "_wait" seconds w/o loosing humanity if ((_humanity > -2000) and (_wait > 0)) then { - player setVariable ["freeTarget",true,true]; +// player setVariable ["freeTarget",true,true]; player setVariable ["FTcounter",((player getVariable ["FTcounter",0]) + _wait)]; [_wait] spawn { private ["_endtime","_wait"]; @@ -20,7 +20,7 @@ if (_object == player) then { player setVariable ["FTcounter",((player getVariable ["FTcounter",0]) - _wait)]; if ((player getVariable ["FTcounter",0]) <= 0) then { player setVariable ["FTcounter",0]; - player setVariable ["freeTarget",false,true]; +// player setVariable ["freeTarget",false,true]; }; }; }; diff --git a/SQF/dayz_code/compile/player_switchModel.sqf b/SQF/dayz_code/compile/player_switchModel.sqf index c4d48ea70..4f262b998 100644 --- a/SQF/dayz_code/compile/player_switchModel.sqf +++ b/SQF/dayz_code/compile/player_switchModel.sqf @@ -118,10 +118,10 @@ if(_primweapon != (primaryWeapon _newUnit)) then { _newUnit addWeapon _primweapon; }; if (_primweapon == "MeleeCrowbar") then { - _newUnit addMagazine 'crowbar_swing'; + _newUnit addMagazine 'Crowbar_Swing'; }; if (_primweapon == "MeleeSledge") then { - _newUnit addMagazine 'sledge_swing'; + _newUnit addMagazine 'Sledge_Swing'; }; if (_primweapon == "MeleeHatchet_DZE") then { _newUnit addMagazine 'Hatchet_Swing'; diff --git a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/R3F_CfgWeight.h b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/R3F_CfgWeight.h index d4b0b751c..57091caa2 100644 --- a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/R3F_CfgWeight.h +++ b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/R3F_CfgWeight.h @@ -1485,7 +1485,7 @@ class CfgWeight { weight = 0; }; - class sledge_swing + class Sledge_Swing { weight = 0; }; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 78d230460..4c812be09 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -573,7 +573,6 @@ fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\ve fnc_veh_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles) fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf"; fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding; -fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding2; dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf"; local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object diff --git a/SQF/dayz_server/compile/server_playerDied.sqf b/SQF/dayz_server/compile/server_playerDied.sqf index 0eb39c6fe..f9d7ab17c 100644 --- a/SQF/dayz_server/compile/server_playerDied.sqf +++ b/SQF/dayz_server/compile/server_playerDied.sqf @@ -6,11 +6,8 @@ _minutes = _this select 1; _newObject = _this select 2; _playerID = _this select 3; _infected = _this select 4; -if (((count _this) >= 6) && {(typeName (_this select 5)) == "STRING"} && {(_this select 5) != ""}) then { - _victimName = _this select 5; -} else { - _victimName = if (alive _newObject) then {name _newObject;} else {"";}; -}; +_victimName = toString (_this select 5); // Sent as array to avoid publicVariable value restrictions + _victim = _newObject; _newObject setVariable ["bodyName", _victimName, true];