From 80f4f9a44962788659709e591bd60ac684e3c09f Mon Sep 17 00:00:00 2001 From: vbawol Date: Thu, 16 Jun 2016 19:27:06 -0500 Subject: [PATCH] 0.3.9.0528 [fixed] invalid vehicle token check was not enabled if simulation handler was disabled. [changed] rework load vehicle script to make vehicles immune for 120 seconds and then apply damage and hitpoints. --- .../@epochhive/addons/epoch_server.pbo | Bin 425331 -> 425717 bytes Sources/epoch_server/build.hpp | 2 +- .../epoch_vehicle/EPOCH_load_vehicles.sqf | 122 ++++++++---------- .../epoch_server/system/server_monitor.fsm | 12 +- build.txt | 2 +- 5 files changed, 59 insertions(+), 79 deletions(-) diff --git a/Server_Install_Pack/@epochhive/addons/epoch_server.pbo b/Server_Install_Pack/@epochhive/addons/epoch_server.pbo index d7e210d9c712b243e45d577b5a8ba4e5a3726884..1cf9c27ccfb121b217e231624ba20e6ca3855bbe 100644 GIT binary patch delta 1858 zcmZ8iYitx%6n4%&uq8`*RA7P1WrL+lH`~%$iVtk06wpKv10|%bo6GJk9XmU-%*+-F zAw>-mK*D3y12OakXn9sFbQDn}7>N)P^_Pk<_(;SD6f`B#fO_xD?o!<3ZtmWD&v(9a z&UeoK`L}=Yj(^7jc)WV&)04cbs-nyC?%Vlc+41)8Mte)Eqs!!?)QoYHQziLc44#I( z)c6NR^_?H{sf!!*Z68-FdHUu=mt9HyI(`AHs!BcVUp!$(X+`PGS%JrVx$F5F_~6Wn zq^!hdSCq}dvv;K0mk0fu2K|yX=!b&!7(#dk_amJ1MOs*s997s{8mB9xZ=QJ2= z?b-vUUDn3Ea9awLln^69SF0rbmQa(JES?~W7Nw@FsbO5(0m0Obmmb0k9Wc2#$Nq4$ zIBjNGD>)uds*E)1TAaj$I~MlkVqhNx=Lrv{rZdM6i)CyKBCCYzI&CGU=AdaDB1#oS z9Ox`gWz`@}RE;T2$6q?2q>^LtbFGDgF@;4G*Z9_;Y?~5-l4NC-QGK_>t~~ z0{o;CM&qRyVK{#F2jsoc1EZ?45eYMc=`Bnrh8$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5N{5 z-n=>Io|RSiqsQ)nGKi4DLtD+mw)$H8GlO4vaj}GnnV$GI&OF%3*Dhyjo`h5_-)Wu= z$KPdW^X%D#8WUH#zpC~-ZD~sx4BNDw?&`#X-9_HQooU53YZtBGqSsHfi&9|kE^iUe zubOIlR@}WSZj-*^hU6}+)?o`e5UO%=)BK9q+%EB|7?R6)IUosbX%rNjo7-ifMrac2 zCE=A8{-lg`2w&swAt=VLZg6=xse_Yi;3Y-C(zlq*xTi3-y~k`#{4buCOV)X<$C>B# zjv-iNkUI$RxO5(p^?m1n0bIP#vKShH6wL9NGI4qY2nNqXKKjPMqFwCTgrlQSiq0{3 z9Up%N$!43?LN831gIz%Hhvs01$%5(}cvFlQ{w7gv35l|*kiEpux3v*Pkc4`b6k^Gr ztP5x6pimnRI`G#y@L*yDittV)uy`Z_Nm{w=KqUfR%%}uAUX8$J4ELGrxm4)&&sr>E z1Ic=dXxT(<668~~3x6MhY}W7wtruWBV?eEUS)V?B0i4X*GUq2Y3E!Q70sL_swqw== zBy(%~oxj6`S}5nZ}dx{M$!;!YvxsQH0{Omii+~XFYO`zj&b4gaCpdJY+rLR`}4Q3xhdl>StI1B|ShT%<&`oMzs!!U}$&shs* zo`wUs)CYF`&PB*J;h8?L;ZPsAFy%6Qg!}qo6PEW=gF5=5P74R^n01ql5P@`R@pDnw5o1`qrtS16@IFwD$5J6)ulN)$n?BINoo=)KuR(qz z6)rSp)_5w3r&d{x`guuuk^&`ny~TfwC`KR*S1pPp2rbllwMkSqM#__IP%WqYorJPO zClB(?e4{|rwsxV5)Q8$-^ZwL=XB1(^f{30EI--{UB2cH#0pE)I|X!LipKam!A0=$x$A#h80K aoVU-VzI=5!GjVo*^*~@MAkDW1ZGQoeC$0(r diff --git a/Sources/epoch_server/build.hpp b/Sources/epoch_server/build.hpp index 44cd4c75..40724ea7 100644 --- a/Sources/epoch_server/build.hpp +++ b/Sources/epoch_server/build.hpp @@ -1 +1 @@ -build=527; +build=528; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf index 8bb835a1..b418b101 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -12,7 +12,7 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf */ -private ["_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgEpochVehicles","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_immuneVehicleSpawnTime","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig","_simulationHandler","_immuneVehicleSpawn"]; +private ["_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgEpochVehicles","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig"]; params [["_maxVehicleLimit",0]]; _diag = diag_tickTime; @@ -20,10 +20,9 @@ _dataFormat = ["", [], 0, [], 0, [], [], 0]; _dataFormatCount = count _dataFormat; EPOCH_VehicleSlots = []; _allVehicles = []; +_vehicleDamages = []; _serverSettingsConfig = configFile >> "CfgEpochServer"; -_simulationHandler = [_serverSettingsConfig, "simulationHandler", false] call EPOCH_fnc_returnConfigEntry; -_immuneVehicleSpawn = [_serverSettingsConfig, "immuneVehicleSpawn", false] call EPOCH_fnc_returnConfigEntry; for "_i" from 1 to _maxVehicleLimit do { _vehicleSlotIndex = EPOCH_VehicleSlots pushBack str(_i); @@ -56,46 +55,33 @@ for "_i" from 1 to _maxVehicleLimit do { _location = (_location select 0) vectorAdd (_location select 1); }; - EPOCH_VehicleSlots deleteAt _vehicleSlotIndex; - // temp for changes in class names _found = ["O_Heli_Transport_04_F","O_Heli_Transport_04_bench_F","O_Heli_Transport_04_box_F","O_Heli_Transport_04_covered_F","B_Heli_Transport_03_unarmed_F","O_Truck_03_covered_F"] find _class; if (_found != -1) then { _class = ["O_Heli_Transport_04_EPOCH","O_Heli_Transport_04_bench_EPOCH","O_Heli_Transport_04_box_EPOCH","O_Heli_Transport_04_covered_EPOCH","B_Heli_Transport_03_unarmed_EPOCH","O_Truck_03_covered_EPOCH"] select _found; }; - _vehicle = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"]; + // spawn vehicle at temp location. + _vehicle = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"]; if !(isNull _vehicle) then { - + // make vehicle immune from damage. + _vehicle allowDamage false; + // store spawned vehicles in array to make one call to remains handler _allVehicles pushBack _vehicle; + // remove selected slot from array and set on vehicle + EPOCH_VehicleSlots deleteAt _vehicleSlotIndex; + _vehicle setVariable ["VEHICLE_SLOT", str(_i), true]; + // set server side token and init vehicle event handlers. _vehicle call EPOCH_server_setVToken; _vehicle call EPOCH_server_vehicleInit; - + // set final direction and postion of vehicle _vehicle setVectorDirAndUp _worldspace; _vehicle setposATL _location; - _vehicle setDamage _damage; - - _allHitpoints = getAllHitPointsDamage _vehicle; - if !(_allHitpoints isEqualTo []) then{ - _actualHitpoints = _allHitpoints select 0; - _hitpoints = _arr select 3; - if ((count _actualHitpoints) == (count _hitpoints)) then{ - { - _dmg = _hitpoints param [_forEachIndex,0]; - if (_x in ["HitFuel", "HitEngine"]) then { - _dmg = _dmg min 0.9; - }; - _vehicle setHitIndex [_forEachIndex, _dmg]; - } forEach _actualHitpoints; - }; - }; - - if (_immuneVehicleSpawn) then{ - _vehicle allowDamage false; - }; - + // push damage to temp array to apply damage after some delay + _vehicleDamages pushBack [_vehicle,_damage,(_arr select 3)]; + // set fuel level _vehicle setFuel (_arr select 4); - + // apply persistent textures _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; _availableColorsConfig = (_cfgEpochVehicles >> _class >> "availableColors"); if (isArray(_availableColorsConfig)) then { @@ -113,39 +99,30 @@ for "_i" from 1 to _maxVehicleLimit do { } forEach _selections; _vehicle setVariable ["VEHICLE_TEXTURE", _color]; }; - + // disable thermal imaging equipment + _vehicle disableTIEquipment true; + // lock all vehicles + _vehicle lock true; + // load vehicle inventory clearWeaponCargoGlobal _vehicle; clearMagazineCargoGlobal _vehicle; clearBackpackCargoGlobal _vehicle; clearItemCargoGlobal _vehicle; - - _vehicle disableTIEquipment true; - - _vehicle lock true; - - _vehicle setVariable ["VEHICLE_SLOT", str(_i), true]; - - //diag_log format ["FILLING: _vehicle %1 pos: %2", _vehicle, (getPosATL _vehicle)]; { _objType = _forEachIndex; - _objTypes = _x; _objQty = []; - if (_objType in [1, 2, 3]) then { _objTypes = _x select 0; _objQty = _x select 1; }; - { switch _objType do { // Weapon cargo case 0: { if (_x isEqualType []) then { if ((count _x) >= 4) then { - _vehicle addWeaponCargoGlobal[_x deleteAt 0, 1]; - _attachments = []; _wMags = false; _wMagsArray = []; @@ -155,27 +132,23 @@ for "_i" from 1 to _maxVehicleLimit do { if (_x isEqualType []) then{ _wMags = true; _wMagsArray = _x; - } - else { + } else { // attachments if (_x != "") then{ _attachments pushBack _x; }; }; } forEach _x; - // add all attachments to vehicle // TODO replace with adding attachments directly to gun (Arma feature dependant) { _vehicle addItemCargoGlobal[_x, 1]; } forEach _attachments; - if (_wMags) then{ if (_wMagsArray isEqualType [] && (count _wMagsArray) >= 2) then{ _vehicle addMagazineAmmoCargo[_wMagsArray select 0, 1, _wMagsArray select 1]; }; }; - }; }; }; @@ -183,13 +156,10 @@ for "_i" from 1 to _maxVehicleLimit do { case 1: { _magazineName = _x; _magazineSize = _objQty select _forEachIndex; - if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then { _magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count"); - // Add full magazines cargo _vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax]; - // Add last non full magazine if ((_magazineSize % _magazineSizeMax) > 0) then { _vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)]; @@ -213,24 +183,20 @@ for "_i" from 1 to _maxVehicleLimit do { }; } forEach _objTypes; } forEach (_arr select 5); - // remove and add back magazines works for armed trucks but not helis ATM {_vehicle removeMagazineGlobal _x}count (magazines _vehicle); {_vehicle addMagazine _x}count (_arr select 6); - // turrets /* _mags = _vehicle magazinesTurret [0]; { _object removeMagazinesTurret [_x, [0]]; } forEach _mags; - _mags = _vehicle magazinesTurret [-1]; { _object removeMagazinesTurret [_x, [-1]]; } forEach _mags; */ - if (EPOCH_DEBUG_VEH) then { _marker = createMarker [str(_location) , _location]; _marker setMarkerShape "ICON"; @@ -238,15 +204,9 @@ for "_i" from 1 to _maxVehicleLimit do { _marker setMarkerText _class; _marker setMarkerColor "ColorGreen"; }; - - if (_simulationHandler) then{ - _vehicle enableSimulationGlobal false; - }; - } else { diag_log format["DEBUG: vehicle object Null: class: %1, loc: %2, slot: %3",_class, _location,str(_i)]; }; - } else { diag_log format["DEBUG: invalid vehicle position array %1",_location]; }; @@ -261,17 +221,37 @@ for "_i" from 1 to _maxVehicleLimit do { }; }; -// re-enable damage to vehicles after we wait -if (_immuneVehicleSpawn) then{ - _immuneVehicleSpawnTime = [_serverSettingsConfig, "immuneVehicleSpawnTime", 120] call EPOCH_fnc_returnConfigEntry; - [_allVehicles,_immuneVehicleSpawnTime] spawn{ - sleep (_this select 1); - {_x allowDamage true} count (_this select 0); - }; +// re-enable damage and apply to vehicles after we wait some time. +[_vehicleDamages,([_serverSettingsConfig, "immuneVehicleSpawnTime", 120] call EPOCH_fnc_returnConfigEntry),([_serverSettingsConfig, "simulationHandler", true] call EPOCH_fnc_returnConfigEntry)] spawn { + params [["_vehicleDamages",[]],["_immuneTime",120],["_simulationHandler",true]]; + // wait for some time to let all vehicles settle. + sleep _immuneTime; + // set final damages + { + _x params ["_vehicle","_damage","_hitpoints"]; + _vehicle allowDamage true; + _vehicle setDamage _damage; + _allHitpoints = getAllHitPointsDamage _vehicle; + if !(_allHitpoints isEqualTo []) then{ + _actualHitpoints = _allHitpoints select 0; + if ((count _actualHitpoints) == (count _hitpoints)) then{ + { + _dmg = _hitpoints param [_forEachIndex,0]; + if (_x in ["HitFuel", "HitEngine"]) then { + _dmg = _dmg min 0.9; + }; + _vehicle setHitIndex [_forEachIndex, _dmg]; + } forEach _actualHitpoints; + }; + }; + // vehicle simulation handler + if (_simulationHandler) then{ + _vehicle enableSimulationGlobal false; + }; + } forEach _vehicleDamages; }; - +// add all spawned vehicles to remains collector. addToRemainsCollector _allVehicles; - diag_log format ["Epoch: Vehicle SPAWN TIMER %1, LOADED %2 VEHICLES", diag_tickTime - _diag, count _allVehicles]; true diff --git a/Sources/epoch_server/system/server_monitor.fsm b/Sources/epoch_server/system/server_monitor.fsm index b36ed9ec..76675245 100644 --- a/Sources/epoch_server/system/server_monitor.fsm +++ b/Sources/epoch_server/system/server_monitor.fsm @@ -50,7 +50,7 @@ class FSM "_serverSettingsConfig = configFile >> ""CfgEpochServer"";" \n "_ahInitAuthCfg = [_serverSettingsConfig, ""antihack_ahInitAuthCfg"", [0,180]] call EPOCH_fnc_returnConfigEntry;" \n "_events = [_serverSettingsConfig, ""events"", []] call EPOCH_fnc_returnConfigEntry;" \n - "_simulationHandler = [_serverSettingsConfig, ""simulationHandler"", false] call EPOCH_fnc_returnConfigEntry;" \n + "_simulationHandler = [_serverSettingsConfig, ""simulationHandler"", true] call EPOCH_fnc_returnConfigEntry;" \n "" \n "_initAhInitBanOrLog = _ahInitAuthCfg select 0;" \n "_initTimeLimit = _ahInitAuthCfg select 1;" \n @@ -319,21 +319,21 @@ class FSM "_playersTemp = [];" \n "{ " \n " if (isPlayer _x) then {" \n - " if (_simulationHandler) then {" \n + "" \n " {" \n " if !(typeOf _x in _safeVehicles) then {" \n " if (_x call EPOCH_server_getVToken) then {" \n - " if !(simulationEnabled _x) then {" \n + " if (_simulationHandler && !(simulationEnabled _x)) then {" \n " _x enableSimulationGlobal true;" \n " _activeVehicles pushBack _x;" \n " };" \n " } else {" \n - " //diag_log format[""DEBUG: vtoken del %1"",_x];" \n + " diag_log format[""DEBUG: Invalid Vehicle Token, deleted %1"",_x];" \n " deleteVehicle _x;" \n " };" \n " };" \n " }forEach (_x nearEntities[[""LandVehicle"", ""Ship"", ""Air"", ""Tank""], 300]);" \n - " };" \n + "" \n "" \n " _pUID = getPlayerUID _x;" \n "" \n @@ -458,4 +458,4 @@ class FSM { }; }; -/*%FSM*/ \ No newline at end of file +/*%FSM*/ diff --git a/build.txt b/build.txt index cf4c0899..4a407b51 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -527 +528