Remove no longer used code from dayz fences

This commit is contained in:
AirwavesMan
2020-06-18 20:26:33 +02:00
parent 3724a1f385
commit 9bf7cd3219
11 changed files with 121 additions and 395 deletions

View File

@@ -23,4 +23,5 @@ Folder for old scripts that are no longer used by epoch. All scripts can still b
//curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\old\fn_curTimeStr.sqf";
//fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\old\fn_niceSpot.sqf";
//call compile preprocessFileLineNumbers "\z\addons\dayz_code\old\achievements_init.sqf";
//fnc_Obj_FenceHandleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\old\fence_handleDam.sqf";
//fnc_Obj_FenceHandleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\old\fence_handleDam.sqf";
//call compile preprocessFileLineNumbers "\z\addons\dayz_code\old\fn_padlock.sqf";

View File

@@ -0,0 +1,120 @@
/*
File: fn_Padlock.sqf
Author: Deadactionman
Artwork: Dead Meat
Date: 25/01/15 (uk)
Description:
DayZ Padlock Functions
*/
padlockIDD = 76761;
padlockColourDay = [0.85,0.85,0.85,1];
padlockColourNight = [0.18,0.18,0.18,1];
padlock_open = {
disableSerialization;
_sunrise = call world_sunRise;
_colour = padlockColourDay;
if(daytime > _sunrise && daytime < (24 - _sunrise)) then {
_colour = padlockColourDay;
} else
{
_colour = padlockColourNight;
};
_path = "z\addons\dayz_code\gui\padlock\";
_target = _this select 0; // TARGET LOCKABLE OBJECT
_newCode = _this select 1; // TRUE/FALSE SETTING A NEW CODE?
_digitArray = [];
_codeHistory = count(_target getVariable["dayz_padlockHistory",[]]) == 4;
if (!_newCode && _codeHistory) then {_digitArray = _target getVariable["dayz_padlockHistory",[]];};
if (count _digitArray != 4) then {
// NO OBJECT CODE SO GENERATE A RANDOM ONE
_digitArray = [0,0,0,0];
{
_digitArray set[_forEachIndex,floor(random 10)];
} forEach _digitArray;
};
createDialog "DAYZ_PADLOCK";
waitUntil{!isNull (findDisplay padlockIDD)};
ctrlEnable [1200,true];
//ctrlSetText [1200, format["z\addons\dayz_code\gui\padlock\padlock_512X512.paa"]];
_control = ((findDisplay padlockIDD) displayCtrl 1200);
_control ctrlSetTextColor _colour;
uiNamespace setVariable ["dayz_padlockColour", _colour];
uiNamespace setVariable ["dayz_padlockCode", _digitArray];
uiNamespace setVariable ["dayz_padlockNewCode",_newCode];
uiNamespace setVariable ["dayz_padlockTarget",_target];
_null = [_digitArray] spawn padlock_digitSet;
};
padlock_click = {
_digitArray = uiNamespace getVariable ["dayz_padlockCode", [0,0,0,0]];
_buttonID = _this;
_newDigit = 0;
_inc = 0;
_id = 0;
switch (_buttonID) do {
case "1L": {_inc = 1;_id = 0;};
case "1R": {_inc = -1;_id = 0;};
case "2L": {_inc = 1;_id = 1;};
case "2R": {_inc = -1;_id = 1;};
case "3L": {_inc = 1;_id = 2;};
case "3R": {_inc = -1;_id = 2;};
case "4L": {_inc = 1;_id = 3;};
case "4R": {_inc = -1;_id = 3;};
};
_newDigit = (_digitArray select _id) + _inc;
if (_newDigit < 0) then {
_newDigit = 9;
};
if (_newDigit > 9) then {
_newDigit = 0;
};
_digitArray set[_id,_newDigit];
uiNamespace setVariable ["dayz_padlockCode", _digitArray];
_null = [_digitArray] spawn padlock_digitSet;
};
padlock_digitSet = {
disableSerialization;
_digitArray = _this select 0;
_colour = uiNamespace getVariable ["dayz_padlockColour", padlockColourDay];
{
ctrlEnable [_x,true];
ctrlSetText [_x, format["z\addons\dayz_code\gui\padlock\%1.paa", (_digitArray select _forEachIndex)]];
_control = ((findDisplay padlockIDD) displayCtrl _x);
_control ctrlSetTextColor _colour;
} forEach [1201,1202,1203,1204];
uiNamespace setVariable ["dayz_padlockCode", _digitArray];
};
padlock_hasp = {
_digitArray = uiNamespace getVariable ["dayz_padlockCode", [0,0,0,0]];
_newCode = uiNamespace getVariable ["dayz_padlockNewCode",false];
_target = uiNamespace getVariable ["dayz_padlockTarget",player];
if (_newCode) then {
//[_unitSending,_object,_code]
PVDZ_Server_processSetAccessCode = [player,_target,_digitArray];
publicVariableServer "PVDZ_Server_processSetAccessCode";
}
else
{
//[_unitSending,_object,_code]
PVDZ_Server_processCode = [player,_target,_digitArray];
publicVariableServer "PVDZ_Server_processCode";
};
closeDialog(0);
};

