Remove fn_upgradeActions

Vanilla commit:

02bc22f325
This commit is contained in:
ebaydayz
2017-01-26 21:19:17 -05:00
parent 6c2f5448e1
commit c7b71f93f0
10 changed files with 24 additions and 125 deletions

View File

@@ -1,9 +1,9 @@
private ["_cursorTarget","_onLadder","_isWater","_alreadyRemoving","_characterID","_objectID","_objectUID","_ownerArray","_dir",
"_realObjectStillThere","_upgrade","_entry","_parent","_requiredParts","_requiredTools","_model","_toolsOK","_displayname",
"_whpos","_i","_wh","_object","_vector","_dis","__FILE__","_puid","_variables"];
"_whpos","_wh","_object","_vector","_dis","_puid","_variables"];
_cursorTarget = _this select 3;
_cursorTarget = _this;
// ArmaA2 bug workaround: sometimes the object is null
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
@@ -13,9 +13,7 @@ if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
if(isNull _cursorTarget) exitWith { localize "str_disassembleNoOption" call dayz_rollingMessages; };
//Remove action Menu
player removeAction s_player_disassembly;
s_player_disassembly = -1;
if (player getVariable["alreadyBuilding",0] == 1) exitWith { localize "str_upgradeInProgress" call dayz_rollingMessages; };
//Normal blocked stuff
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

View File

@@ -7,7 +7,7 @@
private ["_isMedic","_cursorTarget","_item","_classname","_displayname","_requiredTools","_requiredParts","_onLadder","_isWater","_upgradeParts","_startMaintenance","_dis","_sfx","_started","_finished","_animState","_isRefuel"];
_cursorTarget = _this select 3;
_cursorTarget = _this;
// ArmaA2 bug workaround: sometimes the object is null
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
@@ -19,9 +19,9 @@ if(isNull _cursorTarget) exitWith {
localize "str_maintenanceNoOption" call dayz_rollingMessages;
};
//Remove action Menu
player removeAction s_player_maintenance;
s_player_maintenance = -1;
if (player getVariable["alreadyBuilding",0] == 1) exitWith {
localize "str_upgradeInProgress" call dayz_rollingMessages;
};
//Item
_item = typeof _cursorTarget;

View File

@@ -9,12 +9,11 @@
};
*/
private ["_objclass","_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig",
private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig",
"_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis",
"_sfx","_ownerID","_objectID","_objectUID","_alreadyupgrading","_dir","_weapons","_magazines","_backpacks","_object",
"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector"];
_objclass = _this;
_cursorTarget = _this select 3;
_item = typeof _cursorTarget;
@@ -129,11 +128,8 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
player playActionNow "Medic";
//remove old tent
_activatingPlayer = player;
PVDZ_obj_Destroy = [_objectID,_objectUID, _activatingPlayer];
PVDZ_obj_Destroy = [_objectID,_objectUID,player];
publicVariableServer "PVDZ_obj_Destroy";
if (isServer) then { PVDZ_obj_Destroy call server_deleteObj; };
deleteVehicle _cursorTarget;
// remove parts from players inventory before creation of new tent.
@@ -186,8 +182,13 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
uiSleep 3;
//publish new tent
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],[_weapons,_magazines,_backpacks]];
//publish new tent
if (DZE_permanentPlot) then {
_object setVariable ["ownerPUID",dayz_playerUID,true];
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos, dayz_playerUID],[_weapons,_magazines,_backpacks]];
} else {
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],[_weapons,_magazines,_backpacks]];
};
publicVariableServer "PVDZ_obj_Publish";
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];

View File

@@ -15,9 +15,7 @@ private ["_cursorTarget","_type","_class","_requiredTools","_requiredParts","_up
"_upgradeClass","_onLadder","_isWater","_ok","_missing","_upgradeParts","_dis","_characterID","_objectID","_objectUID",
"_ownerArray","_ownerPasscode","_dir","_vector","_object","_puid","_clanArray","_wh","_variables"];
//systemchat str _this;
_cursorTarget = _this select 3;
_cursorTarget = _this;
// ArmaA2 bug workaround: sometimes the object is null
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
@@ -25,9 +23,6 @@ if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
};
if (isNull _cursorTarget) exitWith {};
player removeAction s_player_building;
s_player_building = -1;
_type = typeof _cursorTarget;
_class = configFile >> "CfgVehicles" >> _type;
_requiredTools = getArray (_class >> "Upgrade" >> "requiredTools");
@@ -131,8 +126,7 @@ _object setVariable ["characterID",_characterID,true];
//remove old object
deleteVehicle _cursorTarget;
_activatingPlayer = player;
PVDZ_obj_Destroy = [_objectID,_objectUID, _activatingPlayer];
PVDZ_obj_Destroy = [_objectID,_objectUID,player];
publicVariableServer "PVDZ_obj_Destroy";
// create a weaponholder with dismissed parts

View File

