mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into medical-advanced
This commit is contained in:
commit
4ff849c2fd
@ -13,7 +13,9 @@ if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
private "_draggedObject";
|
||||
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
if (!isNull _draggedObject) then {
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
@ -25,7 +27,9 @@ if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||
private "_carriedObject";
|
||||
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
if (!isNull _carriedObject) then {
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -48,8 +48,8 @@ if (_type in _initializedClasses) exitWith {};
|
||||
_initializedClasses pushBack _type;
|
||||
GVAR(initializedClasses_carry) = _initializedClasses;
|
||||
|
||||
_carryAction = [QGVAR(drag), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
||||
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
||||
_carryAction = [QGVAR(carry), localize "STR_ACE_Dragging_Carry", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
||||
_dropAction = [QGVAR(drop_carry), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
||||
|
||||
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
||||
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
|
@ -52,4 +52,4 @@ _dragAction = [QGVAR(drag), localize "STR_ACE_Dragging_Drag", "", {[_player, _ta
|
||||
_dropAction = [QGVAR(drop), localize "STR_ACE_Dragging_Drop", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction);
|
||||
|
||||
[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
|
||||
[_type, 0, ["ACE_MainActions"], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
|
@ -40,4 +40,7 @@ _unit selectWeapon primaryWeapon _unit;
|
||||
// can't play action that depends on weapon if it was added the same frame
|
||||
[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame);
|
||||
|
||||
// prevents draging and carrying at the same time
|
||||
_unit setVariable [QGVAR(isDragging), true, true];
|
||||
|
||||
[FUNC(startDragPFH), 0.2, [_unit, _target, time + 5]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -10,6 +10,17 @@ _timeOut = _this select 0 select 2;
|
||||
// timeout. Do nothing. Quit. time, because anim length is linked to ingame time.
|
||||
if (time > _timeOut) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
// drop if in timeout
|
||||
private "_draggedObject";
|
||||
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
if (!isNull _draggedObject) exitWith {
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
// re-enable everything
|
||||
_unit setVariable [QGVAR(isDragging), false, true];
|
||||
};
|
||||
|
||||
// unit is ready to start dragging
|
||||
|
@ -6,8 +6,10 @@ class CfgVehicles {
|
||||
class ArgumentsBaseUnits {
|
||||
};
|
||||
};
|
||||
class ACE_Module;
|
||||
|
||||
// TODO localization for all the modules
|
||||
class ACE_moduleMedicalSettings: Module_F {
|
||||
class ACE_moduleMedicalSettings: ACE_Module {
|
||||
scope = 2;
|
||||
displayName = "Medical Settings [ACE]";
|
||||
icon = QUOTE(PATHTOF(ui\moduleIcon.paa));
|
||||
@ -129,7 +131,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_moduleTreatmentConfiguration: Module_F {
|
||||
class ACE_moduleTreatmentConfiguration: ACE_Module {
|
||||
scope = 2;
|
||||
displayName = "Treatment Configuration [ACE]";
|
||||
icon = QUOTE(PATHTOF(ui\moduleIcon.paa));
|
||||
|
@ -218,19 +218,21 @@ if (isNil QGVAR(level)) then {
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// broadcast injuries to JIP clients in a MP session
|
||||
if (isMultiplayer and GVAR(level) >= 2) then {
|
||||
if (isMultiplayer) then {
|
||||
[QGVAR(onPlayerConnected), "onPlayerConnected", {
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
};
|
||||
if (GVAR(level) >= 2) then {
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
};
|
||||
|
||||
{
|
||||
_unit = _x;
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
{
|
||||
["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
}foreach GVAR(InjuredCollection);
|
||||
_unit = _x;
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
{
|
||||
["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
}foreach GVAR(InjuredCollection);
|
||||
};
|
||||
}, []] call BIS_fnc_addStackedEventHandler;
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@ class CfgPatches {
|
||||
units[] = {"ACE_medicalSupplyCrate", "ACE_fieldDressingItem", "ACE_packingBandageItem", "ACE_elasticBandageItem", "ACE_tourniquetItem", "ACE_morphineItem", "ACE_atropineItem", "ACE_epinephrineItem", "ACE_plasmaIVItem", "ACE_bloodIVItem", "ACE_salineIVItem", "ACE_quikclotItem", "ACE_personalAidKitItem", "ACE_surgicalKitItem", "ACE_bodyBagItem"};
|
||||
weapons[] = {"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_tourniquet", "ACE_morphine", "ACE_atropine", "ACE_epinephrine", "ACE_plasmaIV", "ACE_plasmaIV_500", "ACE_plasmaIV_250", "ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250", "ACE_salineIV", "ACE_salineIV_500", "ACE_salineIV_250", "ACE_quikclot", "ACE_personalAidKit", "ACE_surgicalKit", "ACE_bodyBag"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {ace_common, ace_interaction};
|
||||
requiredAddons[] = {ace_common, ace_interaction, ace_modules};
|
||||
author[] = {"Glowbal", "KoffienFlummi"};
|
||||
authorUrl = "";
|
||||
VERSION_CONFIG;
|
||||
|
1
addons/modules/$PBOPREFIX$
Normal file
1
addons/modules/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\modules
|
13
addons/modules/CfgEventHandlers.hpp
Normal file
13
addons/modules/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class _ACE_modules { // using a _ so it is the first postInit to be executed
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
44
addons/modules/XEH_postInit.sqf
Normal file
44
addons/modules/XEH_postInit.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
// TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it.
|
||||
// We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution.
|
||||
{
|
||||
[_x] call {
|
||||
private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"];
|
||||
_logic = _this select 0;
|
||||
_logicType = typeof _logic;
|
||||
_logic hideobject true;
|
||||
|
||||
if (_logic getvariable [QGVAR(initalized), false]) exitwith {};
|
||||
_config = (configFile >> "CfgVehicles" >> _logicType);
|
||||
if !(isClass _config) exitwith {};
|
||||
|
||||
// isGlobal = 1;
|
||||
_isGlobal = getNumber (_config >> "isGlobal") > 0;
|
||||
_isDisposable = getNumber (_config >> "isDisposable") > 0;
|
||||
_isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1;
|
||||
_function = getText (_config >> "function");
|
||||
if (isnil _function) then {
|
||||
_function = compile _function;
|
||||
} else {
|
||||
_function = missionNamespace getvariable _function;
|
||||
};
|
||||
|
||||
if (_isGlobal) then {
|
||||
[_logic, [], true] call _function;
|
||||
} else {
|
||||
if (isServer) then {
|
||||
[_logic, [], true] call _function;
|
||||
};
|
||||
};
|
||||
|
||||
if !(_isPersistent) then {
|
||||
_logic setvariable [QGVAR(initalized), true];
|
||||
};
|
||||
|
||||
if (_isDisposable) then {
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
};
|
||||
}foreach GVAR(moduleInitCollection);
|
8
addons/modules/XEH_preInit.sqf
Normal file
8
addons/modules/XEH_preInit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(moduleInit);
|
||||
GVAR(moduleInitCollection) = [];
|
||||
|
||||
ADDON = true;
|
28
addons/modules/config.cpp
Normal file
28
addons/modules/config.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"Glowbal"};
|
||||
authorUrl = "";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
class CfgVehicles {
|
||||
class Logic;
|
||||
class Module_F: Logic {
|
||||
class ArgumentsBaseUnits {
|
||||
};
|
||||
};
|
||||
class ACE_Module: Module_F {
|
||||
class EventHandlers {
|
||||
init = QUOTE(_this call DFUNC(moduleInit));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
19
addons/modules/functions/fnc_moduleInit.sqf
Normal file
19
addons/modules/functions/fnc_moduleInit.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* IV Treatment local callback
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The logic object <OBJECT>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* nil
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if ((_this select 0) isKindOf "Module_F") then {
|
||||
GVAR(moduleInitCollection) pushback (_this select 0);
|
||||
};
|
1
addons/modules/functions/script_component.hpp
Normal file
1
addons/modules/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\modules\script_component.hpp"
|
12
addons/modules/script_component.hpp
Normal file
12
addons/modules/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT modules
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_MODULES
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_MODULES
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_MODULES
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Loading…
Reference in New Issue
Block a user