View File

@@ -0,0 +1,130 @@
/*
Simple class system to use this script.
class Upgrade {
requiredTools[] = {"ItemToolbox"};
requiredParts[] = {"equip_crate","PartWoodPile"};
create = "TentStorage1";
};
*/
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
dayz_actionInProgress = true;
private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig",
"_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis",
"_sfx","_ownerID","_objectID","_objectUID","_dir","_weapons","_magazines","_backpacks","_object",
"_itemName","_vector","_playerNear","_finished"];
_cursorTarget = _this select 3;
_ownerID = _cursorTarget getVariable ["characterID","0"];
_objectID = _cursorTarget getVariable ["ObjectID","0"];
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
if (isNil "_cursorTarget" or {isNull _cursorTarget} or {_objectUID == "0" && (_objectID == "0")}) exitWith {
localize "str_cursorTargetNotFound" call dayz_rollingMessages;
dayz_actionInProgress = false;
};
_item = typeOf _cursorTarget;
player removeAction s_player_upgradestorage;
s_player_upgradestorage = -1;
_classname = configFile >> "CfgVehicles" >> _item;
_requiredTools = getArray (_classname >> "Upgrade" >> "requiredTools");
_requiredParts = getArray (_classname >> "Upgrade" >> "requiredParts");
_upgrade = getText (_classname >> "Upgrade" >> "create");
_upgradeConfig = configFile >> "CfgVehicles" >> _upgrade;
_upgradeDisplayname = getText (_upgradeConfig >> "displayName");
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
if (_isWater or _onLadder) exitWith {dayz_actionInProgress = false; localize "str_CannotUpgrade" call dayz_rollingMessages;};
_upgradeParts = [];
_startUpgrade = true;
_playerNear = {isPlayer _x} count (([_cursorTarget] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
{
if (!(_x in items player)) exitWith {
_missingPartsConfig = configFile >> "CfgWeapons" >> _x;
_textMissingParts = getText (_missingPartsConfig >> "displayName");
format [localize "str_missing_to_do_this", _textMissingParts] call dayz_rollingMessages;
_startUpgrade = false;
};
} count _requiredTools;
{
if (!(_x in magazines player)) exitWith {
_missingPartsConfig = configFile >> "CfgMagazines" >> _x;
_textMissingParts = getText (_missingPartsConfig >> "displayName");
format [localize "str_missing_to_do_this", _textMissingParts] call dayz_rollingMessages;
_startUpgrade = false;
};
if (_x in magazines player) then {_upgradeParts set [count _upgradeParts, _x];};
} count _requiredParts;
if ((_startUpgrade) && (isClass(_upgradeConfig))) then {
_dis = 20;
_sfx = "tentpack";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished || (isNull _cursorTarget) || ({!(_x in magazines player)} count _upgradeParts > 0)) exitWith {}; //Double check player did not drop required parts
_dir = round getDir _cursorTarget;
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
_cursorTarget setDir 0;
_pos = getPosATL _cursorTarget;
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
_weapons = getWeaponCargo _cursorTarget;
_magazines = getMagazineCargo _cursorTarget;
_backpacks = getBackpackCargo _cursorTarget;
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_pos,dayz_authKey,false];
publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle _cursorTarget;
{
player removeMagazine _x;
_upgradeParts = _upgradeParts - [_x];
} count _upgradeParts;
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
_object setDir 0;
_object setPosATL _pos;
_object setVectorDirAndUp _vector;
_object setVariable ["characterID",_ownerID];
player reveal _object;
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
if (DZE_permanentPlot) then {
_object setVariable ["ownerPUID",dayz_playerUID,true];
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos,dayz_playerUID],[_weapons,_magazines,_backpacks],player,dayz_authKey];
} else {
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos],[_weapons,_magazines,_backpacks],player,dayz_authKey];
};
publicVariableServer "PVDZ_obj_Publish";
//diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
localize "str_upgradeDone" call dayz_rollingMessages;
/*
} else {
localize "str_upgradeNoOption" call dayz_rollingMessages;
*/
};
dayz_actionInProgress = false;

