From d416ae80ab008f01e6e089d7d234515693e1f772 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Tue, 21 Feb 2017 15:12:41 -0500 Subject: [PATCH] Move study body back to fn_selfActions Adding UserActions to players (CAManBase) is not efficient, because the condition evaluates onEachFrame when you are "inside" that vehicle type. Also admins usually want to add more custom actions to dead bodies anyway. https://community.bistudio.com/wiki/addAction#Syntax This partially reverts 3aad4b6. --- CHANGE LOG 1.0.6.1.txt | 1 + SQF/dayz_code/Configs/CfgVehicles/Skins.hpp | 16 ---------------- SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp | 1 - SQF/dayz_code/actions/study_body.sqf | 2 +- SQF/dayz_code/actions/userActionConditions.sqf | 3 +-- SQF/dayz_code/compile/fn_selfActions.sqf | 12 ++++++++++++ SQF/dayz_code/init/compiles.sqf | 1 - SQF/dayz_code/init/variables.sqf | 1 + 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CHANGE LOG 1.0.6.1.txt b/CHANGE LOG 1.0.6.1.txt index c75252d5f..b44fff9c2 100644 --- a/CHANGE LOG 1.0.6.1.txt +++ b/CHANGE LOG 1.0.6.1.txt @@ -26,6 +26,7 @@ [CHANGED] SpawnCheck for loot and zombies has been lowered to 200m and switched to nearObjects instead of nearestObjects (same as 1051) for better client FPS. #1816 [CHANGED] Increased head shot damage for normal hits (non-zombie and non-melee) [CHANGED] Slightly increased damage from vehicle run over +[CHANGED] Moved study body back to fn_selfActions for easy admin customization. [FIXED] Wrong texture for z_hunter zombie. #1805 @schwanzkopfhegel @ebayShopper [FIXED] Refuel with generator at gas station not working. #1806 @Helios27 @ebayShopper diff --git a/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp b/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp index 74795bd52..5dad8e4a7 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Skins.hpp @@ -8,22 +8,6 @@ class CAManBase: Man //includes all skins except animals class HitHead; class HitBody; }; - class UserActions - { - class StudyBody - { - displayName = $STR_ACTION_STUDYBODY; - displayNameDefault = $STR_ACTION_STUDYBODY; - priority = 0; - radius = 3; - position = ""; - showWindow = 0; - onlyForPlayer = 1; - shortcut = ""; - condition = "(['StudyBody',this] call userActionConditions)"; - statement = "this call player_studyBody;"; - }; - }; }; class Civilian: CAManBase { diff --git a/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp b/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp index 653a6f8f2..3fa9935a0 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp @@ -73,7 +73,6 @@ class zZombie_Base : Zed_Base { condition = "(['Butcher',this] call userActionConditions)"; statement = "this spawn player_butcher;"; }; - delete StudyBody; }; class HitPoints { diff --git a/SQF/dayz_code/actions/study_body.sqf b/SQF/dayz_code/actions/study_body.sqf index dcf5415fb..a664c047c 100644 --- a/SQF/dayz_code/actions/study_body.sqf +++ b/SQF/dayz_code/actions/study_body.sqf @@ -1,6 +1,6 @@ private["_body","_name","_method","_methodStr","_message","_killingBlow"]; -_body = _this; +_body = _this select 3; _name = _body getVariable["bodyName","unknown"]; _method = _body getVariable["deathType","unknown"]; _methodStr = localize format ["str_death_%1",_method]; diff --git a/SQF/dayz_code/actions/userActionConditions.sqf b/SQF/dayz_code/actions/userActionConditions.sqf index 6554e80b6..6a268a7e5 100644 --- a/SQF/dayz_code/actions/userActionConditions.sqf +++ b/SQF/dayz_code/actions/userActionConditions.sqf @@ -6,7 +6,7 @@ #define IS_PZOMBIE (player isKindOf "PZombie_VB") /* - (['StudyBody',this] call userActionConditions) + (['Butcher',this] call userActionConditions) Return - must be true for action to show. */ @@ -17,7 +17,6 @@ _action = _this select 0; _object = _this select 1; _show = switch _action do { - case "StudyBody": {!IS_ALIVE}; case "Butcher": {!IS_ALIVE && !IN_VEHICLE && CAN_DO && !(_object getVariable["meatHarvested",false]) && !IS_PZOMBIE}; case "Drink": {!IN_VEHICLE && CAN_DO && !dayz_isSwimming}; case "PushPlane": {IS_ALIVE && !IN_VEHICLE && CAN_DO && count crew _object == 0 && !isEngineOn _object && !IS_PZOMBIE}; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index db9af2e68..1dd648364 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -476,6 +476,16 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur player removeAction s_player_sleep; s_player_sleep = -1; }; + + //Study Body + if (_cursorTarget getVariable["bodyName",""] != "") then { + if (s_player_studybody < 0) then { + s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true]; + }; + } else { + player removeAction s_player_studybody; + s_player_studybody = -1; + }; /* //Carbomb _hasCarBomb = "ItemCarBomb" in _magazinesPlayer; @@ -1038,6 +1048,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_packtentinfected = -1; player removeAction s_player_fillfuel; s_player_fillfuel = -1; + player removeAction s_player_studybody; + s_player_studybody = -1; //fuel player removeAction s_player_fillfuel210; s_player_fillfuel210 = -1; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 682550753..d72da00f1 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -123,7 +123,6 @@ if (!isDedicated) then { player_pushPlane = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_pushPlane.sqf"; //player_repairVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\repair_vehicle.sqf"; //player_salvageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\salvage_vehicle.sqf"; - player_studyBody = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\study_body.sqf"; //ui player_toggleSoundMute = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_toggleSoundMute.sqf"; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 1f115a6bf..48480a380 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -177,6 +177,7 @@ dayz_resetSelfActions = { s_player_grabflare = -1; s_player_removeflare = -1; s_player_painkiller = -1; + s_player_studybody = -1; s_build_Sandbag1_DZ = -1; s_build_Hedgehog_DZ = -1; s_build_Wire_cat1 = -1;