mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
locking vaults
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
private["_obj","_bag","_pos"];
|
||||
hintSilent format["DEBUG: %1",_this];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_packTent;
|
||||
|
||||
4
dayz_code/actions/vault_lock.sqf
Normal file
4
dayz_code/actions/vault_lock.sqf
Normal file
@@ -0,0 +1,4 @@
|
||||
private["_obj","_bag","_pos"];
|
||||
hintSilent format["DEBUG: %1",_this];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_unlockVault;
|
||||
@@ -1,3 +1,4 @@
|
||||
private["_obj","_bag","_pos"];
|
||||
hintSilent format["DEBUG: %1",_this];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_packVault;
|
||||
|
||||
@@ -47,7 +47,7 @@ if (!_isOk) then {
|
||||
|
||||
sleep 5;
|
||||
//place tent (local)
|
||||
_tent = createVehicle ["VaultStorage", _location, [], 0, "CAN_COLLIDE"];
|
||||
_tent = createVehicle ["VaultStorageLocked", _location, [], 0, "CAN_COLLIDE"];
|
||||
_tent setdir _dir;
|
||||
_tent setpos _location;
|
||||
player reveal _tent;
|
||||
@@ -57,7 +57,7 @@ if (!_isOk) then {
|
||||
|
||||
//player setVariable ["tentUpdate",["Land_A_tent",_dir,_location,[dayz_tentWeapons,dayz_tentMagazines,dayz_tentBackpacks]],true];
|
||||
|
||||
dayzPublishObj = [dayz_characterID,_tent,[_dir,_location],"VaultStorage"];
|
||||
dayzPublishObj = [dayz_characterID,_tent,[_dir,_location],"VaultStorageLocked"];
|
||||
publicVariable "dayzPublishObj";
|
||||
if (isServer) then {
|
||||
dayzPublishObj call server_publishObj;
|
||||
|
||||
4
dayz_code/actions/vault_unlock.sqf
Normal file
4
dayz_code/actions/vault_unlock.sqf
Normal file
@@ -0,0 +1,4 @@
|
||||
private["_obj","_bag","_pos"];
|
||||
hintSilent format["DEBUG: %1",_this];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_unlockVault;
|
||||
@@ -52,7 +52,6 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
_isZombie = cursorTarget isKindOf "zZombie_base";
|
||||
_isDestructable = cursorTarget isKindOf "BuiltItems";
|
||||
_isTent = cursorTarget isKindOf "TentStorage";
|
||||
_isVault = cursorTarget isKindOf "VaultStorage";
|
||||
_isFuel = false;
|
||||
_isAlive = alive cursorTarget;
|
||||
_text = getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName");
|
||||
@@ -163,16 +162,29 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
s_player_packtent = -1;
|
||||
};
|
||||
|
||||
//Allow owner to unlock vault
|
||||
if(cursorTarget isKindOf "VaultStorageLocked" and _canDo and _ownerID == dayz_characterID) then {
|
||||
if ((s_player_unlockvault < 0) and (player distance cursorTarget < 3)) then {
|
||||
s_player_unlockvault = player addAction ["Unlock Vault", "\z\addons\dayz_code\actions\vault_unlock.sqf",cursorTarget, 0, false, true, "",""];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_unlockvault;
|
||||
s_player_unlockvault = -1;
|
||||
};
|
||||
|
||||
//Packing my vault
|
||||
//Allow owner to pack vault
|
||||
if(cursorTarget isKindOf "VaultStorage" and _canDo and _ownerID == dayz_characterID) then {
|
||||
if ((s_player_packvault < 0) and (player distance cursorTarget < 3)) then {
|
||||
s_player_packvault = player addAction ["Pack Vault", "\z\addons\dayz_code\actions\vault_pack.sqf",cursorTarget, 0, false, true, "",""];
|
||||
// s_player_packvault = player addAction ["Lock Vault", "\z\addons\dayz_code\actions\vault_pack.sqf",cursorTarget, 0, false, true, "",""];
|
||||
};
|
||||
if ((s_player_lockvault < 0) and (player distance cursorTarget < 3)) then {
|
||||
s_player_lockvault = player addAction ["Lock Vault", "\z\addons\dayz_code\actions\vault_lock.sqf",cursorTarget, 0, false, true, "",""];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_packvault;
|
||||
s_player_packvault = -1;
|
||||
player removeAction s_player_lockvault;
|
||||
s_player_lockvault = -1;
|
||||
};
|
||||
|
||||
//Repairing Vehicles
|
||||
@@ -504,4 +516,12 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
s_player_fillfuel = -1;
|
||||
player removeAction s_player_studybody;
|
||||
s_player_studybody = -1;
|
||||
|
||||
// vault
|
||||
player removeAction s_player_unlockvault;
|
||||
s_player_unlockvault = -1;
|
||||
player removeAction s_player_packvault;
|
||||
s_player_packvault = -1;
|
||||
player removeAction s_player_lockvault;
|
||||
s_player_lockvault = -1;
|
||||
};
|
||||
77
dayz_code/compile/player_lockVault.sqf
Normal file
77
dayz_code/compile/player_lockVault.sqf
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
[_obj] spawn player_unlockVault;
|
||||
*/
|
||||
private["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_bag","_holder","_weapons","_magazines","_backpacks","_objWpnTypes","_objWpnQty","_countr"];
|
||||
_obj = _this;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
player playActionNow "Medic";
|
||||
|
||||
player removeAction s_player_lockvault;
|
||||
s_player_lockvault = -1;
|
||||
|
||||
if(_ownerID == dayz_characterID) then {
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
|
||||
if (_alreadyPacking == 1) exitWith {cutText ["That vault is already being unlocked." , "PLAIN DOWN"]};
|
||||
|
||||
_obj setVariable["packing",1];
|
||||
|
||||
_dir = direction _obj;
|
||||
_pos = getposATL _obj;
|
||||
[player,"tentpack",0,false] call dayz_zombieSpeak;
|
||||
sleep 3;
|
||||
|
||||
//place tent (local)
|
||||
_holder = createVehicle ["VaultStorageLocked",_pos,[], 0, "CAN_COLLIDE"];
|
||||
_holder setdir _dir;
|
||||
player reveal _holder;
|
||||
|
||||
_holder setVariable["CharacterID",_ownerID,true];
|
||||
_holder setVariable["ObjectID",_objectID,true];
|
||||
_holder setVariable["ObjectUID",_objectUID,true];
|
||||
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
|
||||
// dayzDeleteObj = [_objectID,_objectUID];
|
||||
// publicVariableServer "dayzDeleteObj";
|
||||
// if (isServer) then {
|
||||
// dayzDeleteObj call local_deleteObj;
|
||||
// };
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
//Add weapons
|
||||
_objWpnTypes = _weapons select 0;
|
||||
_objWpnQty = _weapons select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = _magazines select 0;
|
||||
_objWpnQty = _magazines select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = _backpacks select 0;
|
||||
_objWpnQty = _backpacks select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
cutText ["Your vault has been unlocked", "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText ["You cannot unlock this vault, it is not yours", "PLAIN DOWN"];
|
||||
};
|
||||
77
dayz_code/compile/player_unlockVault.sqf
Normal file
77
dayz_code/compile/player_unlockVault.sqf
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
[_obj] spawn player_unlockVault;
|
||||
*/
|
||||
private["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_bag","_holder","_weapons","_magazines","_backpacks","_objWpnTypes","_objWpnQty","_countr"];
|
||||
_obj = _this;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
player playActionNow "Medic";
|
||||
|
||||
player removeAction s_player_unlockvault;
|
||||
s_player_unlockvault = -1;
|
||||
|
||||
if(_ownerID == dayz_characterID) then {
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
|
||||
if (_alreadyPacking == 1) exitWith {cutText ["That vault is already being unlocked." , "PLAIN DOWN"]};
|
||||
|
||||
_obj setVariable["packing",1];
|
||||
|
||||
_dir = direction _obj;
|
||||
_pos = getposATL _obj;
|
||||
[player,"tentpack",0,false] call dayz_zombieSpeak;
|
||||
sleep 3;
|
||||
|
||||
//place tent (local)
|
||||
_holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"];
|
||||
_holder setdir _dir;
|
||||
player reveal _holder;
|
||||
|
||||
_holder setVariable["CharacterID",_ownerID,true];
|
||||
_holder setVariable["ObjectID",_objectID,true];
|
||||
_holder setVariable["ObjectUID",_objectUID,true];
|
||||
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
|
||||
// dayzDeleteObj = [_objectID,_objectUID];
|
||||
// publicVariableServer "dayzDeleteObj";
|
||||
// if (isServer) then {
|
||||
// dayzDeleteObj call local_deleteObj;
|
||||
// };
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
//Add weapons
|
||||
_objWpnTypes = _weapons select 0;
|
||||
_objWpnQty = _weapons select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = _magazines select 0;
|
||||
_objWpnQty = _magazines select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = _backpacks select 0;
|
||||
_objWpnQty = _backpacks select 1;
|
||||
_countr = 0;
|
||||
{
|
||||
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
|
||||
cutText ["Your vault has been unlocked", "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText ["You cannot unlock this vault, it is not yours", "PLAIN DOWN"];
|
||||
};
|
||||
@@ -28,6 +28,8 @@ if (!isDedicated) then {
|
||||
player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating
|
||||
player_packTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packTent.sqf";
|
||||
player_packVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packVault.sqf";
|
||||
player_unlockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_unlock.sqf";
|
||||
player_lockVault = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_lock.sqf";
|
||||
control_zombieAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\control_zombieAgent.sqf";
|
||||
player_updateGui = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_updateGui.sqf";
|
||||
player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
|
||||
|
||||
@@ -55,6 +55,8 @@ dayz_resetSelfActions = {
|
||||
s_player_butcher = -1;
|
||||
s_player_packtent = -1;
|
||||
s_player_packvault = -1;
|
||||
s_player_lockvault = -1;
|
||||
s_player_unlockvault = -1;
|
||||
s_player_fillwater = -1;
|
||||
s_player_fillwater2 = -1;
|
||||
s_player_fillfuel = -1;
|
||||
@@ -171,6 +173,7 @@ dayz_zombieTargetList = [
|
||||
dayzHit = [];
|
||||
dayzPublishObj = []; //used for eventhandler to spawn a mirror of players tent
|
||||
dayzHideBody = objNull;
|
||||
|
||||
dayzPublishVeh = []; // for vehicle traders
|
||||
dayzTraderMenu = []; // For all traders
|
||||
|
||||
|
||||
@@ -1584,6 +1584,7 @@ class CfgVehicles
|
||||
{
|
||||
class NonStrategic;
|
||||
class BuiltItems: NonStrategic{};
|
||||
class BuiltItemsVault: NonStrategic{};
|
||||
class TrapItems: NonStrategic{};
|
||||
class Wire_cat1: BuiltItems
|
||||
{
|
||||
@@ -1604,6 +1605,17 @@ class CfgVehicles
|
||||
displayName = "Wire (CAT2)";
|
||||
model = "\dayz_equip\models\wire_cat2.p3d";
|
||||
};
|
||||
class VaultStorageLocked: BuiltItemsVault
|
||||
{
|
||||
scope = 2;
|
||||
destrType = "DestructNo";
|
||||
cost = 100;
|
||||
model = "\dayz_equip\models\safe1.p3d";
|
||||
mapSize = 2;
|
||||
armor = 2000;
|
||||
displayName = "Locked Vault";
|
||||
vehicleClass = "Fortifications";
|
||||
};
|
||||
class Hedgehog_DZ: BuiltItems
|
||||
{
|
||||
scope = 2;
|
||||
|
||||
Reference in New Issue
Block a user