mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #4197 from acemod/litterSimpleObject
Use createSimpleObject for medical litter
This commit is contained in:
@ -159,8 +159,6 @@ class ACE_Settings {
|
|||||||
value = 3;
|
value = 3;
|
||||||
values[] = {"Off", "Low", "Medium", "High", "Ultra"};
|
values[] = {"Off", "Low", "Medium", "High", "Ultra"};
|
||||||
_values[] = { 0, 50, 100, 1000, 5000 };
|
_values[] = { 0, 50, 100, 1000, 5000 };
|
||||||
|
|
||||||
isClientSettable = 1;
|
|
||||||
};
|
};
|
||||||
class GVAR(litterCleanUpDelay) {
|
class GVAR(litterCleanUpDelay) {
|
||||||
category = CSTRING(Category_Medical);
|
category = CSTRING(Category_Medical);
|
||||||
|
@ -27,8 +27,11 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"];
|
|||||||
[QGVAR(treatmentTourniquetLocal), DFUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler;
|
[QGVAR(treatmentTourniquetLocal), DFUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler;
|
[QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
//Handle Deleting Bodies on Server:
|
//Handle Deleting Bodies and creating litter on Server:
|
||||||
if (isServer) then {["ace_placedInBodyBag", FUNC(serverRemoveBody)] call CBA_fnc_addEventHandler;};
|
if (isServer) then {
|
||||||
|
["ace_placedInBodyBag", FUNC(serverRemoveBody)] call CBA_fnc_addEventHandler;
|
||||||
|
[QGVAR(createLitterServer), FUNC(handleCreateLitter)] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
|
||||||
["ace_unconscious", {
|
["ace_unconscious", {
|
||||||
params ["_unit", "_status"];
|
params ["_unit", "_status"];
|
||||||
@ -267,9 +270,6 @@ GVAR(lastHeartBeatSound) = CBA_missionTime;
|
|||||||
};
|
};
|
||||||
|
|
||||||
["ace_settingsInitialized", {
|
["ace_settingsInitialized", {
|
||||||
// Networked litter (need to wait for GVAR(litterCleanUpDelay) to be set)
|
|
||||||
[QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler);
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{(((_this select 0) getVariable [QGVAR(bloodVolume), 100]) < 65)},
|
{(((_this select 0) getVariable [QGVAR(bloodVolume), 100]) < 65)},
|
||||||
{(((_this select 0) getVariable [QGVAR(pain), 0]) - ((_this select 0) getVariable [QGVAR(painSuppress), 0])) > 0.9},
|
{(((_this select 0) getVariable [QGVAR(pain), 0]) - ((_this select 0) getVariable [QGVAR(painSuppress), 0])) > 0.9},
|
||||||
|
@ -22,21 +22,22 @@
|
|||||||
#define MIN_ENTRIES_LITTER_CONFIG 3
|
#define MIN_ENTRIES_LITTER_CONFIG 3
|
||||||
|
|
||||||
params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_bloodLossOnSelection"];
|
params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_bloodLossOnSelection"];
|
||||||
|
TRACE_6("params",_caller,_target,_selectionName,_className,_usersOfItems,_bloodLossOnSelection);
|
||||||
|
|
||||||
//Ensures comptibilty with other possible medical treatment configs
|
//Ensures comptibilty with other possible medical treatment configs
|
||||||
private _previousDamage = _bloodLossOnSelection;
|
private _previousDamage = _bloodLossOnSelection;
|
||||||
|
|
||||||
if !(GVAR(allowLitterCreation)) exitwith {};
|
if !(GVAR(allowLitterCreation)) exitwith {};
|
||||||
if (vehicle _caller != _caller || vehicle _target != _target) exitwith {};
|
if (vehicle _caller != _caller || {vehicle _target != _target}) exitwith {};
|
||||||
|
|
||||||
private _config = if (GVAR(level) >= 2) then {
|
private _config = if (GVAR(level) >= 2) then {
|
||||||
(configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
|
(configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
|
||||||
} else {
|
} else {
|
||||||
(configFile >> "ACE_Medical_Actions" >> "Basic" >> _className)
|
(configFile >> "ACE_Medical_Actions" >> "Basic" >> _className)
|
||||||
};
|
};
|
||||||
if !(isClass _config) exitwith {false};
|
if !(isClass _config) exitwith {TRACE_1("No action config", _className);};
|
||||||
|
|
||||||
if !(isArray (_config >> "litter")) exitwith {};
|
if !(isArray (_config >> "litter")) exitwith {TRACE_1("No litter config", _className);};
|
||||||
private _litter = getArray (_config >> "litter");
|
private _litter = getArray (_config >> "litter");
|
||||||
|
|
||||||
private _createLitter = {
|
private _createLitter = {
|
||||||
@ -53,7 +54,8 @@ private _createLitter = {
|
|||||||
|
|
||||||
// Create the litter, and timeout the event based on the cleanup delay
|
// Create the litter, and timeout the event based on the cleanup delay
|
||||||
// The cleanup delay for events in MP is handled by the server side
|
// The cleanup delay for events in MP is handled by the server side
|
||||||
[QGVAR(createLitter), [_litterClass, _position, _direction], 0] call EFUNC(common,syncedEvent);
|
TRACE_3("Creating Litter on server",_litterClass,_position,_direction);
|
||||||
|
[QGVAR(createLitterServer), [_litterClass, _position, _direction]] call CBA_fnc_serverEvent;
|
||||||
|
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
@ -14,10 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if(!hasInterface) exitWith { false };
|
|
||||||
|
|
||||||
params ["_litterClass", "_position", "_direction"];
|
params ["_litterClass", "_position", "_direction"];
|
||||||
private["_litterObject", "_maxLitterCount"];
|
TRACE_3("params",_litterClass,_position,_direction);
|
||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING(_values);
|
//IGNORE_PRIVATE_WARNING(_values);
|
||||||
|
|
||||||
if (isNil QGVAR(allCreatedLitter)) then {
|
if (isNil QGVAR(allCreatedLitter)) then {
|
||||||
@ -25,17 +24,22 @@ if (isNil QGVAR(allCreatedLitter)) then {
|
|||||||
GVAR(litterPFHRunning) = false;
|
GVAR(litterPFHRunning) = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
_litterObject = _litterClass createVehicleLocal _position;
|
private _p3dFile = getText (configFile >> "CfgVehicles" >> _litterClass >> "model");
|
||||||
|
if (_p3dFile == "") exitWith {TRACE_2("no model",_litterClass,_p3dFile)};
|
||||||
|
// createSimpleObject expects a path without the leading slash
|
||||||
|
if ((_p3dFile select [0,1]) == "\") then {_p3dFile = _p3dFile select [1];};
|
||||||
|
|
||||||
|
private _litterObject = createSimpleObject [_p3dFile, [0,0,0]];
|
||||||
|
TRACE_2("created",_litterClass,_litterObject);
|
||||||
_litterObject setDir _direction;
|
_litterObject setDir _direction;
|
||||||
_litterObject setPosATL _position;
|
_litterObject setPosATL _position;
|
||||||
// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112
|
// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112
|
||||||
[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call CBA_fnc_execNextFrame;
|
[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call CBA_fnc_execNextFrame;
|
||||||
|
|
||||||
_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
|
private _maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
|
||||||
if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then {
|
if ((count GVAR(allCreatedLitter)) > _maxLitterCount) then {
|
||||||
// gank the first litter object, and spawn ours.
|
// gank the first litter object, and spawn ours.
|
||||||
private["_oldLitter"];
|
private _oldLitter = GVAR(allCreatedLitter) deleteAt 0;
|
||||||
_oldLitter = GVAR(allCreatedLitter) deleteAt 0;
|
|
||||||
{
|
{
|
||||||
deleteVehicle _x;
|
deleteVehicle _x;
|
||||||
} forEach (_oldLitter select 1);
|
} forEach (_oldLitter select 1);
|
||||||
|
@ -15,17 +15,18 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
_x params ["_time", "_objects"];
|
_x params ["_time", "_objects"];
|
||||||
if (CBA_missionTime - _time >= GVAR(litterCleanUpDelay)) then {
|
//Older elements are always at the begining of the array:
|
||||||
{
|
if ((CBA_missionTime - _time) < GVAR(litterCleanUpDelay)) exitWith {};
|
||||||
deleteVehicle _x;
|
TRACE_2("deleting",_time,_objects);
|
||||||
} forEach _objects;
|
{
|
||||||
GVAR(allCreatedLitter) set[_forEachIndex, objNull];
|
deleteVehicle _x;
|
||||||
};
|
} forEach _objects;
|
||||||
|
GVAR(allCreatedLitter) set [_forEachIndex, objNull];
|
||||||
} forEach GVAR(allCreatedLitter);
|
} forEach GVAR(allCreatedLitter);
|
||||||
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull];
|
||||||
|
|
||||||
// If no more litter remaining, exit the loop
|
// If no more litter remaining, exit the loop
|
||||||
if ( (count GVAR(allCreatedLitter)) == 0) exitWith {
|
if (GVAR(allCreatedLitter) isEqualTo []) exitWith {
|
||||||
GVAR(litterPFHRunning) = false;
|
GVAR(litterPFHRunning) = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user