1.7.5.M1D7

This commit is contained in:
A Clark
2013-01-07 12:45:28 -06:00
parent ef2920120c
commit 944cd01129
33 changed files with 7972 additions and 469 deletions

View File

@@ -8,7 +8,7 @@ _class = _this select 3;
if (!(_object isKindOf "Building")) exitWith {
deleteVehicle _object;
};
_allowed = [_object] call check_publishobject;
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { };
@@ -24,6 +24,10 @@ _key call server_hiveWrite;
_object setVariable ["ObjectUID", _uid,true];
if (_object isKindOf "TentStorage") then {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);

View File

@@ -52,17 +52,6 @@ while {true} do {
diag_log(format["CRASHSPAWNER: Spawning '%1' with loot table '%2' NOW! (%3) at: %4", _crashName, _lootTable, time, str(_position)]);
_crash = createVehicle [_crashModel,_position, [], 0, "CAN_COLLIDE"];
deleteMarker "Secure Helicopter Wreck";
///Add crash site markers
_crashmarker = createMarker["Secure Helicopter Wreck",_position];
_crashmarker setMarkerColor "ColorRed";
_crashmarker setMarkerType "Flag";
//_crashmarker setMarkerShape "ELLIPSE";
//_crashmarker setMarkerBrush "Grid";
_crashmarker setMarkerText "Secure Helicopter";
_crashmarker setMarkerSize [1, 1];
// Randomize the direction the wreck is facing
_crash setDir round(random 360);

View File

@@ -89,6 +89,47 @@ _object_damage = {
_key call server_hiveWrite;
_object setVariable ["needUpdate",false,true];
};
_object_killed = {
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]]};
_hit = 1;
_object setHit ["_selection", _hit]
} forEach _hitpoints;
_damage = 1;
if (_objectID == "0") then {
_key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
} else {
_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];
};
_object_repair = {
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]]};
_object setHit ["_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];
@@ -105,15 +146,18 @@ switch (_type) do {
call _object_inventory;
};
case "damage": {
if ( (time - _lastUpdate) > 5 && !_needUpdate ) then {
diag_log ("Damaged Called");
if ( (time - _lastUpdate) > 5) then {
call _object_damage;
} else {
if ( !_needUpdate ) then {
diag_log format["DEBUG: Added to NeedUpdate=%1",_object];
needUpdate_objects set [count needUpdate_objects, _object];
};
};
case "killed": {
call _object_killed;
};
case "repair": {
call _object_damage;
call _object_repair;
};
};

View File

@@ -30,25 +30,36 @@ server_spawnCrashSite = compile preprocessFileLineNumbers "\z\addons\dayz_se
vehicle_handleInteract = {
private["_object"];
_object = _this select 0;
needUpdate_objects = needUpdate_objects - [_object];
[_object, "all"] call server_updateObject;
};
vehicle_handleServerKilled = {
private["_unit","_killer"];
_unit = _this select 0;
_killer = _this select 1;
[_unit, "killed"] call server_updateObject;
_unit removeAllMPEventHandlers "MPKilled";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "GetOut";
};
check_publishobject = {
private["_allowed","_allowedObjects","_object"];
_object = _this select 0;
_playername = _this select 1;
_allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"];
_noncombatitems = ["ThrownObjects", "RoadFlare", "ChemLight"];
_allowed = false;
_allowed = false;
diag_log format ["DEBUG: Checking if Object: %1 is allowed", _object];
diag_log format ["DEBUG: Checking if Object: %1 is allowed published by %2", _object, _playername];
if ((typeOf _object) in _allowedObjects) then {
diag_log format ["DEBUG: Object: %1 Safe",_object];
_allowed = true;
};
if ((typeOf _object) in _noncombatitems) then {
diag_log format ["DEBUG: NONCombat: %1 Safe",_object];
diag_log format ["DEBUG: Object: %1 published by %2 is Safe",_object, _playername];
_allowed = true;
};

View File

@@ -1,11 +1,11 @@
/*%FSM<COMPILE "scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<COMPILE "F:\DayZ\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"};
item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"};
item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"};
item3[] = {"time_dead",4,218,-300.000000,-25.000000,-200.000000,25.000000,4.000000,"time" \n "dead"};
item4[] = {"cleanup_dead",2,250,-300.000000,50.000000,-200.000000,100.000000,0.000000,"cleanup" \n "dead"};
item4[] = {"cleanup_dead",2,4346,-300.000000,50.000000,-200.000000,100.000000,0.000000,"cleanup" \n "dead"};
item5[] = {"time_items",4,218,0.000000,-25.000000,100.000000,25.000000,2.000000,"time" \n "items"};
item6[] = {"cleanup_items",2,250,0.000000,50.000000,100.000000,100.000000,0.000000,"cleanup" \n "items"};
item7[] = {"time_sync",4,218,-150.000000,-25.000000,-50.000000,25.000000,3.000000,"time" \n "sync"};
@@ -19,7 +19,7 @@ item14[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.00000
item15[] = {"update_objects",2,250,150.000000,50.000000,250.000000,100.000000,0.000000,"update objects"};
item16[] = {"time_obj_update",4,218,150.000000,-25.000000,250.000000,25.000000,1.000000,"time" \n "obj update"};
item17[] = {"anti_hack",4,218,150.000000,-100.000000,250.000000,-50.000000,0.000000,"anti hack"};
item18[] = {"check_for_hacker",2,4346,150.000000,-175.000000,250.000000,-125.000000,0.000000,"check for" \n "hackers"};
item18[] = {"check_for_hacker",2,250,150.000000,-175.000000,250.000000,-125.000000,0.000000,"check for" \n "hackers"};
link0[] = {0,13};
link1[] = {1,2};
link2[] = {2,3};
@@ -43,8 +43,8 @@ link19[] = {15,9};
link20[] = {16,15};
link21[] = {17,18};
link22[] = {18,1};
globals[] = {25.000000,1,0,0,0,640,480,1,33,6316128,1,-380.893097,315.695129,343.738464,-460.417511,803,927,1};
window[] = {2,-1,-1,-1,-1,1039,132,1246,132,3,820};
globals[] = {25.000000,1,0,0,0,640,480,1,33,6316128,1,-389.695160,324.496887,564.215637,-260.262604,803,927,1};
window[] = {2,-1,-1,-1,-1,995,88,1202,88,3,820};
*//*%FSM</HEAD>*/
class FSM
{
@@ -144,77 +144,48 @@ class FSM
" diag_log (""CLEANUP: TOO MANY DEAD BODIES"");" \n
" diag_log (""CLEANUP: PERFORMING BODY CLEANUP ON "" + str(_numDead) + "" BODIES"");" \n
"" \n
" //Cleanup zed's & players" \n
"" \n
" _delQtyZ = 0; " \n
" _numZombie = {_x isKindOf ""zZombie_Base""} count allDead;" \n
" _delQtyP = 0;" \n
" {" \n
" if (local _x) then {" \n
" if (_x isKindOf ""zZombie_Base"") then {" \n
" deleteVehicle _x;" \n
" _delQtyZ = _delQtyZ + 1;" \n
" } else {" \n
" _exists = _x in _deadBodies;" \n
" if(!_exists) then {" \n
" _deadBodies set [count _deadBodies,_x];" \n
" _pos = getPosATL _x;" \n
" _sfx = nearestObject [_pos,""Sound_Flies""];" \n
" if (!(isNull _sfx)) then {" \n
" deleteVehicle _sfx;" \n
" };" \n
" deleteVehicle _x;" \n
" _delQtyP = _delQtyP + 1;" \n
" };" \n
" };" \n
" } forEach allDead;" \n
"" \n
" //Cleanup players" \n
" _body = objNull;" \n
" _delQtyP = 0;" \n
" _delDo = _numDead - _numZombie;" \n
" _delDo = ((_delDo min (count _deadBodies)) -1);" \n
" if (_delDo<1) then {_delDo=1};" \n
" for ""_i"" from 0 to _delDo do {" \n
" _body = _deadBodies select _i;" \n
" if(!isNil ""_body"") then {" \n
" _pos = getPosATL _body;" \n
" _sfx = nearestObject [_pos,""Sound_Flies""];" \n
" if (!(isNull _sfx)) then {" \n
" deleteVehicle _sfx;" \n
" };" \n
" deleteVehicle _body;" \n
" _delQtyP = _delQtyP + 1;" \n
" //Check Flies" \n
" _dwUSOFC=0;" \n
" {" \n
" if (local _x) then {" \n
" deleteVehicle _x;" \n
" _dwUSOFC=_dwUSOFC+1;" \n
" };" \n
" _deadBodies set [_i,""DEL""];" \n
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED SOUND OF FLIES:"" + str(_dwUSOFC) );" \n
" } forEach allMissionObjects ""Sound_Flies"";" \n
"" \n
" //Let's move this into the body removal sequence so uncontrolled flies are removed only if corpses are cleaned" \n
" //Check Flies" \n
" _isOK=-1;" \n
" _dwUSOFC=0;" \n
" {" \n
" //_isOk = {!alive _x} count (nearestObjects [_x, [""CAManBase""], 2]);" \n
" _isOk = {!alive _x} count (_x nearEntities [[""CAManBase""], 2]);" \n
" if (_isOk>-1) then {" \n
" diag_log (""DW_DEBUG _isOK: "" + str(_isOK) );" \n
" };" \n
" if ((_isOk>-1) AND (_isOK<1)) then {" \n
" //diag_log (""CLEANUP: DELETING A SOUND OF FLIES"");" \n
" _dwUSOFC=_dwUSOFC+1;" \n
" deleteVehicle _x;" \n
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED SOUND OF FLIES:"" + str(_dwUSOFC) );" \n
" };" \n
" } forEach allMissionObjects ""Sound_Flies"";" \n
"" \n
"" \n
" //Let's move this into the body removal sequence so uncontrolled fireplaces are removed only if corpses are cleaned" \n
" //clean fireplaces" \n
" _dwUFPC=0;" \n
" {" \n
" if (local _x) then {" \n
" //diag_log (""CLEANUP: DELETING A UNCONTROLLED FIREPLACE"");" \n
" deleteVehicle _x;" \n
" _dwUFPC=_dwUFPC+1;" \n
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED FIREPLACE:"" + str(_dwUFPC) );" \n
" };" \n
" } forEach allMissionObjects ""Land_Fire_DZ"";" \n
"" \n
" };" \n
" _deadBodies = _deadBodies - [""DEL""];" \n
" //clean fireplaces" \n
" _dwUFPC=0;" \n
" {" \n
" if (local _x) then {" \n
" deleteVehicle _x;" \n
" _dwUFPC=_dwUFPC+1;" \n
" };" \n
" diag_log (""CLEANUP: DELETED AN UNCONTROLLED FIREPLACE:"" + str(_dwUFPC) );" \n
" } forEach allMissionObjects ""Land_Fire_DZ"";" \n
"" \n
" diag_log (""CLEANUP: DELETED "" + str(_delQtyP) + "" PLAYER BODIES AND "" + str(_delQtyZ) + "" BODIES"");" \n
"" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
@@ -246,7 +217,7 @@ class FSM
" if (local _x) then {" \n
" _qtyLoc = _qtyLoc + 1; // debugging" \n
" _keep = _x getVariable [""permaLoot"",false];" \n
" _nearby = {isPlayer _x} count (_x nearEntities [[""CAManBase""], 100]);" \n
" _nearby = count (_x nearEntities [AllPlayers, 100]);" \n
" if ( (!_keep) && (_nearby==0) ) then {" \n
" deleteVehicle _x;" \n
" _delQty = _delQty + 1;" \n

View File

@@ -53,6 +53,11 @@ diag_log "HIVE: Starting";
_ownerID = _x select 3;
_worldspace = _x select 4;
_intentory= _x select 5;
_hitPoints= _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
_dir = 0;
_pos = [0,0,0];
_wsDone = false;
@@ -71,11 +76,6 @@ diag_log "HIVE: Starting";
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
};
_intentory= _x select 5;
_hitPoints= _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
if (_damage < 1) then {
diag_log format["OBJ: %1 - %2", _idKey,_type];
@@ -88,7 +88,11 @@ diag_log "HIVE: Starting";
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
_object setpos _pos;
if (_object isKindOf "TentStorage") then {
_pos set [2,0];
_object setpos _pos;
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
_object setdir _dir;
_object setDamage _damage;
@@ -157,11 +161,7 @@ diag_log "HIVE: Starting";
} forEach _hitpoints;
_object setvelocity [0,0,1];
_object setFuel _fuel;
if (getDammage _object == 1) then {
_position = ([(getPosATL _object),0,100,10,0,500,0] call BIS_fnc_findSafePos);
_object setPosATL _position;
};
if(_ownerID != "0") then {
_object setvehiclelock "locked";
};