@@ -1,8 +1,8 @@
#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_DAMAGED (damage _object > 0)
#define IS_DAMAGED (damage _object > 0)
#define IS_PZOMBIE (player isKindOf "PZombie_VB")
/*
@@ -24,9 +24,9 @@ _show = switch _action do {
//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)};
//Built Items (Fence,Gates)
//case "ObjectUpgrade": {!(_object getVariable['BuildLock',false])};
//case "ObjectMaintenance": {!(_object getVariable['Maintenance',false]) OR IS_DAMAGED};
//case "ObjectDisassembly": {((getPlayerUID player) in _object getVariable ["ownerArray",[]]) && (isClass (configFile >> "CfgVehicles" >> (typeof _object) >> "Disassembly")) && HAS_TOOLBOX};
//case "ObjectUpgrade": {CAN_DO && !IN_VEHICLE && !(_object getVariable["BuildLock",false])};
//case "ObjectMaintenance": {CAN_DO && !IN_VEHICLE && (_object getVariable["Maintenance",false] or IS_DAMAGED)};
//case "ObjectDisassembly": {CAN_DO && !IN_VEHICLE && HAS_TOOLBOX && !(_object getVariable["BuildLock",false]) && ((getPlayerUID player in _object getVariable["ownerArray",[]]) or (count (_object getVariable["ownerArray",[]]) == 0) or (typeOf _object in ["WoodenFence_1_foundation","WoodenGate_foundation"]))};
default {false};
};

View File

@@ -1,85 +0,0 @@
private ["_vehicle","_inVehicle","_cursorTarget","_onLadder","_canDo","_ownerArray","_text","_ownerBuildLock"];
scriptName "Functions\misc\fn_upgradeActions.sqf";
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_cursorTarget = cursorTarget;
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
};
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
r_action_build = false;
dayz_resetUpgradeActions = {
player removeAction s_player_building;
s_player_building = -1;
player removeAction s_player_maintenance;
s_player_maintenance = -1;
player removeAction s_player_disassembly;
s_player_disassembly = -1;
};
if ((player getVariable["alreadyBuilding",0]) == 1) exitWith { call dayz_resetUpgradeActions; };
_maintenanceMode = _cursorTarget getVariable["Maintenance",false];
if (!isNull _cursorTarget and !_inVehicle and (player distance _cursorTarget < 4) and _canDo) then {
_ownerArray = _cursorTarget getVariable ["ownerArray",[]];
_ownerBuildLock = _cursorTarget getVariable ["BuildLock",false];
// diag_log [ diag_tickTime, __FILE__, "_ownerArray", _ownerArray, "PlayerUID", getPlayerUID player];
//building System
_text = getText (configFile >> "CfgVehicles" >> typeOf _cursorTarget >> "displayName");
/*
if ((_cursorTarget iskindof "DZ_buildables") and !_ownerBuildLock) then {
if (s_player_building < 0) then {
if (isText (configFile >> "CfgVehicles" >> (typeof _cursorTarget) >> "Upgrade" >> "create")) then {
s_player_building = player addAction [format[localize "str_upgrade",_text], "\z\addons\dayz_code\actions\object_upgradebuilding.sqf",_cursorTarget, 0, false, true, "",""];
};
};
} else {
player removeAction s_player_building;
s_player_building = -1;
};
if ((_maintenanceMode or (damage _cursorTarget > 0)) and (_cursorTarget iskindof "DZ_buildables") and isClass(configFile >> "CfgVehicles" >> (typeof _cursorTarget) >> "Maintenance")) then {
if (s_player_maintenance < 0) then {
s_player_maintenance = player addAction [format[localize "str_maintenance",_text], "\z\addons\dayz_code\actions\object_maintenance.sqf",_cursorTarget, 0, false, true, "", ""];
};
} else {
player removeAction s_player_maintenance;
s_player_maintenance = -1;
};
if ((((getPlayerUID player) in _ownerArray) or (count _ownerArray == 0) or ((typeof _cursorTarget) in ["WoodenFence_1_foundation","WoodenGate_foundation"])) and !_ownerBuildLock) then {
if (s_player_disassembly < 0) then {
if (isClass (configFile >> "CfgVehicles" >> (typeof _cursorTarget) >> "Disassembly")) then {
s_player_disassembly = player addAction [format[localize "str_disassembly",_text], "\z\addons\dayz_code\actions\object_disassembly.sqf",_cursorTarget, 0, false, true, "", "'ItemToolbox' in items player"];
};
};
} else {
player removeAction s_player_disassembly;
s_player_disassembly = -1;
};
*/
} else {
call dayz_resetUpgradeActions;
};
/*
dayz_resetUpgradeActions = {
s_player_disassembly = -1;
s_player_building = -1;
s_player_maintenance = -1;
};
*/
//Monitor
player setVariable ["upgradeActions", diag_ticktime, false];

View File

@@ -25,7 +25,6 @@ if (!isDedicated) then {
fnc_usec_damageActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageActions.sqf"; //Checks which actions for nearby casualty
fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf"; //Checks which actions for self
fnc_usec_upgradeActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_upgradeActions.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";

View File

@@ -262,13 +262,6 @@ dayz_resetSelfActions = {
};
call dayz_resetSelfActions;
dayz_resetUpgradeActions = {
s_player_disassembly = -1;
s_player_building = -1;
s_player_maintenance = -1;
};
call dayz_resetUpgradeActions;
//Engineering variables
s_player_lastTarget = objNull;
s_player_repairActions = [];

View File

@@ -414,7 +414,7 @@ while {1 == 1} do {
_stop = diag_tickTime;
/*
if ((diag_tickTime - _timerMonitor) > 60) then {
diag_log format ["Loop Monitor - Spawn2: %1, DA: %2, UA: %3, SA: %4",(_stop - _start),(diag_tickTime - (player getVariable "damageActions")),(diag_tickTime - (player getVariable "upgradeActions")),(diag_tickTime - (player getVariable "selfActions"))];
diag_log format ["Loop Monitor - Spawn2: %1, DA: %2, SA: %3",(_stop - _start),(diag_tickTime - (player getVariable "damageActions")),(diag_tickTime - (player getVariable "selfActions"))];
_timerMonitor = diag_ticktime;
};
*/

View File

@@ -4,7 +4,6 @@ sched_playerActions = {
HIDE_FSM_VARS
call fnc_usec_selfActions;
call fnc_usec_damageActions;
call fnc_usec_upgradeActions;
//combat check
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]}) then {