From 15f091ef4438b706f279a69e173d5b31fd332073 Mon Sep 17 00:00:00 2001 From: vbawol Date: Fri, 1 Feb 2013 16:05:05 -0600 Subject: [PATCH] 0.87 added cancel to repair and salvage menus, added message to salvage when player does not, fixed bulk crates selling of weapons and backpacks, Can no longer place vaults on roads or within 50m of trader citys, Added now entering/leaving messages to trader citys, Added kill messages from f0rt and stapo. --- dayz_code/actions/repair_cancel.sqf | 3 ++ dayz_code/actions/repair_vehicle.sqf | 7 +++- dayz_code/actions/salvage.sqf | 2 + dayz_code/actions/salvage_vehicle.sqf | 8 +++- dayz_code/actions/trade_backpacks.sqf | 1 + dayz_code/actions/trade_weapons.sqf | 12 ++---- dayz_code/actions/vault_pitch.sqf | 5 ++- dayz_code/config.cpp | 18 ++++---- dayz_code/init/compiles.sqf | 9 ++-- dayz_code/init/variables.sqf | 1 + dayz_code/rscTitles.hpp | 2 +- dayz_server/compile/fnc_plyrHit.sqf | 20 +++++++++ dayz_server/compile/server_gutObject.sqf | 28 ------------- dayz_server/compile/server_gutObjectZ.sqf | 24 ----------- dayz_server/compile/server_playerDied.sqf | 49 ++++++++++++---------- dayz_server/compile/server_playerSetup.sqf | 3 ++ dayz_server/init/server_functions.sqf | 2 + 17 files changed, 91 insertions(+), 103 deletions(-) create mode 100644 dayz_code/actions/repair_cancel.sqf create mode 100644 dayz_server/compile/fnc_plyrHit.sqf delete mode 100644 dayz_server/compile/server_gutObject.sqf delete mode 100644 dayz_server/compile/server_gutObjectZ.sqf diff --git a/dayz_code/actions/repair_cancel.sqf b/dayz_code/actions/repair_cancel.sqf new file mode 100644 index 000000000..f466454fb --- /dev/null +++ b/dayz_code/actions/repair_cancel.sqf @@ -0,0 +1,3 @@ +private []; +{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; +s_player_repair_crtl = -1; \ No newline at end of file diff --git a/dayz_code/actions/repair_vehicle.sqf b/dayz_code/actions/repair_vehicle.sqf index 6c071f5eb..b5db7fa12 100644 --- a/dayz_code/actions/repair_vehicle.sqf +++ b/dayz_code/actions/repair_vehicle.sqf @@ -60,5 +60,10 @@ if (_allFixed) then { _vehicle setDamage 0; }; +if(count _hitpoints > 0 ) then { -s_player_repair_crtl = 1; \ No newline at end of file + _cancel = dayz_myCursorTarget addAction ["Cancel", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false, "",""]; + s_player_repairActions set [count s_player_repairActions,_cancel]; + + s_player_repair_crtl = 1; +}; \ No newline at end of file diff --git a/dayz_code/actions/salvage.sqf b/dayz_code/actions/salvage.sqf index 38bfbf8e8..4e008cf85 100644 --- a/dayz_code/actions/salvage.sqf +++ b/dayz_code/actions/salvage.sqf @@ -43,6 +43,8 @@ if (_hasToolbox) then { cutText [format["You have successfully removed %1 from the %2",_namePart,_nameType], "PLAIN DOWN"]; + } else { + cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"]; }; diff --git a/dayz_code/actions/salvage_vehicle.sqf b/dayz_code/actions/salvage_vehicle.sqf index 6c19cb9a9..90fcd56d9 100644 --- a/dayz_code/actions/salvage_vehicle.sqf +++ b/dayz_code/actions/salvage_vehicle.sqf @@ -57,6 +57,10 @@ _hitpoints = _vehicle call vehicle_getHitpoints; } forEach _hitpoints; +if(count _hitpoints > 0 ) then { + + _cancel = dayz_myCursorTarget addAction ["Cancel", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false, "",""]; + s_player_repairActions set [count s_player_repairActions,_cancel]; - -s_player_repair_crtl = 1; \ No newline at end of file + s_player_repair_crtl = 1; +}; diff --git a/dayz_code/actions/trade_backpacks.sqf b/dayz_code/actions/trade_backpacks.sqf index b3d158d09..8998a1850 100644 --- a/dayz_code/actions/trade_backpacks.sqf +++ b/dayz_code/actions/trade_backpacks.sqf @@ -12,6 +12,7 @@ _textPartIn = (_this select 3) select 5; _textPartOut = (_this select 3) select 6; _traderID = (_this select 3) select 7; _bos = 0; +_bulkqty = 0; if(_buy_o_sell == "buy") then { _qty = {_x == _part_in} count magazines player; diff --git a/dayz_code/actions/trade_weapons.sqf b/dayz_code/actions/trade_weapons.sqf index 858f5a172..ecdb3638f 100644 --- a/dayz_code/actions/trade_weapons.sqf +++ b/dayz_code/actions/trade_weapons.sqf @@ -1,5 +1,5 @@ -private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_traderID","_bos","_isOk"]; -// [part_out,part_in, qty_out, qty_in,"buy"]; +private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_traderID","_bos","_bulkItem","_bulkqty","_gold_out","_gold_qty_out","_partial_qty_out","_silver_qty_out","_needed","_activatingPlayer","_textPartIn","_textPartOut"]; +// [part_out,part_in, qty_out, qty_in,"buy"]; _activatingPlayer = _this select 1; @@ -12,6 +12,7 @@ _textPartIn = (_this select 3) select 5; _textPartOut = (_this select 3) select 6; _traderID = (_this select 3) select 7; _bos = 0; +_bulkqty = 0; if(_buy_o_sell == "buy") then { _qty = {_x == _part_in} count magazines player; @@ -48,8 +49,6 @@ if (_bulkqty >= 1) then { }; }; - - _qty_out = _qty_out * 12; // gold = 36 copper @@ -96,11 +95,6 @@ if (_bulkqty >= 1) then { player addMagazine _part_out; }; }; - - - - - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; diff --git a/dayz_code/actions/vault_pitch.sqf b/dayz_code/actions/vault_pitch.sqf index ad93d1538..461cba7cb 100644 --- a/dayz_code/actions/vault_pitch.sqf +++ b/dayz_code/actions/vault_pitch.sqf @@ -4,7 +4,7 @@ call gear_ui_init; _playerPos = getPosATL player; _item = _this; _hastentitem = _this in magazines player; -_location = player modeltoworld [0,2.5,0]; +_location = player modeltoworld [0,1,0]; _location set [2,0]; _building = nearestObject [(vehicle player), "HouseBase"]; _isOk = [(vehicle player),_building] call fnc_isInsideBuilding; @@ -19,6 +19,9 @@ if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"p //blocked if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); }; +if (isOnRoad _playerPos) then { _isOk = true; diag_log ("surface is road"); }; +if(!placevault) then { _isOk = true; diag_log ("is trader city"); }; + //Block Tents in pounds _objectsPond = nearestObjects [_playerPos, [], 10]; { diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index 4c3476755..e770b10c5 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -33,7 +33,7 @@ class CfgMods hidePicture = 0; hideName = 0; action = "http://www.dayepoch.com"; - version = "0.85"; + version = "0.87"; hiveVersion = 0.96; //0.93 }; }; @@ -83,20 +83,20 @@ class CfgInGameUI colorEast[] = {0,0,0,0}; //{0.95,0.7,0.7,1}; colorCiv[] = {0,0,0,0}; //{0.8,0.8,0.8,1}; colorRes[] = {0,0,0,0}; //{0.7,0.7,0.95,1}; - font = "EtelkaNarrowMediumPro"; - size = "( 21 / 408 )"; //"( 21 / 408 )"; + font = ""; + size = ""; //"( 21 / 408 )"; class Columns { class Order { - width = 0.046; //0.046; - colorBg[] = {0.1,0.27,0.1,0.8}; //{0.1,0.27,0.1,0.8}; + width = 0; //0.046; + colorBg[] = {0,0,0,0}; //{0.1,0.27,0.1,0.8}; doubleLine = 0; }; class Player { - width = 0.25; //0.25; - colorBg[] = {0.1,0.23,0.1,0.8}; //{0.1,0.23,0.1,0.8}; + width = 0; //0.25; + colorBg[] = {0,0,0,0}; //{0.1,0.23,0.1,0.8}; doubleLine = 0; }; class KillsInfantry @@ -136,9 +136,9 @@ class CfgInGameUI }; class KillsTotal { - width = 0.1; //0.1; + width = 0; //0.1; doubleLine = 0; - colorBg[] = {0.1,0.35,0.1,0.9}; //{0.1,0.35,0.1,0.9}; + colorBg[] = {0,0,0,0}; //{0.1,0.35,0.1,0.9}; picture = "\ca\ui\data\stats_total_ca.paa"; //"\ca\ui\data\stats_total_ca.paa"; }; }; diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index 0d3d3d3b4..36193d9ac 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -221,15 +221,10 @@ if (!isDedicated) then { dayz_spaceInterrupt = { private ["_dikCode", "_handled"]; - _DisplayOrDialogOrControl = _this select 0; _dikCode = _this select 1; - _shiftState = _this select 2; - _ctrlState = _this select 3; - _altState = _this select 4; _handled = false; - DoRE = ({isPlayer _x} count (player nearEntities ["AllVehicles",500]) > 1); - if (_dikCode in (actionKeys "GetOver")) then { + DoRE = ({isPlayer _x} count (player nearEntities ["AllVehicles",500]) > 1); if (canRoll && animationState player in ["amovpercmrunslowwrfldf","amovpercmrunsraswrfldf","amovpercmevaslowwrfldf","amovpercmevasraswrfldf"]) then { canRoll = false; null = [] spawn { @@ -281,7 +276,9 @@ if (!isDedicated) then { [player,15,false,(getPosATL player)] spawn player_alertZombies; }; + if ((_dikCode == 0x38 or _dikCode == 0xB8) and (time - dayz_lastCheckBit > 10)) then { + dayz_lastCheckBit = time; call dayz_forceSave; }; /* diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf index 333c37e0e..2e6844485 100644 --- a/dayz_code/init/variables.sqf +++ b/dayz_code/init/variables.sqf @@ -53,6 +53,7 @@ pz_priest = "pz_priest"; dayz_combatLog = ""; canRoll = true; +placevault = true; //Hunting Variables dayZ_partClasses = [ diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index 23fae4755..72a169744 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -87,7 +87,7 @@ class RscDisplayMain : RscStandardDisplay class DAYZ_Version : CA_Version { idc = -1; - text = "DayZ Epoch 0.85 (1.7.5.M1D25)"; + text = "DayZ Epoch 0.87 (1.7.5.M2D1)"; y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)"; }; class CA_TitleMainMenu; diff --git a/dayz_server/compile/fnc_plyrHit.sqf b/dayz_server/compile/fnc_plyrHit.sqf new file mode 100644 index 000000000..a2e0d0231 --- /dev/null +++ b/dayz_server/compile/fnc_plyrHit.sqf @@ -0,0 +1,20 @@ +private ["_victim", "_attacker","_weapon","_distance"]; +_victim = _this select 0; +_attacker = _this select 1; + +if (!isPlayer _victim || !isPlayer _attacker) exitWith {}; +if ((name _victim) == (name _attacker)) exitWith {}; + +_weapon = weaponState _attacker; +if (_weapon select 0 == "Throw") then { + _weapon = _weapon select 3; +} else { + _weapon = _weapon select 0; +}; + +_distance = _victim distance _attacker; + +_victim setVariable["AttackedBy", _attacker, true]; +_victim setVariable["AttackedByName", (name _attacker), true]; +_victim setVariable["AttackedByWeapon", _weapon, true]; +_victim setVariable["AttackedFromDistance", _distance, true]; \ No newline at end of file diff --git a/dayz_server/compile/server_gutObject.sqf b/dayz_server/compile/server_gutObject.sqf deleted file mode 100644 index b6e9012a6..000000000 --- a/dayz_server/compile/server_gutObject.sqf +++ /dev/null @@ -1,28 +0,0 @@ -private["_item","_qty","_type","_meat","_loop"]; -_item = _this select 0; -_qty = _this select 1; -_type = typeOf _item; -_meat = 0; -_loop = true; -_rawfoodtype = configFile >> "CfgSurvival" >> "Meat" >> _type >> "rawfoodtype"; - -if (local _item) then { - for "_x" from 1 to _qty do { - _item addMagazine _rawfoodtype; - }; - sleep 2; - _timer = time; - while {_loop} do { - _meat = count magazines _item; - if (_meat == 0) then {_loop = false}; - if ((time - _timer) > 300) then {_loop = false}; - sleep 1; - }; - ["dayzHideBody",_item] call broadcastRpcCallAll; - sleep 10; - deleteVehicle _item; -} else { - _ehLoc = "client"; - if (isServer) then { _ehLoc = "server"; }; - diag_log format["gutObject EH on %1 item not local ! Type: %2",_ehLoc,str(_item)]; -}; \ No newline at end of file diff --git a/dayz_server/compile/server_gutObjectZ.sqf b/dayz_server/compile/server_gutObjectZ.sqf deleted file mode 100644 index 24865000e..000000000 --- a/dayz_server/compile/server_gutObjectZ.sqf +++ /dev/null @@ -1,24 +0,0 @@ -private["_item","_qty","_type","_meat","_loop"]; -_item = _this select 0; -_qty = _this select 1; -_type = typeOf _item; -_meat = 0; -_loop = true; -if (local _item) then { - _item addMagazine "ItemZombieParts"; - sleep 2; - _timer = time; - while {_loop} do { - _meat = count magazines _item; - if (_meat == 0) then {_loop = false}; - if ((time - _timer) > 300) then {_loop = false}; - sleep 1; - }; - ["dayzHideBody",_item] call broadcastRpcCallAll; - sleep 10; - deleteVehicle _item; -} else { - _ehLoc = "client"; - if (isServer) then { _ehLoc = "server"; }; - diag_log format["gutObject EH on %1 item not local ! Type: %2",_ehLoc,str(_item)]; -}; \ No newline at end of file diff --git a/dayz_server/compile/server_playerDied.sqf b/dayz_server/compile/server_playerDied.sqf index b0be4beae..d1701408c 100644 --- a/dayz_server/compile/server_playerDied.sqf +++ b/dayz_server/compile/server_playerDied.sqf @@ -7,16 +7,36 @@ _playerID = _this select 3; _playerName = _this select 4; _infected = _this select 5; +_victim removeAllEventHandlers "MPHit"; + +_victim = _this select 2; +_victimName = _victim getVariable["bodyName", "nil"]; + +_killer = _victim getVariable["AttackedBy", "nil"]; +_killerName = _victim getVariable["AttackedByName", "nil"]; + +if (_killerName == "nil" || _victimName == _killerName) then { + _message = format["%1 Commited Suicide Or Was Killed By A Zombie",_victimName]; + _loc_message = format["KILLMSG: %1 Commited Suicide Or Was Killed By A Zombie", _victimName]; +} else { + _weapon = _victim getVariable["AttackedByWeapon", "nil"]; + _distance = _victim getVariable["AttackedFromDistance", "nil"]; + _message = format["%1 Was Killed By %2 With A %3",_victimName, _killerName, _weapon]; + _loc_message = format["KILLMSG: %1 Was Killed By %2 With A %3 From %4m", _victimName, _killerName, _weapon, _distance]; +}; + +diag_log _loc_message; +//SHOW THE MESSAGE INGAME [GLOBAL CHAT] +[nil, nil, rspawn, [_victim, _message], { (_this select 0) globalChat (_this select 1) }] call RE; + +_victim setVariable["AttackedBy", "nil", true]; +_victim setVariable["AttackedByName", "nil", true]; +_victim setVariable["AttackedByWeapon", "nil", true]; +_victim setVariable["AttackedFromDistance", "nil", true]; + dayz_disco = dayz_disco - [_playerID]; _newObject setVariable["processedDeath",time]; -/* -diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID")); -if (isnil "_characterID") then { -diag_log ("DW_DEBUG: _newObject: " + str(_newObject)); - }; -*/ - if (typeName _minutes == "STRING") then { _minutes = parseNumber _minutes; @@ -25,24 +45,9 @@ if (typeName _minutes == "STRING") then if (_characterID != "0") then { _key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected]; - //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; } else { deleteVehicle _newObject; }; - -diag_log ("PDEATH: Player Died " + _playerID); -/* -_eh = [_newObject] spawn { - _body = _this select 0; - _method = _body getVariable["deathType","unknown"]; - _name = _body getVariable["bodyName","unknown"]; - waitUntil{!isPlayer _body;sleep 1}; - _body setVariable["deathType",_method,true]; - _body setVariable["bodyName",_name,true]; - diag_log ("PDEATH: Player Left Body " + _name); -}; -*/ -//dead_bodyCleanup set [count dead_bodyCleanup,_newObject]; \ No newline at end of file diff --git a/dayz_server/compile/server_playerSetup.sqf b/dayz_server/compile/server_playerSetup.sqf index b92732f5d..bf501b452 100644 --- a/dayz_server/compile/server_playerSetup.sqf +++ b/dayz_server/compile/server_playerSetup.sqf @@ -10,6 +10,9 @@ if (isNull _playerObj) exitWith { diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj)); }; +//Add MPHit event handler +_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}]; + if (_playerID == "") then { _playerID = getPlayerUID _playerObj; }; diff --git a/dayz_server/init/server_functions.sqf b/dayz_server/init/server_functions.sqf index 6e617e65b..91f0884d6 100644 --- a/dayz_server/init/server_functions.sqf +++ b/dayz_server/init/server_functions.sqf @@ -21,6 +21,8 @@ server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\c zombie_findOwner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_findOwner.sqf"; server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf"; server_spawnCrashSite = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf"; +fnc_plyrHit = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf"; + vehicle_handleInteract = { private["_object"];