forge/arma/server/addons/task/functions/objects/fnc_DefenseEnemyController.sqf
Jacob Schmidt 788ac6da7a Throttle mission generation and quiet status logs
- Add a mission generation cooldown in the mission manager
- Suppress noisy task status extension logs
- Switch task and entity class hashes to merged base copies
2026-05-21 21:56:50 -05:00

53 lines
1.6 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Object-style defense enemy controller.
*/
#pragma hemtt ignore_variables ["_self"]
GVAR(DefenseEnemyController) = +GVAR(EntityControllerBaseClass);
GVAR(DefenseEnemyController) merge [createHashMapFromArray [
["#type", "DefenseEnemyController"],
["#create", compileFinal {
params [
["_taskID", "", [""]],
["_entity", objNull, [objNull]],
["_controllerParams", createHashMap, [createHashMap]]
];
_self call ["initializeControllerState", [_taskID, _entity, "defense_enemy", _controllerParams]];
_self set ["defenseZone", _controllerParams getOrDefault ["defenseZone", ""]];
_self call ["registerInstance", []];
}],
["#delete", compileFinal {
_self call ["unregisterInstance", []];
}],
["applyInitialState", compileFinal {
private _entity = _self getOrDefault ["entity", objNull];
if (isNull _entity || { !alive _entity }) exitWith { false };
_self call ["assignTaskVariable", []];
_entity setBehaviour "AWARE";
_entity setSpeedMode "NORMAL";
_entity enableDynamicSimulation true;
true
}],
["runLoop", compileFinal {
if !(_self call ["applyInitialState", []]) exitWith {
_self call ["markAborted", []];
_self call ["cleanup", []];
false
};
_self call ["markActive", []];
waitUntil {
sleep 1;
!(_self call ["isEntityUsable", []])
};
_self call ["markFinished", []];
_self call ["cleanup", []];
true
}]
], true];