Add option to clear the ammo of all static guns, compile vehicle functions for server and client

This commit is contained in:
A Man
2022-04-26 16:54:57 +02:00
parent 57f1a534a7
commit 9c1da8101d
14 changed files with 30 additions and 17 deletions

View File

@@ -1578,6 +1578,10 @@ if (_canBuild) then {
};
publicVariableServer "PVDZ_obj_Publish";
};
if (_builtObject isKindOf "StaticWeapon" || {_classname in DZE_StaticWeapons}) then {
[_builtObject,DZE_clearStaticAmmo,false] call fn_vehicleAddons;
};
};
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
_builtObject addEventHandler ["HandleDamage", {0}];

View File

@@ -11,12 +11,12 @@ if (_type in DZE_disableThermal) then {
};
if (_clearAmmo && {!(_type in _skipAmmoClear)}) then {
_vehicle call server_clearTurrets;
_vehicle call fn_clearTurrets;
};
if (_addAmmo && {!(_type in _skipAmmoFill)}) then {
local _countMags = 2; // Number of how many magazines will be added to the vehicle
[_vehicle,_countMags] call server_fillTurrets;
[_vehicle,_countMags] call fn_fillTurrets;
};

View File

@@ -94,6 +94,12 @@ DZE_WeatherVariables = [
DZE_PlotManagementAdmins = []; //Array of admin PlayerUIDs. UIDs in this list are able to access every pole's management menu and delete or build any buildable with a pole nearby.
DZE_doorManagementAdmins = []; //Array of admin PlayerUIDs. UIDs in this list are able to access every door's management menu and open it.
DZE_disableThermal = []; // Array of vehicle classnames to disable thermal on when being spawned. i.e: ["AH1Z","MTVR"];
DZE_clearStaticAmmo = true; // Clears the ammo of all built and spawned static guns
DZE_clearVehicleAmmo = true; // Clears the ammo of vehicles spawned, bought, claimed and upgraded during the same restart
DZE_clearVehicleFlares = false; // Clears the flares of vehicles during the same restart, DZE_clearVehicleAmmo must be true in order to work
DZE_addVehicleAmmo = false; // Adds ammo to all spawned, bought, claimed and upgraded vehicles during the same restart
// Uncomment the lines below to change the default loadout
//DefaultMagazines = ["HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"];
//DefaultWeapons = ["Makarov_DZ","ItemFlashlight"];
@@ -120,10 +126,6 @@ if (isServer) then {
MaxVehicleLimit = 50; // Max number of random vehicles to spawn around the map
dayz_enableGhosting = false;
dayz_ghostTimer = 120;
DZE_disableThermal = []; // Array of vehicle classnames to disable thermal on when being spawned. i.e: ["AH1Z","MTVR"];
DZE_clearVehicleAmmo = true; // Clears the ammo of vehicles spawned, bought, claimed and upgraded during the same restart
DZE_clearVehicleFlares = false; // Clears the flares of vehicles during the same restart, DZE_clearVehicleAmmo must be true in order to work
DZE_addVehicleAmmo = false; // Adds ammo to all spawned, bought, claimed and upgraded vehicles during the same restart
// ZSC
Z_globalBankingTraders = false; // Enable banking NPCs at trader cities.

View File

@@ -799,6 +799,10 @@ object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\o
object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
fn_vehicleAddons = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_vehicleAddons.sqf";
fn_clearTurrets = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_clearTurrets.sqf";
fn_fillTurrets = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_fillTurrets.sqf";
// Vehicle damage fix
fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleDam.sqf";
fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";

View File

@@ -90,7 +90,7 @@ if (_outcome != "PASS") then {
[_object,"all",true] call server_updateObject;
[_object,vg_clearAmmo,false] call server_vehicleAddons;
[_object,vg_clearAmmo,false] call fn_vehicleAddons;
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];

View File

@@ -1,6 +1,6 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
private ["_type","_objectUID","_characterID","_object","_worldspace","_key","_ownerArray","_inventory","_clientKey","_exitReason","_player","_playerUID"];
private ["_isStatic","_type","_objectUID","_characterID","_object","_worldspace","_key","_ownerArray","_inventory","_clientKey","_exitReason","_player","_playerUID"];
if (count _this < 6) exitWith {diag_log "Server_PublishObj error: Wrong parameter format";};
@@ -36,6 +36,7 @@ if ([_object, "Server"] call check_publishobject) then {
_object addMPEventHandler ["MPKilled",{if !(isServer) exitWith {};_this call vehicle_handleServerKilled;}];
};
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;

View File

@@ -80,7 +80,7 @@ if (_outcome != "PASS") then {
[_object,"all",true] call server_updateObject;
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call server_vehicleAddons;
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call fn_vehicleAddons;
_object call fnc_veh_ResetEH;

View File

@@ -94,7 +94,7 @@ if (_outcome != "PASS") then {
};
};
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call server_vehicleAddons;
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call fn_vehicleAddons;
_object call fnc_veh_ResetEH;

View File

@@ -130,7 +130,7 @@ if (_outcome != "PASS") then {
[_object,"all",true] call server_updateObject;
[_object,DZE_clearVehicleAmmo,false] call server_vehicleAddons;
[_object,DZE_clearVehicleAmmo,false] call fn_vehicleAddons;
_object call fnc_veh_ResetEH;
// for non JIP users this should make sure everyone has eventhandlers for vehicles.

View File

@@ -159,7 +159,7 @@ if (_outcome != "PASS") then {
[_object,"all",true] call server_updateObject;
[_object,DZE_clearVehicleAmmo,false] call server_vehicleAddons;
[_object,DZE_clearVehicleAmmo,false] call fn_vehicleAddons;
_object call fnc_veh_ResetEH;
// for non JIP users this should make sure everyone has eventhandlers for vehicles.

View File

@@ -24,9 +24,6 @@ server_onPlayerDisconnect = compile preprocessFileLineNumbers "\z\addons\dayz_se
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\updateObject_functions.sqf";
server_updateObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateObject.sqf";
server_setHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_setHitpoints.sqf";
server_vehicleAddons = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_vehicleAddons.sqf";
server_clearTurrets = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_clearTurrets.sqf";
server_fillTurrets = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_fillTurrets.sqf";
server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf";
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; //Creates the object in DB
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf"; //Removes the object from the DB

View File

@@ -102,7 +102,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
_damage = _x select 8;
_storageMoney = _x select 9;
if ((_type isKindOf "AllVehicles") && !(_type isKindOf "StaticWeapon")) then {
if ((_type isKindOf "AllVehicles") && {!(_type isKindOf "StaticWeapon") && {!(_type in DZE_StaticWeapons)}}) then {
_VehicleQueue set [_vQty,_x];
_vQty = _vQty + 1;
} else {
@@ -263,6 +263,11 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
};
};
};
if (_type isKindOf "StaticWeapon" || {_type in DZE_StaticWeapons}) then {
[_object,DZE_clearStaticAmmo,false] call fn_vehicleAddons;
};
_setGlobal = [false,true] select ((_type in DZE_LockedStorage) || (_type in DZE_DoorsLocked));
_object setVariable ["CharacterID", _ownerID, _setGlobal];
if (_isSafeObject && !_isTrapItem) then {
@@ -373,7 +378,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
[_object,"all",true] call server_updateObject;
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call server_vehicleAddons;
[_object,DZE_clearVehicleAmmo,DZE_addVehicleAmmo] call fn_vehicleAddons;
_object call fnc_veh_ResetEH;
if (_ownerID != "0" && {!(_object isKindOf "Bicycle")}) then {_object setVehicleLock "locked";};