From ec6b5eb67930238fbe85ade4156ce77d76709eb9 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 23 Nov 2016 13:34:22 -0500 Subject: [PATCH] Move Repair and Salvage back to fn_selfActions Partial revert of: 3aad4b6 Unfortunately this will not support loading external vehicle addons (with custom UserActions) which we can not include in Epoch. Child UserActions overwrite inherited UserActions. --- .../Configs/CfgVehicles/Bikes/MMT_Civ.hpp | 4 +-- .../Configs/CfgVehicles/Bikes/Old_bike.hpp | 8 +++--- .../Configs/CfgVehicles/Boat/RHIB.hpp | 4 +-- .../Configs/CfgVehicles/CfgVehicles.hpp | 13 +++++---- .../Configs/CfgVehicles/DZE/CSJ_GyroAC.hpp | 8 +++--- .../Configs/CfgVehicles/DZE/Prop_Defs.hpp | 2 +- .../Configs/CfgVehicles/Helicopter/CH53.hpp | 4 +-- .../Configs/CfgVehicles/Helicopter/MI17.hpp | 4 +-- .../Configs/CfgVehicles/Helicopter/UH1Y.hpp | 4 +-- .../Configs/CfgVehicles/Plane/MV22.hpp | 4 +-- .../Configs/CfgVehicles/Zeds/Zeds.hpp | 1 + SQF/dayz_code/actions/repair_cancel.sqf | 1 + SQF/dayz_code/actions/repair_vehicle.sqf | 3 +- SQF/dayz_code/actions/salvage.sqf | 2 ++ SQF/dayz_code/actions/salvage_vehicle.sqf | 3 +- .../actions/userActionConditions.sqf | 8 +++--- SQF/dayz_code/compile/fn_selfActions.sqf | 28 +++++++++++++++++++ SQF/dayz_code/init/compiles.sqf | 4 +-- SQF/dayz_code/init/variables.sqf | 3 +- 19 files changed, 72 insertions(+), 36 deletions(-) diff --git a/SQF/dayz_code/Configs/CfgVehicles/Bikes/MMT_Civ.hpp b/SQF/dayz_code/Configs/CfgVehicles/Bikes/MMT_Civ.hpp index 2dcc17a89..954f9d77a 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Bikes/MMT_Civ.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Bikes/MMT_Civ.hpp @@ -3,9 +3,9 @@ class MMT_Civ: MMT_base { typicalCargo[] = {}; class TransportMagazines {}; class TransportWeapons {}; - class UserActions + /*class UserActions { class Repair {ACTION_REPAIR; radius = 4;}; delete Salvage; - }; + };*/ }; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/CfgVehicles/Bikes/Old_bike.hpp b/SQF/dayz_code/Configs/CfgVehicles/Bikes/Old_bike.hpp index 8ead6df34..4a79ca384 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Bikes/Old_bike.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Bikes/Old_bike.hpp @@ -3,11 +3,11 @@ class Old_bike_TK_CIV_EP1: Old_bike_base_EP1 { typicalCargo[] = {}; class TransportMagazines {}; class TransportWeapons {}; - class UserActions + /*class UserActions { class Repair {ACTION_REPAIR; radius = 4;}; delete Salvage; - }; + };*/ }; class Old_bike_TK_INS_EP1: Old_bike_base_EP1 { @@ -15,9 +15,9 @@ class Old_bike_TK_INS_EP1: Old_bike_base_EP1 { typicalCargo[] = {}; class TransportMagazines {}; class TransportWeapons {}; - class UserActions + /*class UserActions { class Repair {ACTION_REPAIR; radius = 4;}; delete Salvage; - }; + };*/ }; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/CfgVehicles/Boat/RHIB.hpp b/SQF/dayz_code/Configs/CfgVehicles/Boat/RHIB.hpp index e6d0d345a..8009a7024 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Boat/RHIB.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Boat/RHIB.hpp @@ -5,11 +5,11 @@ //class DefaultEventhandlers; class Ship : AllVehicles { - class UserActions + /*class UserActions { class Repair {ACTION_REPAIR; radius = 8;}; class Salvage {ACTION_SALVAGE; radius = 8;}; - }; + };*/ transportMaxMagazines = 2000; transportMaxWeapons = 200; transportMaxBackpacks = 40; diff --git a/SQF/dayz_code/Configs/CfgVehicles/CfgVehicles.hpp b/SQF/dayz_code/Configs/CfgVehicles/CfgVehicles.hpp index d64610e90..644a4596e 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/CfgVehicles.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/CfgVehicles.hpp @@ -137,11 +137,12 @@ class CfgVehicles { class ViewOptics; }; }; - class UserActions + //Won't support loading external vehicle addons (with custom UserActions) which we can not include in Epoch. Child UserActions overwrite inherited UserActions. + /*class UserActions { class Repair {ACTION_REPAIR; radius = 8;}; class Salvage {ACTION_SALVAGE; radius = 8;}; - }; + };*/ }; class Plane: Air { @@ -155,8 +156,8 @@ class CfgVehicles { class AnimationSources; class UserActions { - class Repair {ACTION_REPAIR; radius = 8;}; - class Salvage {ACTION_SALVAGE; radius = 8;}; + //class Repair {ACTION_REPAIR; radius = 8;}; + //class Salvage {ACTION_SALVAGE; radius = 8;}; class PushPlane {ACTION_PUSH;}; }; }; @@ -191,11 +192,11 @@ class CfgVehicles { brightness = 0.5; }; }; - class UserActions + /*class UserActions { class Repair {ACTION_REPAIR; radius = 4;}; class Salvage {ACTION_SALVAGE; radius = 4;}; - }; + };*/ }; class Car: LandVehicle { class HitPoints diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/CSJ_GyroAC.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/CSJ_GyroAC.hpp index d13bdfa81..9d14f20c5 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/CSJ_GyroAC.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/CSJ_GyroAC.hpp @@ -112,8 +112,8 @@ class CSJ_GyroP: Plane condition = "(Count (Crew this)==0) and ((getpos this select 2) <1) and (!isengineon this)"; statement = "this exec ""\CSJ_GyroAC\scripts\CSJ_moveGyro.sqs"" "; }; - class Repair {ACTION_REPAIR; radius = 4;}; - class Salvage {ACTION_SALVAGE; radius = 4;}; + //class Repair {ACTION_REPAIR; radius = 4;}; + //class Salvage {ACTION_SALVAGE; radius = 4;}; }; class DefaultEventhandlers; class EventHandlers: DefaultEventhandlers @@ -223,8 +223,8 @@ class CSJ_GyroC: Helicopter class Reflectors{}; class AnimationSources: AnimationSources{}; class UserActions { - class Repair {ACTION_REPAIR; radius = 4;}; - class Salvage {ACTION_SALVAGE; radius = 4;}; + //class Repair {ACTION_REPAIR; radius = 4;}; + //class Salvage {ACTION_SALVAGE; radius = 4;}; }; class DefaultEventhandlers; class EventHandlers: DefaultEventhandlers diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp index ea5e94598..d2df4dae5 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/Prop_Defs.hpp @@ -483,7 +483,7 @@ class M240Nest_DZ: USMC_WarfareBMGNest_M240 transportMaxBackpacks = 1; constructioncount = 10; removeoutput[] = {{"m240_nest_kit",1}}; - class UserActions {delete Repair; delete Salvage;}; + //class UserActions {delete Repair; delete Salvage;}; }; class Land_covering_hut_EP1; class CanvasHut_DZ: Land_covering_hut_EP1 diff --git a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/CH53.hpp b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/CH53.hpp index 5e043783e..478d7ed0c 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/CH53.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/CH53.hpp @@ -33,7 +33,7 @@ class CH53_DZE : USEC_ch53_E { init = "MonitorVM = [_this select 0] execvm '\usec_ch53\scripts\ch53_monitor.sqf';MonitorSFXVM = [_this select 0] execvm '\usec_ch53\scripts\ch53_monitorSFX.sqf';"; killed = "_this spawn BIS_Effects_EH_Killed;"; }; - class UserActions { + /*class UserActions { class Repair {ACTION_REPAIR; radius = 8;}; class Salvage {ACTION_SALVAGE; radius = 8;}; class RampOpen { @@ -110,5 +110,5 @@ class CH53_DZE : USEC_ch53_E { condition = "((this animationPhase 'cargo' == 0) OR (this animationPhase 'cargo2' == 0));"; statement = "[this] execvm ""\usec_ch53\scripts\ch53_cargodrop.sqf"";"; }; - }; + };*/ }; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/MI17.hpp b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/MI17.hpp index 64ee280ac..a67f60353 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/MI17.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/MI17.hpp @@ -295,8 +295,8 @@ class Mi171Sh_CZ_EP1_DZ: Mi17_base { }; class UserActions { - class Repair {ACTION_REPAIR; radius = 8;}; - class Salvage {ACTION_SALVAGE; radius = 8;}; + //class Repair {ACTION_REPAIR; radius = 8;}; + //class Salvage {ACTION_SALVAGE; radius = 8;}; class HUDoff { displayName = $STR_AM_HUDON; displayNameDefault = $STR_AM_HUDON; diff --git a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/UH1Y.hpp b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/UH1Y.hpp index 8a7eb36a1..6de1ad060 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Helicopter/UH1Y.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Helicopter/UH1Y.hpp @@ -89,8 +89,8 @@ class UH1Y_DZ: UH1_Base { }; };*/ class UserActions { - class Repair {ACTION_REPAIR; radius = 8;}; - class Salvage {ACTION_SALVAGE; radius = 8;}; + //class Repair {ACTION_REPAIR; radius = 8;}; + //class Salvage {ACTION_SALVAGE; radius = 8;}; class HUDoff { displayName = $STR_AM_HUDON; displayNameDefault = $STR_AM_HUDON; diff --git a/SQF/dayz_code/Configs/CfgVehicles/Plane/MV22.hpp b/SQF/dayz_code/Configs/CfgVehicles/Plane/MV22.hpp index e5ad33626..fe2214827 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Plane/MV22.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Plane/MV22.hpp @@ -16,8 +16,8 @@ class MV22_DZ : MV22 { fuelCapacity = 6513; class UserActions { - class Repair {ACTION_REPAIR; radius = 8;}; - class Salvage {ACTION_SALVAGE; radius = 8;}; + //class Repair {ACTION_REPAIR; radius = 8;}; + //class Salvage {ACTION_SALVAGE; radius = 8;}; class PushPlane {ACTION_PUSH;}; }; }; diff --git a/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp b/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp index a5f2db03f..f5e7b900e 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/Zeds/Zeds.hpp @@ -74,6 +74,7 @@ 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/repair_cancel.sqf b/SQF/dayz_code/actions/repair_cancel.sqf index 54a347f6e..7cd6319c5 100644 --- a/SQF/dayz_code/actions/repair_cancel.sqf +++ b/SQF/dayz_code/actions/repair_cancel.sqf @@ -1,2 +1,3 @@ {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = []; +s_player_repair_crtl = -1; dayz_myCursorTarget = objNull; \ No newline at end of file diff --git a/SQF/dayz_code/actions/repair_vehicle.sqf b/SQF/dayz_code/actions/repair_vehicle.sqf index af00b62e7..a2ddf688d 100644 --- a/SQF/dayz_code/actions/repair_vehicle.sqf +++ b/SQF/dayz_code/actions/repair_vehicle.sqf @@ -1,6 +1,6 @@ private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh"]; -_vehicle = _this; +_vehicle = _this select 3; {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = []; dayz_myCursorTarget = _vehicle; @@ -39,4 +39,5 @@ if (count _hitpoints > 0) then { // Localized in A2OA\Expansion\dta\languagecore _cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\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/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf index f7d653812..cdbe3cb8a 100644 --- a/SQF/dayz_code/actions/salvage.sqf +++ b/SQF/dayz_code/actions/salvage.sqf @@ -19,6 +19,7 @@ _namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName"); {_vehicle removeAction _x} count s_player_repairActions; s_player_repairActions = []; +s_player_repair_crtl = 1; if (_hasToolbox) then { player playActionNow "Medic"; @@ -93,6 +94,7 @@ if (_hasToolbox) then { }; dayz_myCursorTarget = objNull; +s_player_repair_crtl = -1; dayz_salvageInProgress = false; //adding melee mags back if needed diff --git a/SQF/dayz_code/actions/salvage_vehicle.sqf b/SQF/dayz_code/actions/salvage_vehicle.sqf index f7c6cce30..9894de69d 100644 --- a/SQF/dayz_code/actions/salvage_vehicle.sqf +++ b/SQF/dayz_code/actions/salvage_vehicle.sqf @@ -1,7 +1,7 @@ private ["_part","_color","_vehicle","_PlayerNear","_hitpoints","_isATV","_is6WheelType","_HasNoGlassKind", "_6WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"]; -_vehicle = _this; +_vehicle = _this select 3; {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = []; _PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1; @@ -73,4 +73,5 @@ if (count _hitpoints > 0 ) then { // Localized in A2OA\Expansion\dta\languagecore _cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\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/SQF/dayz_code/actions/userActionConditions.sqf b/SQF/dayz_code/actions/userActionConditions.sqf index 35a921532..a5f5141df 100644 --- a/SQF/dayz_code/actions/userActionConditions.sqf +++ b/SQF/dayz_code/actions/userActionConditions.sqf @@ -1,5 +1,5 @@ #define CAN_DO (!r_drag_sqf && !r_player_unconscious && getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder") != 1) -#define HAS_TOOLBOX ("ItemToolbox" in items player) +//#define HAS_TOOLBOX ("ItemToolbox" in items player) #define IN_VEHICLE (vehicle player != player) #define IS_ALIVE (damage _object < 1) #define IS_PZOMBIE (player isKindOf "PZombie_VB") @@ -12,9 +12,9 @@ _object = _this select 1; _show = switch _action do { case "Butcher": {!IS_ALIVE && !IN_VEHICLE && CAN_DO && !(_object getVariable["meatHarvested",false]) && !IS_PZOMBIE}; case "PushPlane": {IS_ALIVE && !IN_VEHICLE && CAN_DO && count crew _object == 0 && !isEngineOn _object && !IS_PZOMBIE}; - case "Repair": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX}; - case "Salvage": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX && (DZE_salvageLocked or !locked _object)}; - case "StudyBody": {!IS_ALIVE && !IN_VEHICLE && !(_object isKindOf "zZombie_base")}; + //case "Repair": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX}; + //case "Salvage": {IS_ALIVE && !IN_VEHICLE && CAN_DO && _object != dayz_myCursorTarget && HAS_TOOLBOX && (DZE_salvageLocked or !locked _object)}; + case "StudyBody": {!IS_ALIVE}; default {false}; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 77155132e..5b7cd791c 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -506,6 +506,30 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_attach_bomb = -1; }; */ + //Repairing Vehicles + if (_isVehicle && {!_isMan} && {dayz_myCursorTarget != _cursorTarget} && {_hasToolbox} && {damage _cursorTarget < 1} && {_typeOfCursorTarget != "M240Nest_DZ"}) then { + if (s_player_repair_crtl < 0) then { + dayz_myCursorTarget = _cursorTarget; + _menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false]; + if (!_isBicycle) then { //Bike wheels should not give full size tires. Also model does not update to show removed wheels. + if (!DZE_salvageLocked) then { + if (!locked _cursorTarget) then { + _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false]; + s_player_repairActions set [count s_player_repairActions,_menu1]; + }; + } else { + _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false]; + s_player_repairActions set [count s_player_repairActions,_menu1]; + }; + }; + s_player_repairActions set [count s_player_repairActions,_menu]; + s_player_repair_crtl = 1; + } else { + {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions; + s_player_repairActions = []; + s_player_repair_crtl = -1; + }; + }; /* //Vanilla base building currently not used in Epoch // House locking and unlocking _isHouse = _typeOfCursorTarget in ["SurvivorWorkshopAStage5", "SurvivorWorkshopBStage5", "SurvivorWorkshopCStage5"]; @@ -1024,6 +1048,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_plot_take_ownership = -1; player removeAction s_player_plotManagement; s_player_plotManagement = -1; + {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = []; + player removeAction s_player_repair_crtl; + s_player_repair_crtl = -1; + dayz_myCursorTarget = objNull; player removeAction s_player_flipveh; s_player_flipveh = -1; player removeAction s_player_sleep; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 6821289f7..00314b7d4 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -127,8 +127,8 @@ if (!isDedicated) then { player_sharpen = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sharpen.sqf"; player_butcher = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\gather_meat.sqf"; 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_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 diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 1f364ffba..1a9c96a2d 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -141,7 +141,7 @@ pickupInit = false; mouseOverCarry = false; //for carry slot since determining mouse pos doesn't work right dayZ_partClasses = ["PartFueltank","PartWheel","PartEngine"]; //No need to add PartGeneric, it is default for everything dayZ_explosiveParts = ["palivo","motor"]; -if (isNil "infectedWaterHoles") then {infectedWaterHoles = [];}; +if (isNil "infectedWaterHoles") then {infectedWaterHoles = [];}; //Needed for non-cherno maps //Survival Variables SleepFood = 2160; //minutes (48 hours) @@ -190,6 +190,7 @@ dayz_resetSelfActions = { s_player_fillfuel20 = -1; s_player_fillfuel5 = -1; s_player_siphonfuel = -1; + s_player_repair_crtl = -1; s_player_fishing = -1; s_player_fishing_veh = -1; s_player_gather = -1;