View File

@@ -0,0 +1,151 @@
/*
Simple class system to use this script.
class Upgrade {
requiredTools[] = {"ItemToolbox"};
requiredParts[] = {"equip_crate","PartWoodPile"};
create = "TentStorage1";
};
*/
private ["_nearByChoppers","_cursorTarget","_type","_class","_requiredTools","_requiredParts","_upgradeType","_producedParts","_randomCreate",
"_upgradeClass","_onLadder","_isWater","_ok","_missing","_upgradeParts","_dis","_characterID","_objectID","_objectUID","_playerNear",
"_ownerArray","_ownerPasscode","_dir","_vector","_object","_puid","_clanArray","_wh","_variables","_finished"];
_cursorTarget = _this;
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};
};
if (isNull _cursorTarget) exitWith {};
_nearByChoppers = _cursorTarget nearObjects ["Helicopter", 10];
if (count _nearByChoppers > 1) exitwith {localize "str_upgradevehctooClose" call dayz_rollingMessages;};
_type = typeof _cursorTarget;
_class = configFile >> "CfgVehicles" >> _type;
_requiredTools = getArray (_class >> "Upgrade" >> "requiredTools");
_requiredParts = getArray (_class >> "Upgrade" >> "requiredParts");
_upgradeType = getText (_class >> "Upgrade" >> "create");
_producedParts = getArray (_class >> "Upgrade" >> "produce");
if (isArray(configFile >> "CfgVehicles" >> _type >> "Upgrade" >> "randomcreate")) then {
_randomCreate = getArray (_class >> "Upgrade" >> "randomcreate");
_upgradeType = _randomCreate call BIS_fnc_selectRandom;
};
_upgradeClass = configFile >> "CfgVehicles" >> _upgradeType;
if (!isClass _upgradeClass) exitWith {localize "str_upgradeNoOption" call dayz_rollingMessages;};
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
if (_isWater or _onLadder) exitWith {localize "str_water_ladder_cant_do" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_cursorTarget] call fnc_getPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages;};
_ok = true;
_missing = "";
{
if (!(_x in items player)) exitWith {
_missing = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
_ok = false;
};
} count _requiredTools;
if (!_ok) exitWith {format [localize "str_upgradeMissingTool", _missing] call dayz_rollingMessages;};
_ok = true;
_upgradeParts = [];
{
if (!(_x in magazines player)) exitWith {
_missing = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
_ok = false;
};
if (_x in magazines player) then {
_upgradeParts set [count _upgradeParts, _x];
player removeMagazine _x;
};
} count _requiredParts;
if (!_ok) exitWith {
{player addMagazine _x;} foreach _upgradeParts;
format [localize "str_upgradeMissingPart", _missing] call dayz_rollingMessages;
};
if (dayz_actionInProgress) exitWith {
{player addMagazine _x;} forEach _upgradeParts;
localize "str_player_actionslimit" call dayz_rollingMessages;
};
dayz_actionInProgress = true;
_dis=20;
[player,"tentpack",0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {
{player addMagazine _x;} forEach _upgradeParts;
dayz_actionInProgress = false;
};
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
_characterID = _cursorTarget getVariable ["characterID","0"];
_objectID = _cursorTarget getVariable ["ObjectID","0"];
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
_ownerArray = _cursorTarget getVariable ["ownerArray",[]];
_ownerPasscode = _cursorTarget getVariable ["padlockCombination",[]];
_dir = round getDir _cursorTarget;
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
_pos = getposATL _cursorTarget;
if (abs(((_vector select 1) select 2) - 1) > 0.001) then {_pos set [2,0];};
_object = createVehicle [_upgradeType, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
//if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
_object setVectorDirAndUp _vector;
_object setPosATL _pos;
_puid = getPlayerUID player;
/*
if (!(_puid in _clanArray)) then {
_clanArray set [ count _clanArray, _puid ];
};
*/
_object setVariable ["ownerArray",_ownerArray,true];
_object setVariable ["padlockCombination",_ownerPasscode,true];
_object setVariable ["characterID",_characterID,true];
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_cursorTarget,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy";
_wh = "WeaponHolder" createVehicle (getPosATL player);
{
if (isClass (configFile >> "CfgMagazines" >> _x)) then {
_wh addMagazineCargoGlobal [_x, 1];
} else {
_wh addWeaponCargoGlobal [_x, 1];
};
} forEach _producedParts;
_variables = [["ownerArray", _ownerArray],["padlockCombination", _ownerPasscode]];
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos],_variables,player,dayz_authKey];
publicVariableServer "PVDZ_obj_Publish";
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
/*
//Send maintenance info
PVDZ_veh_Save = [_object,"maintenance"];
publicVariableServer "PVDZ_veh_Save";
if (isServer) then {
PVDZ_veh_Save call server_updateObject;
};*/
player reveal _object;
localize "str_upgradeDone" call dayz_rollingMessages;
dayz_actionInProgress = false;

