mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
litter simulation createVehicleLocal /w temporal network sync.
This commit is contained in:
parent
c952a97de8
commit
f31e3c1fd4
@ -124,4 +124,10 @@ class ACE_Settings {
|
||||
values[] = {"$STR_ACE_Medical_painEffect_Flash", "$STR_ACE_Medical_painEffect_Chroma"};
|
||||
isClientSettable = 1;
|
||||
};
|
||||
|
||||
class GVAR(litterSimulationDetail) {
|
||||
typeName = "SCALAR";
|
||||
value = 2;
|
||||
values[] = {"None", "500", "All"};
|
||||
};
|
||||
};
|
||||
|
@ -265,3 +265,7 @@ if (USE_WOUND_EVENT_SYNC) then {
|
||||
["playerInventoryChanged", {
|
||||
[ACE_player] call FUNC(itemCheck);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
|
||||
// Networked litter
|
||||
[QGVAR(createLitter), FUNC(handleCreateLitter)] call EFUNC(common,addSyncedEventHandler);
|
@ -21,7 +21,6 @@ PREP(adjustPainLevel);
|
||||
PREP(canAccessMedicalEquipment);
|
||||
PREP(canTreat);
|
||||
PREP(canTreatCached);
|
||||
PREP(createLitter);
|
||||
PREP(determineIfFatal);
|
||||
PREP(getBloodLoss);
|
||||
PREP(getBloodPressure);
|
||||
@ -98,6 +97,10 @@ PREP(moduleTreatmentConfiguration);
|
||||
PREP(copyDeadBody);
|
||||
PREP(requestWoundSync);
|
||||
|
||||
// Networked litter
|
||||
PREP(createLitter);
|
||||
PREP(handleCreateLitter);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
GVAR(IVBags) = [];
|
||||
|
||||
|
@ -37,21 +37,19 @@ if !(isArray (_config >> "litter")) exitwith {};
|
||||
_litter = getArray (_config >> "litter");
|
||||
|
||||
_createLitter = {
|
||||
private["_position", "_litterClass", "_direction"];
|
||||
_position = getPos (_this select 0);
|
||||
_litterClass = _this select 1;
|
||||
_litterObject = createVehicle [_litterClass, _position, [], 0, "NONE"];
|
||||
if (random(1) >= 0.5) then {
|
||||
_litterObject setPos [(_position select 0) + random 2, (_position select 1) + random 2, _position select 2];
|
||||
_position = [(_position select 0) + random 2, (_position select 1) + random 2, _position select 2];
|
||||
} else {
|
||||
_litterObject setPos [(_position select 0) - random 2, (_position select 1) - random 2, _position select 2];
|
||||
_position = [(_position select 0) - random 2, (_position select 1) - random 2, _position select 2];
|
||||
};
|
||||
_litterObject setDir (random 360);
|
||||
_litterObject;
|
||||
};
|
||||
|
||||
if (isnil QGVAR(allCreatedLitter)) then {
|
||||
GVAR(allCreatedLitter) = [];
|
||||
GVAR(litterPFHRunning) = false;
|
||||
_direction = (random 360);
|
||||
|
||||
[QGVAR(createLitter), [_litterClass,_position,_direction], 0] call EFUNC(common,syncedEvent);
|
||||
|
||||
true
|
||||
};
|
||||
|
||||
_createdLitter = [];
|
||||
@ -75,37 +73,13 @@ _createdLitter = [];
|
||||
// Loop through through the litter options and place the litter
|
||||
{
|
||||
if (typeName _x == "ARRAY" && {(count _x > 0)}) then {
|
||||
_createdLitter pushback ([_target, _x select (floor(random(count _x)))] call _createLitter);
|
||||
[_target, _x select (floor(random(count _x)))] call _createLitter;
|
||||
};
|
||||
if (typeName _x == "STRING") then {
|
||||
_createdLitter pushback ([_target, _x] call _createLitter);
|
||||
[_target, _x] call _createLitter;
|
||||
};
|
||||
}foreach _litterOptions;
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _litter;
|
||||
|
||||
if (GVAR(litterCleanUpDelay) >= 0) then {
|
||||
GVAR(allCreatedLitter) pushback [time, GVAR(litterCleanUpDelay), _createdLitter];
|
||||
};
|
||||
|
||||
if !(GVAR(litterPFHRunning)) then {
|
||||
GVAR(litterPFHRunning) = true;
|
||||
[{
|
||||
{
|
||||
if (time - (_x select 0) >= (_x select 1)) then {
|
||||
{
|
||||
deleteVehicle _x;
|
||||
}foreach (_this select 2);
|
||||
GVAR(allCreatedLitter) set[_foreachIndex, objNull];
|
||||
};
|
||||
}foreach GVAR(allCreatedLitter);
|
||||
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
||||
|
||||
if (count GVAR(allCreatedLitter) == 0) exitwith {
|
||||
GVAR(litterPFHRunning) = false;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 30, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
}foreach _litter;
|
23
addons/medical/functions/fnc_handleCreateLitter.sqf
Normal file
23
addons/medical/functions/fnc_handleCreateLitter.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
#include "script_component.hpp"
|
||||
PARAMS_3(_litterClass,_position,_direction);
|
||||
private["_litterObject"];
|
||||
|
||||
|
||||
|
||||
if (isnil QGVAR(allCreatedLitter)) then {
|
||||
GVAR(allCreatedLitter) = [];
|
||||
GVAR(litterPFHRunning) = false;
|
||||
};
|
||||
|
||||
if((count GVAR(allCreatedLitter)) <= GVAR(litterSimulationDetail) )then {
|
||||
_litterObject = createVehicleLocal [_litterClass, _position, [], 0, "NONE"];
|
||||
_litterObject setDir _direction;
|
||||
} else {
|
||||
// @TODO: We hit max litter items, remove a few of them to work with what we have.
|
||||
// Basically, we should just start FIFO'ing these
|
||||
};
|
||||
|
||||
GVAR(allCreatedLitter) pushBack _litterObject;
|
||||
//GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
||||
|
||||
true
|
Loading…
Reference in New Issue
Block a user