mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-18 22:22:57 +03:00
0.1
This commit is contained in:
23
dayz_server/compile/server_gutObject.sqf
Normal file
23
dayz_server/compile/server_gutObject.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
private["_qty","_item","_meat"];
|
||||
_item = _this select 0;
|
||||
_qty = _this select 1;
|
||||
_meat = 0;
|
||||
_loop = true;
|
||||
if (local _item) then {
|
||||
for "_x" from 1 to _qty do {
|
||||
_item addMagazine "FoodSteakRaw";
|
||||
};
|
||||
sleep 2;
|
||||
_timer = time;
|
||||
while {_loop} do {
|
||||
_meat = count magazines _item;
|
||||
if (_meat == 0) then {_loop = false};
|
||||
if ((time - _timer) > 300) then {_loop = false};
|
||||
sleep 1;
|
||||
};
|
||||
dayzHideBody = _item;
|
||||
publicVariable "dayzHideBody";
|
||||
hideBody _item;
|
||||
sleep 10;
|
||||
deleteVehicle _item;
|
||||
};
|
||||
0
dayz_server/compile/server_onPlayerConnect.sqf
Normal file
0
dayz_server/compile/server_onPlayerConnect.sqf
Normal file
28
dayz_server/compile/server_onPlayerDisconnect.sqf
Normal file
28
dayz_server/compile/server_onPlayerDisconnect.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
|
||||
*/
|
||||
private["_hasDel","_serial","_object","_objects","_updates","_myGroup","_nearVeh"];
|
||||
_playerID = _this select 0;
|
||||
_playerName = _this select 1;
|
||||
_object = call compile format["player%1",_playerID];
|
||||
_characterID = _object getVariable ["characterID","0"];
|
||||
|
||||
if (vehicle _object != _object) then {
|
||||
_object action ["eject", vehicle _object];
|
||||
};
|
||||
|
||||
diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID];
|
||||
|
||||
dayz_disco = dayz_disco - [_playerID];
|
||||
if (!isNull _object) then {
|
||||
//Update Vehicle
|
||||
{ [_x,"gear"] call server_updateObject } foreach
|
||||
(nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10]);
|
||||
if (alive _object) then {
|
||||
[_object,[],true] call server_playerSync;
|
||||
_id = [_playerID,_characterID,2] spawn dayz_recordLogin;
|
||||
_myGroup = group _object;
|
||||
deleteVehicle _object;
|
||||
deleteGroup _myGroup;
|
||||
};
|
||||
};
|
||||
46
dayz_server/compile/server_playerDied.sqf
Normal file
46
dayz_server/compile/server_playerDied.sqf
Normal file
@@ -0,0 +1,46 @@
|
||||
private["_characterID","_minutes","_newObject","_playerID","_playerName","_playerID","_myGroup","_group"];
|
||||
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
|
||||
_characterID = _this select 0;
|
||||
_minutes = _this select 1;
|
||||
_newObject = _this select 2;
|
||||
_playerID = _this select 3;
|
||||
_playerName = _this select 4;
|
||||
|
||||
dayz_disco = dayz_disco - [_playerID];
|
||||
_newObject setVariable["processedDeath",time];
|
||||
|
||||
/*
|
||||
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
|
||||
if (isnil "_characterID") then {
|
||||
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));
|
||||
};
|
||||
*/
|
||||
|
||||
if !(isnil "_characterID") then {
|
||||
|
||||
if (_characterID != "0") then {
|
||||
_key = format["CHILD:202:%1:%2:",_characterID,_minutes];
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
} else {
|
||||
deleteVehicle _newObject;
|
||||
};
|
||||
|
||||
} else {
|
||||
deleteVehicle _newObject;
|
||||
};
|
||||
|
||||
diag_log ("PDEATH: Player Died " + _playerID);
|
||||
|
||||
/*
|
||||
_eh = [_newObject] spawn {
|
||||
_body = _this select 0;
|
||||
_method = _body getVariable["deathType","unknown"];
|
||||
_name = _body getVariable["bodyName","unknown"];
|
||||
waitUntil{!isPlayer _body;sleep 1};
|
||||
_body setVariable["deathType",_method,true];
|
||||
_body setVariable["bodyName",_name,true];
|
||||
diag_log ("PDEATH: Player Left Body " + _name);
|
||||
};
|
||||
*/
|
||||
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
|
||||
120
dayz_server/compile/server_playerLogin.sqf
Normal file
120
dayz_server/compile/server_playerLogin.sqf
Normal file
@@ -0,0 +1,120 @@
|
||||
private["_int","_newModel","_doLoop","_wait","_hiveVer","_isHiveOk","_playerID","_playerObj","_randomSpot","_publishTo","_primary","_secondary","_key","_result","_charID","_playerObj","_playerName","_finished","_spawnPos","_spawnDir","_items","_counter","_magazines","_weapons","_group","_backpack","_worldspace","_direction","_newUnit","_score","_position","_isNew","_inventory","_backpack","_medical","_survival","_stats","_state"];
|
||||
//Set Variables
|
||||
|
||||
diag_log ("STARTING LOGIN: " + str(_this));
|
||||
|
||||
_playerID = _this select 0;
|
||||
_playerObj = _this select 1;
|
||||
_playerName = name _playerObj;
|
||||
_worldspace = [];
|
||||
|
||||
if (count _this > 2) then {
|
||||
dayz_players = dayz_players - [_this select 2];
|
||||
};
|
||||
|
||||
waitUntil{allowConnection};
|
||||
|
||||
//Variables
|
||||
_inventory = [];
|
||||
_backpack = [];
|
||||
_items = [];
|
||||
_magazines = [];
|
||||
_weapons = [];
|
||||
_medicalStats = [];
|
||||
_survival = [0,0,0];
|
||||
_tent = [];
|
||||
_state = [];
|
||||
_direction = 0;
|
||||
_model = "";
|
||||
_newUnit = objNull;
|
||||
|
||||
if (_playerID == "") then {
|
||||
_playerID = getPlayerUID _playerObj;
|
||||
};
|
||||
|
||||
if ((_playerID == "") or (isNil "_playerID")) exitWith {
|
||||
diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
|
||||
};
|
||||
|
||||
endLoadingScreen;
|
||||
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);
|
||||
|
||||
//Do Connection Attempt
|
||||
_doLoop = 0;
|
||||
while {_doLoop < 5} do {
|
||||
_key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
|
||||
_primary = [_key,false,dayZ_hivePipeAuth] call server_hiveReadWrite;
|
||||
if (count _primary > 0) then {
|
||||
if ((_primary select 0) != "ERROR") then {
|
||||
_doLoop = 9;
|
||||
};
|
||||
};
|
||||
_doLoop = _doLoop + 1;
|
||||
};
|
||||
|
||||
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
|
||||
diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj));
|
||||
};
|
||||
|
||||
//Process request
|
||||
_newPlayer = _primary select 1;
|
||||
_isNew = count _primary < 6; //_result select 1;
|
||||
_charID = _primary select 2;
|
||||
_randomSpot = false;
|
||||
|
||||
//diag_log ("LOGIN RESULT: " + str(_primary));
|
||||
|
||||
/* PROCESS */
|
||||
_hiveVer = 0;
|
||||
|
||||
if (!_isNew) then {
|
||||
//RETURNING CHARACTER
|
||||
_inventory = _primary select 4;
|
||||
_backpack = _primary select 5;
|
||||
_survival = _primary select 6;
|
||||
_model = _primary select 7;
|
||||
_hiveVer = _primary select 8;
|
||||
|
||||
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Rocket_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ"])) then {
|
||||
_model = "Survivor2_DZ";
|
||||
};
|
||||
|
||||
} else {
|
||||
_model = _primary select 3;
|
||||
_hiveVer = _primary select 4;
|
||||
if (isNil "_model") then {
|
||||
_model = "Survivor2_DZ";
|
||||
} else {
|
||||
if (_model == "") then {
|
||||
_model = "Survivor2_DZ";
|
||||
};
|
||||
};
|
||||
|
||||
//Record initial inventory
|
||||
_config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
|
||||
_mags = getArray (_config >> "magazines");
|
||||
_wpns = getArray (_config >> "weapons");
|
||||
_bcpk = getText (_config >> "backpack");
|
||||
_randomSpot = true;
|
||||
|
||||
//Wait for HIVE to be free
|
||||
_key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]];
|
||||
_key spawn server_hiveWrite;
|
||||
|
||||
};
|
||||
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
|
||||
|
||||
_isHiveOk = false; //EDITED
|
||||
if (_hiveVer >= dayz_hiveVersionNo) then {
|
||||
_isHiveOk = true;
|
||||
};
|
||||
//diag_log ("SERVER RESULT: " + str("X") + " " + str(dayz_hiveVersionNo));
|
||||
|
||||
//Server publishes variable to clients and WAITS
|
||||
//_playerObj setVariable ["publish",[_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer],true];
|
||||
|
||||
_clientID = owner _playerObj;
|
||||
dayzPlayerLogin = [_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer];
|
||||
_clientID publicVariableClient "dayzPlayerLogin";
|
||||
|
||||
//_playerObj enableSimulation false;
|
||||
266
dayz_server/compile/server_playerSetup.sqf
Normal file
266
dayz_server/compile/server_playerSetup.sqf
Normal file
@@ -0,0 +1,266 @@
|
||||
private["_int","_characterID","_doLoop","_newModel","_wait","_playerID","_playerObj","_randomSpot","_publishTo","_primary","_secondary","_key","_result","_charID","_playerObj","_playerName","_finished","_spawnPos","_spawnDir","_items","_counter","_magazines","_weapons","_group","_backpack","_worldspace","_direction","_newUnit","_score","_position","_pos","_isIsland","_isNew","_inventory","_backpack","_medical","_survival","_stats","_state","_lastinstance"];
|
||||
//Set Variables
|
||||
//Wait for HIVE to be free
|
||||
//diag_log ("SETUP: attempted with " + str(_this));
|
||||
|
||||
_characterID = _this select 0;
|
||||
_playerObj = _this select 1;
|
||||
_playerID = _this select 2;
|
||||
|
||||
if (isNull _playerObj) exitWith {
|
||||
diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj));
|
||||
};
|
||||
|
||||
if (_playerID == "") then {
|
||||
_playerID = getPlayerUID _playerObj;
|
||||
};
|
||||
|
||||
if (_playerID == "") exitWith {
|
||||
diag_log ("SETUP INIT FAILED: Exiting, no player ID: " + str(_playerObj));
|
||||
};
|
||||
|
||||
//Variables
|
||||
_worldspace = [];
|
||||
_survival = [0,0,0];
|
||||
_tent = [];
|
||||
_state = [];
|
||||
|
||||
//Do Connection Attempt
|
||||
_doLoop = 0;
|
||||
while {_doLoop < 5} do {
|
||||
_key = format["CHILD:102:%1:",_characterID];
|
||||
_primary = [_key,false,dayZ_hivePipeAuth] call server_hiveReadWrite;
|
||||
if (count _primary > 0) then {
|
||||
if ((_primary select 0) != "ERROR") then {
|
||||
_doLoop = 9;
|
||||
};
|
||||
};
|
||||
_doLoop = _doLoop + 1;
|
||||
};
|
||||
|
||||
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
|
||||
diag_log ("SETUP RESULT: Exiting, player object null: " + str(_playerObj));
|
||||
};
|
||||
|
||||
//Wait for HIVE to be free
|
||||
//diag_log ("SETUP: RESULT: Successful with " + str(_primary));
|
||||
|
||||
_medical = _primary select 1;
|
||||
_stats = _primary select 2;
|
||||
_state = _primary select 3;
|
||||
_worldspace = _primary select 4;
|
||||
_humanity = _primary select 5;
|
||||
_lastinstance = _primary select 6;
|
||||
|
||||
//Set position
|
||||
_randomSpot = false;
|
||||
|
||||
//diag_log ("WORLDSPACE: " + str(_worldspace));
|
||||
|
||||
if (count _worldspace > 0) then {
|
||||
_direction = _worldspace select 0;
|
||||
_position = _worldspace select 1;
|
||||
if (count _position < 3) then {
|
||||
//prevent debug world!
|
||||
_randomSpot = true;
|
||||
};
|
||||
_debug = getMarkerpos "respawn_west";
|
||||
_distance = _debug distance _position;
|
||||
if (_distance < 2000) then {
|
||||
_randomSpot = true;
|
||||
};
|
||||
|
||||
_distance = [0,0,0] distance _position;
|
||||
if (_distance < 500) then {
|
||||
_randomSpot = true;
|
||||
};
|
||||
|
||||
// Came from another server force random spawn
|
||||
if (_lastinstance != dayZ_instance) then {
|
||||
_randomSpot = true;
|
||||
}
|
||||
|
||||
//_playerObj setPosATL _position;
|
||||
//_playerObj setDir _direction;
|
||||
} else {
|
||||
_randomSpot = true;
|
||||
};
|
||||
|
||||
//diag_log ("LOGIN: Location: " + str(_worldspace) + " doRnd?: " + str(_randomSpot));
|
||||
|
||||
//set medical values
|
||||
if (count _medical > 0) then {
|
||||
_playerObj setVariable["USEC_isDead",(_medical select 0),true];
|
||||
_playerObj setVariable["NORRN_unconscious", (_medical select 1), true];
|
||||
_playerObj setVariable["USEC_infected",(_medical select 2),true];
|
||||
_playerObj setVariable["USEC_injured",(_medical select 3),true];
|
||||
_playerObj setVariable["USEC_inPain",(_medical select 4),true];
|
||||
_playerObj setVariable["USEC_isCardiac",(_medical select 5),true];
|
||||
_playerObj setVariable["USEC_lowBlood",(_medical select 6),true];
|
||||
_playerObj setVariable["USEC_BloodQty",(_medical select 7),true];
|
||||
|
||||
_playerObj setVariable["unconsciousTime",(_medical select 10),true];
|
||||
|
||||
// if (_playerID in dayz_disco) then {
|
||||
// _playerObj setVariable["NORRN_unconscious",true, true];
|
||||
// _playerObj setVariable["unconsciousTime",300,true];
|
||||
// } else {
|
||||
// _playerObj setVariable["unconsciousTime",(_medical select 10),true];
|
||||
// };
|
||||
|
||||
//Add Wounds
|
||||
{
|
||||
_playerObj setVariable[_x,true,true];
|
||||
[_playerObj,_x,_hit] spawn fnc_usec_damageBleed;
|
||||
usecBleed = [_playerObj,_x,0];
|
||||
publicVariable "usecBleed";
|
||||
} forEach (_medical select 8);
|
||||
|
||||
//Add fractures
|
||||
_fractures = (_medical select 9);
|
||||
_playerObj setVariable ["hit_legs",(_fractures select 0),true];
|
||||
_playerObj setVariable ["hit_hands",(_fractures select 1),true];
|
||||
|
||||
if (count _medical > 11) then {
|
||||
//Additional medical stats
|
||||
_playerObj setVariable ["messing",(_medical select 11),true];
|
||||
};
|
||||
|
||||
} else {
|
||||
//Reset Fractures
|
||||
_playerObj setVariable ["hit_legs",0,true];
|
||||
_playerObj setVariable ["hit_hands",0,true];
|
||||
_playerObj setVariable ["USEC_injured",false,true];
|
||||
_playerObj setVariable ["USEC_inPain",false,true];
|
||||
_playerObj setVariable ["messing",[0,0],true];
|
||||
};
|
||||
|
||||
if (count _stats > 0) then {
|
||||
//register stats
|
||||
_playerObj setVariable["zombieKills",(_stats select 0),true];
|
||||
_playerObj setVariable["headShots",(_stats select 1),true];
|
||||
_playerObj setVariable["humanKills",(_stats select 2),true];
|
||||
_playerObj setVariable["banditKills",(_stats select 3),true];
|
||||
_playerObj addScore (_stats select 1);
|
||||
|
||||
//Save Score
|
||||
_score = score _playerObj;
|
||||
_playerObj addScore ((_stats select 0) - _score);
|
||||
|
||||
//record for Server JIP checks
|
||||
_playerObj setVariable["zombieKills_CHK",(_stats select 0)];
|
||||
_playerObj setVariable["headShots_CHK",(_stats select 1)];
|
||||
_playerObj setVariable["humanKills_CHK",(_stats select 2)];
|
||||
_playerObj setVariable["banditKills_CHK",(_stats select 3)];
|
||||
if (count _stats > 4) then {
|
||||
if (!(_stats select 3)) then {
|
||||
_playerObj setVariable["selectSex",true,true];
|
||||
};
|
||||
} else {
|
||||
_playerObj setVariable["selectSex",true,true];
|
||||
};
|
||||
} else {
|
||||
//Save initial loadout
|
||||
//register stats
|
||||
_playerObj setVariable["zombieKills",0,true];
|
||||
_playerObj setVariable["humanKills",0,true];
|
||||
_playerObj setVariable["banditKills",0,true];
|
||||
_playerObj setVariable["headShots",0,true];
|
||||
|
||||
//record for Server JIP checks
|
||||
_playerObj setVariable["zombieKills_CHK",0];
|
||||
_playerObj setVariable["humanKills_CHK",0,true];
|
||||
_playerObj setVariable["banditKills_CHK",0,true];
|
||||
_playerObj setVariable["headShots_CHK",0];
|
||||
};
|
||||
|
||||
if (_randomSpot) then {
|
||||
private["_counter","_position","_isNear","_isZero","_mkr"];
|
||||
if (!isDedicated) then {
|
||||
endLoadingScreen;
|
||||
};
|
||||
|
||||
|
||||
//Spawn modify via mission init.sqf
|
||||
if(isnil "spawnArea") then {
|
||||
spawnArea = 1500;
|
||||
};
|
||||
if(isnil "spawnShoremode") then {
|
||||
spawnShoremode = 1;
|
||||
};
|
||||
|
||||
|
||||
//spawn into random
|
||||
_findSpot = true;
|
||||
_mkr = "";
|
||||
while {_findSpot} do {
|
||||
_counter = 0;
|
||||
while {_counter < 20 and _findSpot} do {
|
||||
_mkr = "spawn" + str(round(random 4));
|
||||
_position = ([(getMarkerPos _mkr),0,spawnArea,10,0,2000,spawnShoremode] call BIS_fnc_findSafePos);
|
||||
_isNear = count (_position nearEntities ["Man",100]) == 0;
|
||||
_isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
|
||||
//Island Check //TeeChange
|
||||
_pos = _position;
|
||||
_isIsland = false; //Can be set to true during the Check
|
||||
for [{_w=0},{_w<=150},{_w=_w+2}] do {
|
||||
_pos = [(_pos select 0),((_pos select 1) + _w),(_pos select 2)];
|
||||
if(surfaceisWater _pos) exitWith {
|
||||
_isIsland = true;
|
||||
};
|
||||
};
|
||||
|
||||
if ((_isNear and !_isZero) || _isIsland) then {_findSpot = false};
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
};
|
||||
_isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
|
||||
_position = [_position select 0,_position select 1,0];
|
||||
if (!_isZero) then {
|
||||
//_playerObj setPosATL _position;
|
||||
_worldspace = [0,_position];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//Record player for management
|
||||
dayz_players set [count dayz_players,_playerObj];
|
||||
|
||||
//record player pos locally for server checking
|
||||
_playerObj setVariable["characterID",_characterID,true];
|
||||
_playerObj setVariable["humanity",_humanity,true];
|
||||
_playerObj setVariable["humanity_CHK",_humanity];
|
||||
//_playerObj setVariable["worldspace",_worldspace,true];
|
||||
//_playerObj setVariable["state",_state,true];
|
||||
_playerObj setVariable["lastPos",getPosATL _playerObj];
|
||||
|
||||
dayzPlayerLogin2 = [_worldspace,_state];
|
||||
_clientID = owner _playerObj;
|
||||
_clientID publicVariableClient "dayzPlayerLogin2";
|
||||
|
||||
//record time started
|
||||
_playerObj setVariable ["lastTime",time];
|
||||
//_playerObj setVariable ["model_CHK",typeOf _playerObj];
|
||||
|
||||
diag_log ("LOGIN PUBLISHING: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
|
||||
|
||||
myObj = objNull;
|
||||
call compile format["myObj = player%1",_playerID];
|
||||
|
||||
if (!(isNull myObj)) then {
|
||||
if (alive myObj) then {
|
||||
deleteVehicle myObj;
|
||||
diag_log ("LOGIN DUPLICATE PLAYER: " + str(_playerObj) + " DELETED ORIGINAL");
|
||||
};
|
||||
};
|
||||
|
||||
//Record player for management
|
||||
myObj = _playerObj;
|
||||
call compile format["player%1 = myObj;",_playerID];
|
||||
//diag_log (format["player%1 = myObj",_playerID]);
|
||||
//dayz_players set [count dayz_players,_playerObj];
|
||||
|
||||
dayzLogin = null;
|
||||
dayzLogin2 = null;
|
||||
|
||||
//Save Login
|
||||
4
dayz_server/compile/server_playerStat.sqf
Normal file
4
dayz_server/compile/server_playerStat.sqf
Normal file
@@ -0,0 +1,4 @@
|
||||
private[];
|
||||
_unit = _this select 0;
|
||||
_variable = _this select 1;
|
||||
_change = _this select 2;
|
||||
207
dayz_server/compile/server_playerSync.sqf
Normal file
207
dayz_server/compile/server_playerSync.sqf
Normal file
@@ -0,0 +1,207 @@
|
||||
private["_characterID","_currentModelCheck","_temp","_isSync","_currentWpn","_currentMag","_magazines","_force","_qty","_qtyT","_val","_isNewPos","_isNewBackp","_humanity","_isNewGear","_doUpdate","_currentModel","_modelChk","_playerPos","_playerGear","_playerBackp","_backpack","_updates","_killsB","_killsH","_medical","_isNewMed","_character","_timeSince","_charPos","_isInVehicle","_justAte","_justDrank","_distanceFoot","_lastPos","_legs","_arms","_kills","_headShots","_killsCHK","_headShotsCHK","_timeGross","_timeLeft","_onLadder","_isTerminal"];
|
||||
//[player,array]
|
||||
//diag_log ("UPDATE: " + str(_this) );
|
||||
|
||||
//waituntil {(typeName(_this) == "ARRAY");sleep 0.01;}; //seems to cause often infinite waits (but not for first n players)
|
||||
|
||||
if ( typeName(_this) == "OBJECT" ) then {
|
||||
_this = [_this,[],true];
|
||||
//diag_log ("DW_DEBUG: #manual fix _this: " + str(_this));
|
||||
};
|
||||
|
||||
//correct
|
||||
//"UPDATE: [B 1-1-B:1 (THE BEAST) REMOTE,[],true]"
|
||||
//error
|
||||
//"UPDATE: B 1-1-B:1 (THE BEAST) REMOTE"
|
||||
|
||||
_character = _this select 0;
|
||||
_magazines = _this select 1;
|
||||
_force = _this select 2;
|
||||
_force = true;
|
||||
|
||||
_doUpdate = false;
|
||||
_characterID = _character getVariable ["characterID","0"];
|
||||
_charPos = getPosATL _character;
|
||||
_isInVehicle = vehicle _character != _character;
|
||||
_timeSince = 0;
|
||||
_humanity = 0;
|
||||
|
||||
//diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
|
||||
/*
|
||||
if !(isnil "_characterID") then {
|
||||
diag_log ("DW_DEBUG: _characterID: " + str(_characterID));
|
||||
};
|
||||
*/
|
||||
|
||||
if (_character isKindOf "Animal") exitWith {
|
||||
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " is an Animal class");
|
||||
};
|
||||
|
||||
if (isnil "_characterID") exitWith {
|
||||
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " has nil characterID");
|
||||
};
|
||||
|
||||
if (_characterID == "0") exitWith {
|
||||
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " as no characterID");
|
||||
};
|
||||
|
||||
//Check for server initiated updates
|
||||
_isNewMed = _character getVariable["medForceUpdate",false]; //Med Update is forced when a player receives some kind of med incident
|
||||
_isNewPos = _character getVariable["posForceUpdate",false]; //Med Update is forced when a player receives some kind of med incident
|
||||
_isNewGear = (count _magazines) > 0;
|
||||
|
||||
//diag_log ("Starting Save... MED: " + str(_isNewMed) + " / POS: " + str(_isNewPos)); sleep 0.05;
|
||||
|
||||
//Check for player initiated updates
|
||||
if (_characterID != "0") then {
|
||||
_playerPos = [];
|
||||
_playerGear = [];
|
||||
_playerBackp = [];
|
||||
_medical = [];
|
||||
_distanceFoot = 0;
|
||||
|
||||
//diag_log ("Found Character...");
|
||||
|
||||
//Check if update is requested
|
||||
if (_isNewPos or _force) then {
|
||||
//diag_log ("position..." + str(_isNewPos) + " / " + str(_force)); sleep 0.05;
|
||||
if (((_charPos select 0) == 0) and ((_charPos select 1) == 0)) then {
|
||||
//Zero Position
|
||||
} else {
|
||||
//diag_log ("getting position..."); sleep 0.05;
|
||||
_playerPos = [round(direction _character),_charPos];
|
||||
_lastPos = _character getVariable["lastPos",_charPos];
|
||||
if (count _lastPos > 2 and count _charPos > 2) then {
|
||||
if (!_isInVehicle) then {
|
||||
_distanceFoot = round(_charPos distance _lastPos);
|
||||
};
|
||||
_character setVariable["lastPos",_charPos];
|
||||
};
|
||||
if (count _charPos < 3) then {
|
||||
_playerPos = [];
|
||||
};
|
||||
//diag_log ("position = " + str(_playerPos)); sleep 0.05;
|
||||
};
|
||||
_character setVariable ["posForceUpdate",false,true];
|
||||
};
|
||||
if (_isNewGear) then {
|
||||
//diag_log ("gear..."); sleep 0.05;
|
||||
_playerGear = [weapons _character,_magazines];
|
||||
_backpack = unitBackpack _character;
|
||||
_playerBackp = [typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack];
|
||||
};
|
||||
if (_isNewMed or _force) then {
|
||||
//diag_log ("medical..."); sleep 0.05;
|
||||
_wounds = [];
|
||||
if (!(_character getVariable["USEC_isDead",false])) then {
|
||||
//diag_log ("medical check..."); sleep 0.05;
|
||||
_medical = _character call player_sumMedical;
|
||||
//diag_log ("medical result..." + str(_medical)); sleep 0.05;
|
||||
};
|
||||
_character setVariable ["medForceUpdate",false,true];
|
||||
};
|
||||
|
||||
//Process update
|
||||
if (_characterID != "0") then {
|
||||
//Record stats while we're here
|
||||
/*
|
||||
Check previous stats against what client had when they logged in
|
||||
this helps prevent JIP issues, where a new player wouldn't have received
|
||||
the old players updates. Only valid for stats where clients could have
|
||||
be recording results from their local objects (such as agent zombies)
|
||||
*/
|
||||
_kills = ["zombieKills",_character] call server_getDiff;
|
||||
_killsB = ["banditKills",_character] call server_getDiff;
|
||||
_killsH = ["humanKills",_character] call server_getDiff;
|
||||
_headShots = ["headShots",_character] call server_getDiff;
|
||||
_humanity = ["humanity",_character] call server_getDiff2;
|
||||
//_humanity = _character getVariable ["humanity",0];
|
||||
_character addScore _kills;
|
||||
/*
|
||||
Assess how much time has passed, for recording total time on server
|
||||
*/
|
||||
_lastTime = _character getVariable["lastTime",time];
|
||||
_timeGross = (time - _lastTime);
|
||||
_timeSince = floor(_timeGross / 60);
|
||||
_timeLeft = (_timeGross - (_timeSince * 60));
|
||||
/*
|
||||
Get character state details
|
||||
*/
|
||||
_currentWpn = currentMuzzle _character;
|
||||
_currentAnim = animationState _character;
|
||||
_config = configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
|
||||
_onLadder = (getNumber (_config >> "onLadder")) == 1;
|
||||
_isTerminal = (getNumber (_config >> "terminal")) == 1;
|
||||
//_wpnDisabled = (getNumber (_config >> "disableWeapons")) == 1;
|
||||
_currentModel = typeOf _character;
|
||||
_modelChk = _character getVariable ["model_CHK",""];
|
||||
if (_currentModel == _modelChk) then {
|
||||
_currentModel = "";
|
||||
} else {
|
||||
_currentModel = str(_currentModel);
|
||||
_character setVariable ["model_CHK",typeOf _character];
|
||||
};
|
||||
|
||||
if (_onLadder or _isInVehicle or _isTerminal) then {
|
||||
_currentAnim = "";
|
||||
//If position to be updated, make sure it is at ground level!
|
||||
if ((count _playerPos > 0) and !_isTerminal) then {
|
||||
_charPos set [2,0];
|
||||
_playerPos set[1,_charPos];
|
||||
};
|
||||
};
|
||||
if (_isInVehicle) then {
|
||||
_currentWpn = "";
|
||||
} else {
|
||||
if ( typeName(_currentWpn) == "STRING" ) then {
|
||||
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
|
||||
if (count _muzzles > 1) then {
|
||||
_currentWpn = currentMuzzle _character;
|
||||
};
|
||||
} else {
|
||||
//diag_log ("DW_DEBUG: _currentWpn: " + str(_currentWpn));
|
||||
_currentWpn = "";
|
||||
};
|
||||
};
|
||||
_temp = round(_character getVariable ["temperature",100]);
|
||||
_currentState = [_currentWpn,_currentAnim,_temp];
|
||||
/*
|
||||
Everything is ready, now publish to HIVE
|
||||
*/
|
||||
if (count _playerPos > 0) then {
|
||||
_array = [];
|
||||
{
|
||||
if (_x > -20000 and _x < 20000) then {
|
||||
_array set [count _array,_x];
|
||||
};
|
||||
} forEach (_playerPos select 1);
|
||||
_playerPos set [1,_array];
|
||||
};
|
||||
if (!isNull _character) then {
|
||||
if (alive _character) then {
|
||||
//Wait for HIVE to be free
|
||||
//Send request
|
||||
_key = format["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,_kills,_headShots,_distanceFoot,_timeSince,_currentState,_killsH,_killsB,_currentModel,_humanity];
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key) + " / " + _characterID);
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
};
|
||||
|
||||
// If player is in a vehicle, keep its position updated
|
||||
if (vehicle _character != _character) then {
|
||||
[vehicle _character, "position"] call server_updateObject;
|
||||
};
|
||||
|
||||
// Force gear updates for nearby vehicles/tents
|
||||
_pos = _this select 0;
|
||||
{
|
||||
[_x, "gear"] call server_updateObject;
|
||||
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10];
|
||||
//[_charPos] call server_updateNearbyObjects;
|
||||
|
||||
//Reset timer
|
||||
if (_timeSince > 0) then {
|
||||
_character setVariable ["lastTime",(time - _timeLeft)];
|
||||
};
|
||||
};
|
||||
};
|
||||
29
dayz_server/compile/server_publishObject.sqf
Normal file
29
dayz_server/compile/server_publishObject.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
private["_type","_location","_dir","_character","_tent","_class","_id","_uid"];
|
||||
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
|
||||
_charID = _this select 0;
|
||||
_object = _this select 1;
|
||||
_worldspace = _this select 2;
|
||||
_class = _this select 3;
|
||||
_id = 0;
|
||||
|
||||
if (!(_object isKindOf "Building")) exitWith {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
//diag_log ("PUBLISH: Attempt " + str(_object));
|
||||
_dir = _worldspace select 0;
|
||||
_location = _worldspace select 1;
|
||||
|
||||
//get UID
|
||||
_uid = _worldspace call dayz_objectUID2;
|
||||
|
||||
//Send request
|
||||
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
|
||||
_object setVariable ["ObjectUID", _uid,true];
|
||||
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||
|
||||
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
|
||||
129
dayz_server/compile/server_publishVehicle.sqf
Normal file
129
dayz_server/compile/server_publishVehicle.sqf
Normal file
@@ -0,0 +1,129 @@
|
||||
private["_object","_worldspace","_location","_dir","_character","_tent","_class","_id","_uid","_dam","_hitpoints","_selection","_array","_damage","_randFuel","_fuel","_key","_result","_outcome","_totaldam","_parts","_retry","_done"];
|
||||
//[_veh,[_dir,_location],"V3S_Civ"]
|
||||
_object = _this select 0;
|
||||
_worldspace = _this select 1;
|
||||
_class = _this select 2;
|
||||
_uid = _this select 3;
|
||||
|
||||
_fuel = 0;
|
||||
_damage = 0;
|
||||
_array = [];
|
||||
|
||||
diag_log ("PUBLISH: Attempt " + str(_object));
|
||||
_dir = _worldspace select 0;
|
||||
_location = _worldspace select 1;
|
||||
|
||||
//Generate UID
|
||||
_uid = _worldspace call dayz_objectUID2;
|
||||
// _uid = format["%1%2",dayZ_instance,_uid];
|
||||
|
||||
if (getNumber(configFile >> "CfgVehicles" >> _class >> "isBicycle") != 1) then {
|
||||
|
||||
// Create randomly damaged parts
|
||||
|
||||
_totaldam = 0;
|
||||
_hitpoints = _object call vehicle_getHitpoints;
|
||||
{
|
||||
_dam = 0;
|
||||
if(["Body",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_new_damage;
|
||||
};
|
||||
if(["Engine",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_exp_damage;
|
||||
};
|
||||
if(["HRotor",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_new_damage;
|
||||
};
|
||||
if(["Fuel",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_exp_damage;
|
||||
};
|
||||
if(["Wheel",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_new_damage;
|
||||
};
|
||||
if(["Glass",_x,false] call fnc_inString) then {
|
||||
_dam = call generate_new_damage;
|
||||
};
|
||||
|
||||
_selection = getText(configFile >> "cfgVehicles" >> _class >> "HitPoints" >> _x >> "name");
|
||||
|
||||
if (_dam > 0) then {
|
||||
_array set [count _array,[_selection,_dam]];
|
||||
_totaldam = _totaldam + _dam;
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
|
||||
|
||||
// just set low base dmg - may change later
|
||||
_damage = 0;
|
||||
|
||||
// 50% chance that vehicle will have a little gas
|
||||
_randFuel = random(1);
|
||||
if(_randFuel > 0.5) then {
|
||||
_fuel = random(0.5);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//Send request
|
||||
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , 0, _worldspace, [], _array, _fuel,_uid]; // Change this to dynamic parts damage and fuel
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
|
||||
// Wait just a little
|
||||
sleep 0.1;
|
||||
|
||||
_done = false;
|
||||
_retry = 0;
|
||||
while{not _done} do {
|
||||
|
||||
// GET DB ID
|
||||
_key = format["CHILD:388:%1:",_uid];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_result = [_key] call server_hiveReadWrite;
|
||||
_outcome = _result select 0;
|
||||
if (_outcome == "PASS") then {
|
||||
_oid = _result select 1;
|
||||
_object setVariable ["ObjectID", _oid, true];
|
||||
diag_log("CUSTOM: Selected " + str(_oid));
|
||||
_done = true;
|
||||
|
||||
} else {
|
||||
diag_log("CUSTOM: trying again to get id for: " + str(_uid));
|
||||
_done = false;
|
||||
_retry = _retry + 1;
|
||||
sleep 0.1;
|
||||
};
|
||||
if(_retry == 5) exitWith { deleteVehicle _object; diag_log("CUSTOM: failed to get id for : " + str(_uid)); };
|
||||
};
|
||||
|
||||
// disable marker later
|
||||
//_marker = createMarker [str(_location) , _location];
|
||||
//_marker setMarkerShape "ICON";
|
||||
//_marker setMarkerType "DOT";
|
||||
//_marker setMarkerText (typeOf _object);
|
||||
//_marker setMarkerColor "ColorBlue";
|
||||
|
||||
// not needed yet
|
||||
// _object setVariable ["ObjectUID", _uid, true];
|
||||
|
||||
_object setVariable ["lastUpdate",time];
|
||||
_object setVariable ["CharacterID", "0", true];
|
||||
|
||||
_object setDamage _damage;
|
||||
|
||||
// Set Hits after ObjectID is set
|
||||
{
|
||||
_selection = _x select 0;
|
||||
_dam = _x select 1;
|
||||
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
||||
[_object,_selection,_dam] call object_setFixServer;
|
||||
} forEach _array;
|
||||
|
||||
_object setvelocity [0,0,1];
|
||||
_object setFuel _fuel;
|
||||
|
||||
_id = _object spawn fnc_vehicleEventHandler;
|
||||
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||
|
||||
diag_log ("PUBLISH: Created " + (_class) + " with ID " + str(_uid));
|
||||
14
dayz_server/compile/server_routinePlayerCheck.sqf
Normal file
14
dayz_server/compile/server_routinePlayerCheck.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
private["_unitArray","_handle"];
|
||||
_unitArray = [];
|
||||
if (isSinglePlayer) then {
|
||||
_unitArray = [player];
|
||||
} else {
|
||||
_unitArray = dayz_players;
|
||||
};
|
||||
{
|
||||
if (!isNull _x) then {
|
||||
//diag_log ("SERVER: Routine Player Check: " + str(_x));
|
||||
_handle = _x spawn server_updatePlayer;
|
||||
waitUntil{scriptDone _handle};
|
||||
};
|
||||
} forEach _unitArray;
|
||||
24
dayz_server/compile/server_townDeZombify.sqf
Normal file
24
dayz_server/compile/server_townDeZombify.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
private["_position","_size","_loot","_zeds","_groups","_group"];
|
||||
_position = _this select 0;
|
||||
_size = _this select 1;
|
||||
_type = _this select 2;
|
||||
_town = nearestLocation [_position, _type];
|
||||
|
||||
//Clean Loot
|
||||
_loot = nearestObjects [_position, ["WeaponHolder"], _size];
|
||||
{
|
||||
deleteVehicle _x;
|
||||
} forEach _loot;
|
||||
|
||||
//Clean Zeds
|
||||
_zeds = _position nearEntities ["zZombie_Base",_size];
|
||||
_groups = [];
|
||||
{
|
||||
if (!(isNull _group)) then {
|
||||
_group = group _x;
|
||||
if (!(_group in _groups)) then {_groups set [count _groups,_group];};
|
||||
_x setDamage 1;
|
||||
};
|
||||
} forEach _zeds;
|
||||
diag_log "Dezombify Town";
|
||||
dayz_zombifiedTowns = dayz_zombifiedTowns - [_town];
|
||||
68
dayz_server/compile/server_townZombify.sqf
Normal file
68
dayz_server/compile/server_townZombify.sqf
Normal file
@@ -0,0 +1,68 @@
|
||||
private["_town","_spot","_buildings","_list","_size","_numZeds","_impt","_position","_buildings","_totalBuildings","_numGroups","_building","_type"];
|
||||
//has town
|
||||
_town = _this;
|
||||
_type = type _town;
|
||||
_spot = objNull;
|
||||
_buildings = [];
|
||||
_list = [];
|
||||
_numZeds = 2;
|
||||
|
||||
_impt = (importance _town);
|
||||
_size = 50;
|
||||
switch (_type) do {
|
||||
default {
|
||||
_numZeds = 3;
|
||||
_size = 40 * _impt;
|
||||
};
|
||||
case "NameCity": {
|
||||
_numZeds = 6;
|
||||
_size = 80 * _impt;
|
||||
};
|
||||
case "NameCityCapital": {
|
||||
_numZeds = 10;
|
||||
_size = 120 * _impt;
|
||||
};
|
||||
};
|
||||
|
||||
_position = position _town;
|
||||
_buildings = nearestObjects [_position, ["Building"], _size];
|
||||
_totalBuildings = count _buildings;
|
||||
_numGroups = 0;
|
||||
_i = 0;
|
||||
/*
|
||||
_markerstr = createMarker["markername_" + (text _town),_position];
|
||||
_markerstr setMarkerShape "ELLIPSE";
|
||||
_markerstr setMarkerSize [_size, _size];
|
||||
*/
|
||||
_trigger = createTrigger["EmptyDetector",_position];
|
||||
_trigger setTriggerArea[dayz_zSpawnDistance,dayz_zSpawnDistance,0,false];
|
||||
_trigger setTriggerActivation["WEST","NOT PRESENT",false];
|
||||
_code = format["_id = [%1,%2,'%3'] spawn server_townDeZombify;",_position,_size,_type];
|
||||
_trigger setTriggerStatements["this", _code, ""];
|
||||
_val = 60 * 10;
|
||||
_trigger setTriggerTimeout [_val, _val, _val, true];
|
||||
|
||||
|
||||
while {_numGroups < _numZeds and _i < _totalBuildings} do {
|
||||
_building = _buildings call BIS_fnc_selectRandom;
|
||||
if (!isNull _building) then {
|
||||
_list = _building nearRoads 20;
|
||||
if (count _list > 0) then {
|
||||
_spot = _list call BIS_fnc_selectRandom;
|
||||
_nearMen = (position _spot) nearEntities [["Man"],50];
|
||||
if (!isNull _spot and (count _nearMen == 0)) then {
|
||||
/*
|
||||
_marker = createMarker [(text _town) + "Marker2" + str(_i), position _spot];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "DOT";
|
||||
_marker setMarkerColor "ColorBlue";
|
||||
_marker setMarkerText str(_i);
|
||||
*/
|
||||
_numGroups = _numGroups + 1;
|
||||
(position _spot) spawn dayz_spawnZombies;
|
||||
};
|
||||
};
|
||||
};
|
||||
_i = _i + 1;
|
||||
sleep 0.1;
|
||||
};
|
||||
6
dayz_server/compile/server_updateNearbyObjects.sqf
Normal file
6
dayz_server/compile/server_updateNearbyObjects.sqf
Normal file
@@ -0,0 +1,6 @@
|
||||
private["_pos","_objects"];
|
||||
_pos = _this select 0;
|
||||
|
||||
{
|
||||
[_x, "gear"] call server_updateObject;
|
||||
} forEach nearestObjects [_pos, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10];
|
||||
95
dayz_server/compile/server_updateObject.sqf
Normal file
95
dayz_server/compile/server_updateObject.sqf
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
[_object,_type] spawn server_updateObject;
|
||||
*/
|
||||
private["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate"];
|
||||
|
||||
_object = _this select 0;
|
||||
_type = _this select 1;
|
||||
|
||||
_objectID = _object getVariable ["ObjectID","0"];
|
||||
_uid = _object getVariable ["ObjectUID","0"];
|
||||
if (_objectID == "0" && _uid == "0") then { _uid = _object call dayz_objectUID; }; //seems never been call
|
||||
|
||||
_lastUpdate = _object getVariable ["lastUpdate",time];
|
||||
_needUpdate = _object in needUpdate_objects;
|
||||
|
||||
// TODO ----------------------
|
||||
_object_position = {
|
||||
private["_position","_worldspace","_fuel","_key"];
|
||||
_position = getPosATL _object;
|
||||
_worldspace = [
|
||||
round(direction _object),
|
||||
_position
|
||||
];
|
||||
_fuel = 0;
|
||||
if (_object isKindOf "AllVehicles") then {
|
||||
_fuel = fuel _object;
|
||||
};
|
||||
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
|
||||
_object_inventory = {
|
||||
private["_inventory","_previous","_key"];
|
||||
_inventory = [
|
||||
getWeaponCargo _object,
|
||||
getMagazineCargo _object,
|
||||
getBackpackCargo _object
|
||||
];
|
||||
_previous = str(_object getVariable["lastInventory",[]]);
|
||||
if (str(_inventory) != _previous) then {
|
||||
_object setVariable["lastInventory",_inventory];
|
||||
if (_objectID == "0") then {
|
||||
_key = format["CHILD:309:%1:%2:",_uid,_inventory];
|
||||
} else {
|
||||
_key = format["CHILD:303:%1:%2:",_objectID,_inventory];
|
||||
};
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
};
|
||||
|
||||
_object_damage = {
|
||||
private["_hitpoints","_array","_hit","_selection","_key","_damage"];
|
||||
_hitpoints = _object call vehicle_getHitpoints;
|
||||
_damage = damage _object;
|
||||
_array = [];
|
||||
{
|
||||
_hit = [_object,_x] call object_getHit;
|
||||
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
|
||||
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
|
||||
} forEach _hitpoints;
|
||||
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
_object setVariable ["needUpdate",false,true];
|
||||
};
|
||||
// TODO ----------------------
|
||||
|
||||
_object setVariable ["lastUpdate",time,true];
|
||||
switch (_type) do {
|
||||
case "all": {
|
||||
call _object_position;
|
||||
call _object_inventory;
|
||||
call _object_damage;
|
||||
};
|
||||
case "position": {
|
||||
call _object_position;
|
||||
};
|
||||
case "gear": {
|
||||
call _object_inventory;
|
||||
};
|
||||
case "damage": {
|
||||
if ( (time - _lastUpdate) > 5 && !_needUpdate ) then {
|
||||
call _object_damage;
|
||||
} else {
|
||||
if ( !_needUpdate ) then {
|
||||
needUpdate_objects set [count needUpdate_objects, _object];
|
||||
};
|
||||
};
|
||||
};
|
||||
case "repair": {
|
||||
call _object_damage;
|
||||
};
|
||||
};
|
||||
0
dayz_server/compile/server_updatePlayer.sqf
Normal file
0
dayz_server/compile/server_updatePlayer.sqf
Normal file
46
dayz_server/compile/zombie_findOwner.sqf
Normal file
46
dayz_server/compile/zombie_findOwner.sqf
Normal file
@@ -0,0 +1,46 @@
|
||||
private["_unit","_potential","_newOwner","_client"];
|
||||
_unit = _this select 0;
|
||||
|
||||
diag_log ("CLEANUP: DELETE UNCONTROLLED ZOMBIE: " + (typeOf _unit) + " OF: " + str(_unit) );
|
||||
deleteVehicle _unit;
|
||||
|
||||
/*
|
||||
|
||||
//Not server then exit
|
||||
if(!isServer) exitWith {
|
||||
diag_log ("DW_DEBUG: #findOwner exits as not server: " + str(isServer));
|
||||
};
|
||||
//Not local then exit
|
||||
if(!local _unit) exitWith {
|
||||
diag_log ("DW_DEBUG: #findOwner exits _unit not local: " + str(local _unit));
|
||||
};
|
||||
|
||||
//Find a new owner
|
||||
_potential = (getposATL _unit) nearEntities [["CAManBase"],300];
|
||||
_newOwner = objNull;
|
||||
{
|
||||
if (isPlayer _x) then {
|
||||
_newOwner = _x;
|
||||
};
|
||||
if (!isNull _newOwner) exitWith {
|
||||
//diag_log ("DW_DEBUG: #findOwner potencial _newOwner: " + str(_newOwner));
|
||||
};
|
||||
} forEach _potential;
|
||||
|
||||
//If no nearby player, delete the agent
|
||||
|
||||
//diag_log ("DW_DEBUG: #findOwner isNull _newOwner: " + str(isNull _newOwner));
|
||||
|
||||
if(isNull _newOwner) exitWith {
|
||||
diag_log ("CLEANUP: NOTHING TO TRANSFER OWNERSHIP OF TYPE: " + (typeOf _unit) + " OF: " + str(_unit) );
|
||||
deleteVehicle _unit;
|
||||
};
|
||||
|
||||
//set client as controller
|
||||
_client = owner _newOwner;
|
||||
|
||||
_unit setOwner _client;
|
||||
|
||||
diag_log ("CLEANUP: TRANSFERRED OWNERSHIP OF TYPE: " + (typeOf _unit) + " OF _unit: " + str(_unit) + " TO _client: " + str(_client) );
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user