View File

@@ -0,0 +1,83 @@
private ["_type","_fn_Lock","_fn_UnLock","_fn_Open","_fn_Closed","_fn_Set","_fn_Lockold","_fn_UnLockold","_fn_BuildLock","_fn_BuildUnLock"];
_target = ((_this select 3) select 0);
_type = ((_this select 3) select 1);
_fn_Set = {
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target animate ["DoorR", 0];
_target animate ["DoorL", 0];
//_target setVariable ["isOpen", "0", true];
[_target,true] spawn padlock_open;
};
};
_fn_Lock = {
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target animate ["DoorR", 0];
_target animate ["DoorL", 0];
_target setVariable ["isOpen", "0", true];
_target setVariable ["dayz_padlockLockStatus",true,true];
};
};
_fn_UnLock = {
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
[_target,false] spawn padlock_open;
};
};
_fn_Lockold = {
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target animate ["DoorR", 0];
_target animate ["DoorL", 0];
_target setVariable ["isOpen", "0", true];
localize "STR_BLD_GATES_LOCKED" call dayz_rollingMessages;
};
};
_fn_UnLockold = {
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target setVariable ["isOpen", "1", true];
localize "STR_BLD_GATES_UNLOCKED" call dayz_rollingMessages;
};
};
_fn_Open = {
if (typeOf _target in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target animate ["DoorR", 1];
_target animate ["DoorL", 1];
localize "STR_BLD_GATES_OPENED" call dayz_rollingMessages;
};
};
_fn_Closed = {
if (typeOf _target in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
_target animate ["DoorR", 0];
_target animate ["DoorL", 0];
localize "STR_BLD_GATES_CLOSED" call dayz_rollingMessages;
};
};
_fn_BuildLock = {
_target setVariable ["BuildLock",true,true];
PVDZ_Server_buildLock = [_target];
publicVariableServer "PVDZ_Server_buildLock";
};
_fn_BuildUnLock = {
_target setVariable ["BuildLock",false,true];
PVDZ_Server_buildLock = [_target];
publicVariableServer "PVDZ_Server_buildLock";
};
switch (_type) do {
case "Lock": { call _fn_Lock; };
case "Unlock": { call _fn_UnLock; };
case "Open": { call _fn_Open; };
case "Close": { call _fn_Closed; };
case "Set": { call _fn_Set; };
case "BuildLock": { call _fn_BuildLock; };
case "BuildUnLock": { call _fn_BuildUnLock; };
};