mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Update vanilla fence building
Vanilla commits applied:e88a5c42bcfe956435119a82b8307c5a305198c7be872601c944a25b1b4a7bfeab3c13cc5f02a41a
This commit is contained in:
@@ -21,7 +21,8 @@ if (_build) then {
|
||||
_location = getPosATL _ghost;
|
||||
_direction = getDir _ghost;
|
||||
_object = createVehicle [_classname, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
|
||||
// if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
_object setDir _direction;
|
||||
if ((Dayz_constructionContext select 5) or _keepOnSlope) then {
|
||||
_object setVectorUp surfaceNormal _location;
|
||||
@@ -30,6 +31,7 @@ if (_build) then {
|
||||
_object setVectorUp [0,0,1];
|
||||
if (_location select 2 == 0) then { _location set [2, -0.01]; };
|
||||
};
|
||||
|
||||
deleteVehicle _ghost;
|
||||
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
@@ -77,6 +79,7 @@ if (_build) then {
|
||||
_object setVariable ["characterID",dayz_characterID,true];
|
||||
PVDZ_obj_Publish = [dayz_characterID,_object,[round _direction, _location], _variables];
|
||||
publicVariableServer "PVDZ_obj_Publish";
|
||||
|
||||
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||
|
||||
format[localize "str_build_01",_text] call dayz_rollingMessages;
|
||||
|
||||
@@ -131,7 +131,7 @@ if (!_realObjectStillThere) then {
|
||||
deleteVehicle _cursorTarget;
|
||||
if (getNumber(_parent >> "scope")==2) then {
|
||||
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
//if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
_object setVectorDirAndUp _vector;
|
||||
_object setPosATL _pos;
|
||||
_puid = getPlayerUID player;
|
||||
|
||||
@@ -114,7 +114,7 @@ if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
|
||||
//diag_log [ "dir/angle/pos - reset elevation if angle is straight", _dir, _vector, _pos];
|
||||
|
||||
_object = createVehicle [_upgradeType, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
//if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||
_object setVectorDirAndUp _vector;
|
||||
_object setPosATL _pos;
|
||||
_puid = getPlayerUID player;
|
||||
|
||||
48
SQF/dayz_code/compile/fence_handleDam.sqf
Normal file
48
SQF/dayz_code/compile/fence_handleDam.sqf
Normal file
@@ -0,0 +1,48 @@
|
||||
/***********************************************************
|
||||
ASSIGN DAMAGE TO A UNIT.
|
||||
Called by "HandleDamage" vehicle Event Handler
|
||||
|
||||
- Function fnc_Obj_FenceHandleDam
|
||||
- [unit] call fnc_Obj_FenceHandleDam;
|
||||
- return : 0 no damage
|
||||
************************************************************/
|
||||
private["_obj","_total","_damage"];
|
||||
|
||||
//Object the EH is assigned too
|
||||
_obj = _this select 0;
|
||||
//Total damage of the object
|
||||
_total = (damage _obj);
|
||||
|
||||
//Modify damage done based on level of fence
|
||||
_damage = switch (1==1) do {
|
||||
case ((typeof _obj) in ["WoodenFence_3","WoodenFence_4","WoodenFence_5","WoodenGate_2","WoodenGate_3"]): { 0.5 };
|
||||
case ((typeof _obj) in ["WoodenFence_6","WoodenFence_7","WoodenGate_4"]): { 0.35 };
|
||||
default { 1 };
|
||||
};
|
||||
|
||||
//Is the object local
|
||||
if (local _obj) then {
|
||||
//is damage being done aboue 0 (should always be) not needed.
|
||||
if (_damage > 0) then {
|
||||
//Server running or client
|
||||
if (!isServer) then {
|
||||
//If its a client send to server get the ownering player and send damage to that player
|
||||
PVDZ_veh_Save = [_obj,"objWallDamage",(_total + _damage)];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
} else {
|
||||
//Server running the EH, update object to db
|
||||
[_obj,"objWallDamage",(_total + _damage)] call server_updateObject;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
//send to server then back to owning client/server
|
||||
PVDZ_send = [_obj,"objWallDamage",_this];
|
||||
publicVariableServer "PVDZ_send";
|
||||
};
|
||||
|
||||
//Logging.
|
||||
diag_log format["INFO - %1(%3) - %2(%4)",_obj,_damage,(typeof _obj),_total];
|
||||
|
||||
|
||||
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
|
||||
0
|
||||
@@ -1,28 +0,0 @@
|
||||
/***********************************************************
|
||||
ASSIGN DAMAGE TO A UNIT.
|
||||
Called by "HandleDamage" vehicle Event Handler
|
||||
|
||||
- Function fnc_obj_handleDam
|
||||
- [unit, damage] call fnc_obj_handleDam;
|
||||
- return : updated damage
|
||||
************************************************************/
|
||||
private["_obj","_total","_damage"];
|
||||
|
||||
_obj = _this select 0;
|
||||
_damage = _this select 1;
|
||||
_total = (damage _obj);
|
||||
|
||||
if (_damage > 0) then {
|
||||
if (!isServer) then {
|
||||
PVDZ_veh_Save = [_obj,"objWallDamage",(_total + _damage)];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
} else {
|
||||
[_obj,"objWallDamage",(_total + _damage)] call server_updateObject;
|
||||
};
|
||||
};
|
||||
|
||||
//diag_log format["INFO - %1(%3) - %2(%4)",_obj,_damage,(typeof _obj),(_total + _damage)];
|
||||
|
||||
|
||||
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
|
||||
0
|
||||
@@ -619,7 +619,7 @@ fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code
|
||||
fn_chance = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomChance.sqf";
|
||||
fn_getModelName = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_getModelName.sqf";
|
||||
fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_niceSpot.sqf";
|
||||
fnc_Obj_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\obj_handleDam.sqf";
|
||||
fnc_Obj_FenceHandleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fence_handleDam.sqf";
|
||||
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
|
||||
DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"PVDZ_drg_RLact" addPublicVariableEventHandler {[_this select 1] execVM "\z\addons\dayz_code\medical\load\load_wounded.sqf"};
|
||||
"PVDZ_hlt_Bleed" addPublicVariableEventHandler {(_this select 1) spawn fnc_usec_damageBleed};
|
||||
"PVCDZ_veh_SH" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleDam}; // set damage to vehicle part
|
||||
"PVCDZ_obj_Damage" addPublicVariableEventHandler {(_this select 1) call fnc_Obj_FenceHandleDam}; // set damage to object.
|
||||
"PVDZ_veh_SF" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleRepair}; // repair a part from a vehicle
|
||||
"PVCDZ_obj_HideBody" addPublicVariableEventHandler {hideBody (_this select 1)};
|
||||
"PVCDZ_obj_GutBody" addPublicVariableEventHandler {(_this select 1) spawn local_gutObject};
|
||||
|
||||
@@ -184,7 +184,8 @@ _object_killed = {
|
||||
_key = format["CHILD:306:%1:%2:%3:",_objectID,[],1];
|
||||
};
|
||||
_key call server_hiveWrite;
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
|
||||
diag_log format["DELETE: Deleted by KEY: %1",_key];
|
||||
|
||||
if (((typeOf _object) in DayZ_removableObjects) or ((typeOf _object) in DZE_isRemovable)) then {[_objectID,_objectUID] call server_deleteObj;};
|
||||
};
|
||||
|
||||
@@ -8,6 +8,16 @@ _owner = owner _unit;
|
||||
//diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner];
|
||||
|
||||
switch (_variable) do {
|
||||
case "objWallDamage": {
|
||||
_object = _arraytosend select 0;
|
||||
if (local _object) then {
|
||||
_arraytosend call fnc_Obj_FenceHandleDam;
|
||||
} else {
|
||||
PVCDZ_obj_Damage = _arraytosend;
|
||||
_owner publicVariableClient "PVCDZ_obj_Damage";
|
||||
};
|
||||
};
|
||||
|
||||
case "VehHandleDam": {
|
||||
_vehicle = _arraytosend select 0;
|
||||
if (local _vehicle) then {
|
||||
|
||||
Reference in New Issue
Block a user