Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4d1f251c4 | ||
|
|
623f690a82 | ||
|
|
1e2402c332 | ||
|
|
9c2a09eed9 | ||
|
|
1454a29de9 | ||
|
|
bda6359e7c | ||
|
|
582dd39640 | ||
|
|
89e3f794dc | ||
|
|
c0dd782103 | ||
|
|
f2ac9fcbe7 | ||
|
|
5a48cbfa4a | ||
|
|
2cdf4db591 | ||
|
|
a6dbf9623a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,5 +34,6 @@ Thumbs.db
|
||||
|
||||
# Arma
|
||||
arma/ui/map-viewer/
|
||||
arma/mod/.hemttout/
|
||||
arma/server/surrealdb/forge.db/
|
||||
promo/
|
||||
|
||||
@ -24,6 +24,7 @@ connect_timeout_ms = 5000
|
||||
|
||||
```text
|
||||
arma/
|
||||
mod/ Shared client/server config addon built as @forge_mod
|
||||
client/ Client-side addons and browser UIs
|
||||
server/ Server-side addons and extension crate
|
||||
bin/
|
||||
@ -44,13 +45,16 @@ npm run build:webui
|
||||
.\build-arma.ps1
|
||||
```
|
||||
|
||||
`.\build-arma.ps1` builds `arma/mod`, `arma/client`, and `arma/server`. Load
|
||||
the resulting `@forge_mod` on both clients and servers, `@forge_client` on
|
||||
clients, and `@forge_server` on the server only.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Framework Documentation](./docs/README.md)
|
||||
- [Framework Architecture](./docs/FRAMEWORK_ARCHITECTURE.md)
|
||||
- [Module Reference](./docs/MODULE_REFERENCE.md)
|
||||
- [Development Guide](./docs/DEVELOPMENT_GUIDE.md)
|
||||
- [Git Workflow](./docs/GIT_WORKFLOW.md)
|
||||
|
||||
## Extension Status
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ player addEventHandler ["Respawn", {
|
||||
[SRPC(economy,onRespawn), [_unit, _corpse, _uid]] call CFUNC(serverEvent);
|
||||
}];
|
||||
|
||||
if (isNil QGVAR(ActorRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(ActorRepository)) then { call FUNC(initRepository); true };
|
||||
|
||||
GVAR(resetMedicalSpectator) = {
|
||||
player switchMove "";
|
||||
|
||||
@ -37,6 +37,10 @@ switch (_event) do {
|
||||
case "actor::open::bank": { [] spawn EFUNC(bank,openUI); };
|
||||
case "actor::open::cad": { [] spawn EFUNC(cad,openUI); };
|
||||
case "actor::open::device": { hint "Device interaction is not yet implemented."; };
|
||||
case "actor::open::missionSetup": {
|
||||
diag_log "[FORGE:Client:Actor] Requesting framework mission setup UI.";
|
||||
[SRPC(task,requestOpenMissionSetup), [player]] call CFUNC(serverEvent);
|
||||
};
|
||||
case "actor::open::garage": {
|
||||
private _garageObject = objNull;
|
||||
if (_data isEqualType createHashMap) then {
|
||||
@ -58,6 +62,37 @@ switch (_event) do {
|
||||
case "actor::open::phone": { [] spawn EFUNC(phone,openUI); };
|
||||
case "actor::open::iplayer": { hint "Player interaction is not yet implemented." };
|
||||
case "actor::open::store": { [] spawn EFUNC(store,openUI); };
|
||||
case "actor::request::transport": {
|
||||
if !(_data isEqualType createHashMap) exitWith {
|
||||
hint "Invalid transport request.";
|
||||
};
|
||||
|
||||
private _destination = _data getOrDefault ["destination", createHashMap];
|
||||
if !(_destination isEqualType createHashMap) exitWith {
|
||||
hint "Invalid transport destination.";
|
||||
};
|
||||
|
||||
private _fromNode = objectFromNetId (_data getOrDefault ["netId", ""]);
|
||||
private _toNode = objectFromNetId (_destination getOrDefault ["netId", ""]);
|
||||
|
||||
if (isNull _fromNode || { isNull _toNode }) exitWith {
|
||||
hint "Transport destination is no longer available.";
|
||||
};
|
||||
|
||||
private _options = createHashMapFromArray [
|
||||
["label", _data getOrDefault ["label", "Transport"]],
|
||||
["nodePrefix", _data getOrDefault ["nodePrefix", "transport"]],
|
||||
["vehiclePrefix", _data getOrDefault ["vehiclePrefix", "transport_vehicle"]],
|
||||
["arrivalPrefix", _data getOrDefault ["arrivalPrefix", "transport_arrival"]],
|
||||
["maxIndexedNodes", _data getOrDefault ["maxIndexedNodes", 10]],
|
||||
["baseFare", _data getOrDefault ["baseFare", 100]],
|
||||
["pricePerKm", _data getOrDefault ["pricePerKm", 50]],
|
||||
["cargoRadius", _data getOrDefault ["cargoRadius", 25]],
|
||||
["includeCargo", _data getOrDefault ["includeCargo", true]]
|
||||
];
|
||||
|
||||
[SRPC(transport,requestTransport), [player, _fromNode, _toNode, _options]] call CFUNC(serverEvent);
|
||||
};
|
||||
default { hint format ["Unhandled UI event: %1", _event]; };
|
||||
};
|
||||
|
||||
|
||||
@ -107,6 +107,10 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
["getNearbyActions", compileFinal {
|
||||
params [["_control", controlNull, [controlNull]]];
|
||||
private _nearbyActions = [];
|
||||
if !(GETMVAR(forge_server_task_missionSetup_settingsApplied,false)) then {
|
||||
_nearbyActions pushBack ["missionSetup", true];
|
||||
};
|
||||
|
||||
{
|
||||
private _isAtm = _x getVariable ["isAtm", false];
|
||||
private _isBank = _x getVariable ["isBank", false];
|
||||
@ -121,6 +125,12 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
];
|
||||
private _deviceType = _x getVariable ["deviceType", ""];
|
||||
private _isPlayer = _x isKindOf "Man" && isPlayer _x;
|
||||
private _objectName = vehicleVarName _x;
|
||||
private _transportPrefix = _x getVariable ["transportNodePrefix", "transport"];
|
||||
private _isTransport = _x getVariable ["isTransport", false];
|
||||
if (!_isTransport && { _objectName isNotEqualTo "" }) then {
|
||||
_isTransport = _objectName isEqualTo _transportPrefix || { (_objectName find format ["%1_", _transportPrefix]) == 0 };
|
||||
};
|
||||
|
||||
if (_isStore) then { _nearbyActions pushBack ["store", true]; };
|
||||
if (_isAtm) then { _nearbyActions pushBack ["atm", true]; };
|
||||
@ -129,6 +139,55 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
if (_isGarage) then { _nearbyActions pushBack ["garage", _garageContext]; };
|
||||
if (_isGarage && GVAR(enableVG)) then { _nearbyActions pushBack ["vg", _garageContext]; };
|
||||
if (_deviceType isNotEqualTo "") then { _nearbyActions pushBack ["device", _deviceType]; };
|
||||
if (_isTransport) then {
|
||||
private _fromTransportNode = _x;
|
||||
private _maxIndexedNodes = _x getVariable ["transportMaxIndexedNodes", 10];
|
||||
private _baseFare = _x getVariable ["transportBaseFare", 100];
|
||||
private _pricePerKm = _x getVariable ["transportPricePerKm", 50];
|
||||
private _vehiclePrefix = _x getVariable ["transportVehiclePrefix", format ["%1_vehicle", _transportPrefix]];
|
||||
private _arrivalPrefix = _x getVariable ["transportArrivalPrefix", format ["%1_arrival", _transportPrefix]];
|
||||
private _nodeNames = [_transportPrefix];
|
||||
|
||||
for "_i" from 1 to _maxIndexedNodes do {
|
||||
_nodeNames pushBack format ["%1_%2", _transportPrefix, _i];
|
||||
};
|
||||
|
||||
private _destinations = [];
|
||||
{
|
||||
private _node = missionNamespace getVariable [_x, objNull];
|
||||
if (!isNull _node && { _node isNotEqualTo _fromTransportNode }) then {
|
||||
private _nodeLabel = _node getVariable ["transportLabel", vehicleVarName _node];
|
||||
if (_nodeLabel isEqualTo "") then { _nodeLabel = "Transport Point"; };
|
||||
|
||||
private _distanceMeters = _fromTransportNode distance2D _node;
|
||||
private _cost = round (_baseFare + ((_distanceMeters / 1000) * _pricePerKm));
|
||||
_destinations pushBack createHashMapFromArray [
|
||||
["netId", netId _node],
|
||||
["name", vehicleVarName _node],
|
||||
["label", _nodeLabel],
|
||||
["cost", _cost]
|
||||
];
|
||||
};
|
||||
} forEach _nodeNames;
|
||||
|
||||
if (_destinations isNotEqualTo []) then {
|
||||
private _transportContext = createHashMapFromArray [
|
||||
["netId", netId _x],
|
||||
["name", _objectName],
|
||||
["label", _x getVariable ["transportLabel", "Transport"]],
|
||||
["nodePrefix", _transportPrefix],
|
||||
["vehiclePrefix", _vehiclePrefix],
|
||||
["arrivalPrefix", _arrivalPrefix],
|
||||
["maxIndexedNodes", _maxIndexedNodes],
|
||||
["baseFare", _baseFare],
|
||||
["pricePerKm", _pricePerKm],
|
||||
["cargoRadius", _x getVariable ["transportCargoRadius", 25]],
|
||||
["includeCargo", _x getVariable ["transportIncludeCargo", true]],
|
||||
["destinations", _destinations]
|
||||
];
|
||||
_nearbyActions pushBack ["transport", _transportContext];
|
||||
};
|
||||
};
|
||||
if (_isPlayer && { _x isNotEqualTo player }) then { _nearbyActions pushBack ["player", name _x]; };
|
||||
} forEach (player nearObjects 5);
|
||||
|
||||
|
||||
@ -151,6 +151,12 @@ const actionDefinitions = {
|
||||
description: "View and manage your organization data",
|
||||
action: "actor::open::org",
|
||||
},
|
||||
missionSetup: {
|
||||
id: "missionSetup",
|
||||
title: "Mission Setup",
|
||||
description: "Open framework mission setup",
|
||||
action: "actor::open::missionSetup",
|
||||
},
|
||||
store: {
|
||||
id: "store",
|
||||
title: "Store",
|
||||
@ -193,12 +199,19 @@ const actionDefinitions = {
|
||||
description: "Access your virtual garage",
|
||||
action: "actor::open::vgarage",
|
||||
},
|
||||
transport: {
|
||||
id: "transport",
|
||||
title: "Transport",
|
||||
description: "Show available travel destinations",
|
||||
action: "actor::show::transport",
|
||||
},
|
||||
};
|
||||
|
||||
const initialState = {
|
||||
availableActions: [],
|
||||
menuItems: [...baseMenuItems],
|
||||
baseMenuItems: [...baseMenuItems],
|
||||
defaultMenuItems: [...baseMenuItems],
|
||||
actionDefinitions: { ...actionDefinitions },
|
||||
};
|
||||
|
||||
@ -244,6 +257,7 @@ function actorReducer(state = initialState, action) {
|
||||
...state,
|
||||
availableActions: action.payload,
|
||||
menuItems: newMenuItems,
|
||||
defaultMenuItems: newMenuItems,
|
||||
};
|
||||
|
||||
case ActionTypes.SET_MENU_ITEMS:
|
||||
@ -426,6 +440,43 @@ function RadialMenu() {
|
||||
|
||||
const handleItemClick = (item) => {
|
||||
console.log("Menu item clicked:", item);
|
||||
if (item.action === "actor::show::default") {
|
||||
store.dispatch(
|
||||
actions.setMenuItems(state.defaultMenuItems || state.baseMenuItems),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.action === "actor::show::transport") {
|
||||
const context = item.context || {};
|
||||
const destinations = Array.isArray(context.destinations)
|
||||
? context.destinations
|
||||
: [];
|
||||
const transportItems = [
|
||||
{
|
||||
id: "transport-back",
|
||||
title: "Back",
|
||||
description: "Return to the default interaction menu",
|
||||
action: "actor::show::default",
|
||||
},
|
||||
...destinations.map((destination, index) => ({
|
||||
id: `transport-destination-${index}`,
|
||||
title: destination.cost
|
||||
? `${destination.label || destination.name || "Destination"} - $${destination.cost}`
|
||||
: destination.label || destination.name || "Destination",
|
||||
description: "Request transport to this destination",
|
||||
action: "actor::request::transport",
|
||||
context: {
|
||||
...context,
|
||||
destination,
|
||||
},
|
||||
})),
|
||||
];
|
||||
|
||||
store.dispatch(actions.setMenuItems(transportItems));
|
||||
return;
|
||||
}
|
||||
|
||||
const alert = {
|
||||
event: item.action,
|
||||
data: item.context || {},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(BankRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(BankUIBridge)) then { call FUNC(initUIBridge); };
|
||||
if (isNil QGVAR(BankRepository)) then { call FUNC(initRepository); true };
|
||||
if (isNil QGVAR(BankUIBridge)) then { call FUNC(initUIBridge); true };
|
||||
|
||||
GVAR(sendPhoneBankEvent) = {
|
||||
params [["_functionName", "", [""]], ["_arguments", [], [[]]]];
|
||||
|
||||
@ -23,11 +23,14 @@
|
||||
private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
|
||||
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
|
||||
|
||||
GVAR(BankUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#base", _webUIBridgeDeclaration],
|
||||
GVAR(BankUIBridgeBaseClass) = compileFinal ([
|
||||
_webUIBridgeDeclaration,
|
||||
createHashMapFromArray [
|
||||
["#type", "BankUIBridgeBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["screen", createHashMapObject [EGVAR(common,WebUIScreenDeclaration), []]];
|
||||
_self set ["mode", "bank"];
|
||||
true
|
||||
}],
|
||||
["getActiveBrowserControl", compileFinal {
|
||||
private _display = uiNamespace getVariable ["RscBank", displayNull];
|
||||
@ -166,7 +169,13 @@ GVAR(BankUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
_self set ["mode", _finalMode];
|
||||
_finalMode
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(BankUIBridge) = createHashMapObject [GVAR(BankUIBridgeBaseClass)];
|
||||
GVAR(BankUIBridge)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(BankUIBridge) = createHashMapObject [GVAR(BankUIBridgeBaseClass), []];
|
||||
true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(CADRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(CADUIBridge)) then { call FUNC(initUIBridge); };
|
||||
if (isNil QGVAR(CADRepository)) then { call FUNC(initRepository); true };
|
||||
if (isNil QGVAR(CADUIBridge)) then { call FUNC(initUIBridge); true };
|
||||
|
||||
[QGVAR(openCAD), {
|
||||
call FUNC(openUI);
|
||||
|
||||
@ -30,6 +30,7 @@ GVAR(CADRepository) = createHashMapObject [[
|
||||
_self set ["requests", []];
|
||||
_self set ["assignments", []];
|
||||
_self set ["activity", []];
|
||||
_self set ["generatedTaskTypes", []];
|
||||
_self set ["session", createHashMap];
|
||||
_self set ["mode", "operations"];
|
||||
_self set ["dispatchView", "board"];
|
||||
@ -41,6 +42,7 @@ GVAR(CADRepository) = createHashMapObject [[
|
||||
["requests", +(_self getOrDefault ["requests", []])],
|
||||
["assignments", +(_self getOrDefault ["assignments", []])],
|
||||
["activity", +(_self getOrDefault ["activity", []])],
|
||||
["generatedTaskTypes", +(_self getOrDefault ["generatedTaskTypes", []])],
|
||||
["session", +(_self getOrDefault ["session", createHashMap])],
|
||||
["mode", _self getOrDefault ["mode", "operations"]],
|
||||
["dispatchView", _self getOrDefault ["dispatchView", "board"]]
|
||||
@ -72,6 +74,7 @@ GVAR(CADRepository) = createHashMapObject [[
|
||||
_self set ["requests", +(_payload getOrDefault ["requests", []])];
|
||||
_self set ["assignments", +(_payload getOrDefault ["assignments", []])];
|
||||
_self set ["activity", +(_payload getOrDefault ["activity", []])];
|
||||
_self set ["generatedTaskTypes", +(_payload getOrDefault ["generatedTaskTypes", []])];
|
||||
_self set ["session", +(_payload getOrDefault ["session", createHashMap])];
|
||||
true
|
||||
}],
|
||||
|
||||
@ -23,12 +23,15 @@
|
||||
private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
|
||||
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
|
||||
|
||||
GVAR(CADUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#base", _webUIBridgeDeclaration],
|
||||
GVAR(CADUIBridgeBaseClass) = compileFinal ([
|
||||
_webUIBridgeDeclaration,
|
||||
createHashMapFromArray [
|
||||
["#type", "CADUIBridgeBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["screen", createHashMapObject [EGVAR(common,WebUIScreenDeclaration), []]];
|
||||
_self set ["dispatcherReady", false];
|
||||
_self set ["topBarReady", false];
|
||||
true
|
||||
}],
|
||||
["getActiveBrowserControl", compileFinal {
|
||||
private _display = uiNamespace getVariable [QGVAR(Display), displayNull];
|
||||
@ -482,7 +485,13 @@ GVAR(CADUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["success", _result getOrDefault ["success", false]]
|
||||
]]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(CADUIBridge) = createHashMapObject [GVAR(CADUIBridgeBaseClass)];
|
||||
GVAR(CADUIBridge)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(CADUIBridge) = createHashMapObject [GVAR(CADUIBridgeBaseClass), []];
|
||||
true
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,16 @@
|
||||
const dispatcherFormatters = window.cadDispatcherFormatters || {};
|
||||
const dispatcherModals = window.cadDispatcherModals || {};
|
||||
const dispatcherRender = window.cadDispatcherRender || {};
|
||||
const defaultTaskTypes = [
|
||||
{ value: "attack", label: "Attack" },
|
||||
{ value: "defend", label: "Defend" },
|
||||
{ value: "delivery", label: "Delivery" },
|
||||
{ value: "destroy", label: "Destroy" },
|
||||
{ value: "defuse", label: "Defuse" },
|
||||
{ value: "hostage", label: "Hostage" },
|
||||
{ value: "hvtkill", label: "Kill HVT" },
|
||||
{ value: "hvtcapture", label: "Capture HVT" },
|
||||
];
|
||||
|
||||
window.cadDispatcher = {
|
||||
contracts: [],
|
||||
@ -11,16 +21,7 @@ window.cadDispatcher = {
|
||||
editingGroupId: "",
|
||||
viewingRequestId: "",
|
||||
convertingRequestId: "",
|
||||
taskTypes: [
|
||||
{ value: "attack", label: "Attack" },
|
||||
{ value: "defend", label: "Defend" },
|
||||
{ value: "delivery", label: "Delivery" },
|
||||
{ value: "destroy", label: "Destroy" },
|
||||
{ value: "defuse", label: "Defuse" },
|
||||
{ value: "hostage", label: "Hostage" },
|
||||
{ value: "hvtkill", label: "Kill HVT" },
|
||||
{ value: "hvtcapture", label: "Capture HVT" },
|
||||
],
|
||||
taskTypes: defaultTaskTypes.slice(),
|
||||
statuses: [
|
||||
"available",
|
||||
"en_route",
|
||||
@ -133,6 +134,14 @@ window.cadDispatcher = {
|
||||
this.requests = Array.isArray(payload.requests) ? payload.requests : [];
|
||||
this.groups = Array.isArray(payload.groups) ? payload.groups : [];
|
||||
this.activity = Array.isArray(payload.activity) ? payload.activity : [];
|
||||
if (Array.isArray(payload.generatedTaskTypes)) {
|
||||
this.taskTypes = payload.generatedTaskTypes
|
||||
.map((entry) => ({
|
||||
value: String(entry?.value || "").trim(),
|
||||
label: String(entry?.label || entry?.value || "").trim(),
|
||||
}))
|
||||
.filter((entry) => entry.value);
|
||||
}
|
||||
this.session =
|
||||
payload.session && typeof payload.session === "object"
|
||||
? payload.session
|
||||
@ -223,6 +232,14 @@ window.cadDispatcher = {
|
||||
this.closeOrderModal();
|
||||
},
|
||||
requestGeneratedTask() {
|
||||
if (!this.taskTypes.length) {
|
||||
this.setStatus(
|
||||
"Generated task requests are disabled by server settings.",
|
||||
"error",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const taskType = document.getElementById(
|
||||
"dispatcherTaskTypeSelect",
|
||||
).value;
|
||||
|
||||
@ -18,6 +18,21 @@ window.cadDispatcherModals = {
|
||||
return;
|
||||
}
|
||||
|
||||
const saveButton = document.getElementById(
|
||||
"dispatcherTaskModalSaveBtn",
|
||||
);
|
||||
const hasTaskTypes = this.taskTypes.length > 0;
|
||||
taskTypeSelect.disabled = !hasTaskTypes;
|
||||
if (saveButton) {
|
||||
saveButton.disabled = !hasTaskTypes;
|
||||
}
|
||||
|
||||
if (!hasTaskTypes) {
|
||||
taskTypeSelect.innerHTML =
|
||||
'<option value="">No generated tasks available</option>';
|
||||
return;
|
||||
}
|
||||
|
||||
taskTypeSelect.innerHTML = this.buildTaskTypeOptions(
|
||||
taskTypeSelect.value || this.taskTypes[0]?.value || "",
|
||||
);
|
||||
|
||||
@ -8,7 +8,8 @@ class CfgPatches {
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_client_main"
|
||||
"forge_client_main",
|
||||
"forge_mod_common"
|
||||
};
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
@ -18,4 +19,3 @@ class CfgPatches {
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
@ -37,6 +37,7 @@ GVAR(WebUIScreenDeclaration) = compileFinal createHashMapFromArray [
|
||||
_self set ["control", _control];
|
||||
_self set ["readyState", false];
|
||||
_self set ["pendingEvents", []];
|
||||
true
|
||||
}],
|
||||
["dispose", compileFinal {
|
||||
_self set ["control", controlNull];
|
||||
@ -86,7 +87,8 @@ GVAR(WebUIScreenDeclaration) = compileFinal createHashMapFromArray [
|
||||
GVAR(WebUIBridgeDeclaration) = compileFinal createHashMapFromArray [
|
||||
["#type", "IWebUIBridge"],
|
||||
["#create", compileFinal {
|
||||
_self set ["screen", createHashMapObject [GVAR(WebUIScreenDeclaration)]];
|
||||
_self set ["screen", createHashMapObject [GVAR(WebUIScreenDeclaration), []]];
|
||||
true
|
||||
}],
|
||||
["deliverPayload", compileFinal {
|
||||
params [["_control", controlNull, [controlNull]], ["_payload", createHashMap, [createHashMap]]];
|
||||
@ -132,7 +134,7 @@ GVAR(WebUIBridgeDeclaration) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
|
||||
if (!_hasScreen) then {
|
||||
_screen = createHashMapObject [GVAR(WebUIScreenDeclaration)];
|
||||
_screen = createHashMapObject [GVAR(WebUIScreenDeclaration), []];
|
||||
_self set ["screen", _screen];
|
||||
};
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(GarageHelperService)) then { call FUNC(initHelperService); };
|
||||
if (isNil QGVAR(GarageRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(GarageContextService)) then { call FUNC(initContextService); };
|
||||
if (isNil QGVAR(GaragePayloadService)) then { call FUNC(initPayloadService); };
|
||||
if (isNil QGVAR(GarageActionService)) then { call FUNC(initActionService); };
|
||||
if (isNil QGVAR(GarageUIBridge)) then { call FUNC(initUIBridge); };
|
||||
if (isNil QGVAR(VGRepository)) then { call FUNC(initVGRepository); };
|
||||
if (isNil QGVAR(GarageHelperService)) then { call FUNC(initHelperService); true };
|
||||
if (isNil QGVAR(GarageRepository)) then { call FUNC(initRepository); true };
|
||||
if (isNil QGVAR(GarageContextService)) then { call FUNC(initContextService); true };
|
||||
if (isNil QGVAR(GaragePayloadService)) then { call FUNC(initPayloadService); true };
|
||||
if (isNil QGVAR(GarageActionService)) then { call FUNC(initActionService); true };
|
||||
if (isNil QGVAR(GarageUIBridge)) then { call FUNC(initUIBridge); true };
|
||||
if (isNil QGVAR(VGRepository)) then { call FUNC(initVGRepository); true };
|
||||
|
||||
[QGVAR(initGarage), {
|
||||
GVAR(GarageRepository) call ["init", []];
|
||||
|
||||
@ -23,8 +23,9 @@
|
||||
private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
|
||||
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
|
||||
|
||||
GVAR(GarageUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#base", _webUIBridgeDeclaration],
|
||||
GVAR(GarageUIBridgeBaseClass) = compileFinal ([
|
||||
_webUIBridgeDeclaration,
|
||||
createHashMapFromArray [
|
||||
["#type", "GarageUIBridgeBaseClass"],
|
||||
["getActiveBrowserControl", compileFinal {
|
||||
private _display = uiNamespace getVariable ["RscGarage", displayNull];
|
||||
@ -53,7 +54,13 @@ GVAR(GarageUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
_self call ["sendEvent", ["garage::sync", GVAR(GaragePayloadService) call ["buildPayload", []], _control]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(GarageUIBridge) = createHashMapObject [GVAR(GarageUIBridgeBaseClass)];
|
||||
GVAR(GarageUIBridge)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(GarageUIBridge) = createHashMapObject [GVAR(GarageUIBridgeBaseClass), []];
|
||||
true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(LockerRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(VARepository)) then { call FUNC(initVARepository); };
|
||||
if (isNil QGVAR(LockerRepository)) then { call FUNC(initRepository); true };
|
||||
if (isNil QGVAR(VARepository)) then { call FUNC(initVARepository); true };
|
||||
|
||||
[QGVAR(initLocker), {
|
||||
GVAR(LockerRepository) call ["init", []];
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
|
||||
#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
|
||||
#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETMPVAR(var1,var2) missionNamespace SETPVAR_SYS(var1,var2)
|
||||
#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2)
|
||||
|
||||
1
arma/client/addons/mission_setup/$PBOPREFIX$
Normal file
1
arma/client/addons/mission_setup/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
forge\forge_client\addons\mission_setup
|
||||
11
arma/client/addons/mission_setup/CfgEventHandlers.hpp
Normal file
11
arma/client/addons/mission_setup/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_SCRIPT(XEH_postInitClient));
|
||||
};
|
||||
};
|
||||
3
arma/client/addons/mission_setup/XEH_PREP.hpp
Normal file
3
arma/client/addons/mission_setup/XEH_PREP.hpp
Normal file
@ -0,0 +1,3 @@
|
||||
PREP(handleUIEvents);
|
||||
PREP(initRepository);
|
||||
PREP(openUI);
|
||||
19
arma/client/addons/mission_setup/XEH_postInitClient.sqf
Normal file
19
arma/client/addons/mission_setup/XEH_postInitClient.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(MissionSetupRepository)) then { call FUNC(initRepository); };
|
||||
|
||||
[CRPC(mission_setup,openMissionSetup), {
|
||||
diag_log "[FORGE:Client:MissionSetup] Received server open request.";
|
||||
[] call FUNC(openUI);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[{
|
||||
GETVAR(player,FORGE_isLoaded,false)
|
||||
}, {
|
||||
diag_log format [
|
||||
"[FORGE:Client:MissionSetup] Requesting mission setup open. Player=%1 VarName=%2",
|
||||
player,
|
||||
vehicleVarName player
|
||||
];
|
||||
[SRPC(task,requestOpenMissionSetup), [player]] call CFUNC(serverEvent);
|
||||
}] call CFUNC(waitUntilAndExecute);
|
||||
5
arma/client/addons/mission_setup/XEH_preInit.sqf
Normal file
5
arma/client/addons/mission_setup/XEH_preInit.sqf
Normal file
@ -0,0 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
21
arma/client/addons/mission_setup/config.cpp
Normal file
21
arma/client/addons/mission_setup/config.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
author = AUTHOR;
|
||||
authors[] = {"IDSolutions"};
|
||||
url = ECSTRING(main,url);
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_client_main",
|
||||
"forge_client_common"
|
||||
};
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "ui\RscMissionSetup.hpp"
|
||||
@ -0,0 +1,76 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Handles JSON events from the framework mission setup browser UI.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Browser control <CONTROL>
|
||||
* 1: Whether the event came from a confirm dialog <BOOL>
|
||||
* 2: JSON event payload <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Event handled <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params [
|
||||
["_control", controlNull, [controlNull]],
|
||||
["_isConfirmDialog", false, [false]],
|
||||
["_message", "", [""]]
|
||||
];
|
||||
|
||||
if (_message isEqualTo "") exitWith { false };
|
||||
|
||||
private _alert = fromJSON _message;
|
||||
if !(_alert isEqualType createHashMap) exitWith { false };
|
||||
|
||||
private _event = _alert getOrDefault ["event", ""];
|
||||
private _data = _alert getOrDefault ["data", createHashMap];
|
||||
|
||||
diag_log format ["[FORGE:Client:MissionSetup] Handling UI event: %1", _event];
|
||||
|
||||
private _send = {
|
||||
params ["_eventName", "_payload"];
|
||||
|
||||
if (isNull _control) exitWith { false };
|
||||
|
||||
private _json = toJSON createHashMapFromArray [
|
||||
["event", _eventName],
|
||||
["data", _payload]
|
||||
];
|
||||
_control ctrlWebBrowserAction ["ExecJS", format ["MissionSetupBridge.receive(%1)", _json]];
|
||||
true
|
||||
};
|
||||
|
||||
switch (_event) do {
|
||||
case "missionSetup::ready": {
|
||||
if (isNil QGVAR(MissionSetupRepository)) then { call FUNC(initRepository); };
|
||||
["missionSetup::hydrate", GVAR(MissionSetupRepository) call ["buildSetupPayload", []]] call _send;
|
||||
};
|
||||
case "missionSetup::apply": {
|
||||
if !(_data isEqualType createHashMap) exitWith {
|
||||
["missionSetup::error", createHashMapFromArray [["message", "Invalid mission setup payload."]]] call _send;
|
||||
};
|
||||
|
||||
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
|
||||
[SRPC(task,requestApplyMissionSetupSettings), [_data, player]] call CFUNC(serverEvent);
|
||||
closeDialog 1;
|
||||
};
|
||||
case "missionSetup::cancel": {
|
||||
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
|
||||
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
|
||||
closeDialog 1;
|
||||
};
|
||||
case "missionSetup::close": {
|
||||
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
|
||||
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
|
||||
closeDialog 1;
|
||||
};
|
||||
default {
|
||||
["missionSetup::error", createHashMapFromArray [["message", format ["Unhandled setup event: %1", _event]]]] call _send;
|
||||
};
|
||||
};
|
||||
|
||||
true
|
||||
@ -0,0 +1,206 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Initializes the client mission setup repository.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Mission setup repository object <HASHMAP OBJECT>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(MissionSetupRepositoryBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "MissionSetupRepositoryBaseClass"],
|
||||
["getEnemyFactionOptions", compileFinal {
|
||||
private _config = missionConfigFile >> "CfgEnemyFactions";
|
||||
if !(isClass _config) then { _config = configFile >> "CfgEnemyFactions"; };
|
||||
|
||||
private _allowedSides = getArray (_config >> "sides");
|
||||
if (_allowedSides isEqualTo []) then { _allowedSides = [0, 2]; };
|
||||
|
||||
private _denylist = getArray (_config >> "denylist");
|
||||
private _overridesConfig = _config >> "Overrides";
|
||||
|
||||
private _spawnableFactions = createHashMap;
|
||||
{
|
||||
if (getNumber (_x >> "scope") < 2) then { continue; };
|
||||
if !(configName _x isKindOf "CAManBase") then { continue; };
|
||||
|
||||
private _faction = getText (_x >> "faction");
|
||||
if (_faction isEqualTo "") then { continue; };
|
||||
|
||||
private _side = getNumber (_x >> "side");
|
||||
if !(_side in _allowedSides) then { continue; };
|
||||
|
||||
_spawnableFactions set [_faction, true];
|
||||
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
|
||||
|
||||
private _mappedFactions = createHashMap;
|
||||
private _factionMapRoot = missionConfigFile >> "CfgFactionUnitMap";
|
||||
if !(isClass _factionMapRoot) then { _factionMapRoot = configFile >> "CfgFactionUnitMap"; };
|
||||
|
||||
{
|
||||
private _unitsConfig = _x >> "Units";
|
||||
if !(isClass _unitsConfig) then { continue; };
|
||||
|
||||
private _hasUnits = false;
|
||||
{
|
||||
private _vehicle = getText (_x >> "vehicle");
|
||||
if (_vehicle isNotEqualTo "" && { isClass (configFile >> "CfgVehicles" >> _vehicle) }) exitWith { _hasUnits = true; };
|
||||
} forEach ("true" configClasses _unitsConfig);
|
||||
|
||||
if (_hasUnits) then { _mappedFactions set [configName _x, true]; };
|
||||
} forEach ("true" configClasses _factionMapRoot);
|
||||
|
||||
private _getFactionSideNumber = {
|
||||
params ["_factionConfig"];
|
||||
|
||||
if (isNumber (_factionConfig >> "side")) exitWith { getNumber (_factionConfig >> "side") };
|
||||
switch (toUpperANSI getText (_factionConfig >> "side")) do {
|
||||
case "0";
|
||||
case "EAST";
|
||||
case "OPFOR": { 0 };
|
||||
case "2";
|
||||
case "GUER";
|
||||
case "GUERRILA";
|
||||
case "GUERRILLA";
|
||||
case "INDEPENDENT";
|
||||
case "RESISTANCE": { 2 };
|
||||
default { -1 };
|
||||
};
|
||||
};
|
||||
|
||||
private _records = [];
|
||||
private _dynamicIndex = 0;
|
||||
{
|
||||
private _faction = configName _x;
|
||||
if (_faction isEqualTo "") then { continue; };
|
||||
if (_faction in _denylist) then { continue; };
|
||||
|
||||
private _side = [_x] call _getFactionSideNumber;
|
||||
if !(_side in _allowedSides) then { continue; };
|
||||
if (!(_spawnableFactions getOrDefault [_faction, false]) && {
|
||||
!(_mappedFactions getOrDefault [_faction, false])
|
||||
}) then {
|
||||
continue;
|
||||
};
|
||||
|
||||
private _override = _overridesConfig >> _faction;
|
||||
private _display = getText (_x >> "displayName");
|
||||
private _order = 1000 + _dynamicIndex;
|
||||
private _value = 1000 + _dynamicIndex;
|
||||
|
||||
if (isClass _override) then {
|
||||
private _overrideDisplay = getText (_override >> "display");
|
||||
if (_overrideDisplay isNotEqualTo "") then { _display = _overrideDisplay; };
|
||||
if (isNumber (_override >> "order")) then { _order = getNumber (_override >> "order"); };
|
||||
if (isNumber (_override >> "value")) then { _value = getNumber (_override >> "value"); };
|
||||
};
|
||||
if (_display isEqualTo "") then { _display = _faction; };
|
||||
|
||||
_records pushBack [_order, _display, _faction, _value];
|
||||
_dynamicIndex = _dynamicIndex + 1;
|
||||
} forEach ("true" configClasses (configFile >> "CfgFactionClasses"));
|
||||
|
||||
_records sort true;
|
||||
|
||||
private _options = [];
|
||||
{
|
||||
_x params ["_order", "_display", "_faction", "_value"];
|
||||
_options pushBack [_faction, _display, _value];
|
||||
} forEach _records;
|
||||
|
||||
if (_options isEqualTo []) then {
|
||||
_options = [
|
||||
["OPF_F", "CSAT", 0],
|
||||
["IND_G_F", "FIA", 6]
|
||||
];
|
||||
};
|
||||
|
||||
_options
|
||||
}],
|
||||
["resolveEnemyFactionParam", compileFinal {
|
||||
params [
|
||||
["_value", 6, [0, ""]],
|
||||
["_fallback", "IND_G_F", [""]]
|
||||
];
|
||||
|
||||
if (_value isEqualType "") then {
|
||||
if (_value isEqualTo "") exitWith { _fallback };
|
||||
if (isClass (configFile >> "CfgFactionClasses" >> _value)) exitWith { _value };
|
||||
_value = parseNumber _value;
|
||||
};
|
||||
|
||||
private _faction = _fallback;
|
||||
{
|
||||
_x params ["_optionFaction", "_display", "_optionValue"];
|
||||
if (_optionValue isEqualTo _value) exitWith { _faction = _optionFaction; };
|
||||
} forEach (_self call ["getEnemyFactionOptions", []]);
|
||||
|
||||
_faction
|
||||
}],
|
||||
["buildSetupPayload", compileFinal {
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
|
||||
|
||||
private _paramOrDefault = {
|
||||
params ["_varName", "_default"];
|
||||
|
||||
private _value = missionNamespace getVariable [_varName, _default];
|
||||
if (_value isEqualType "") exitWith { parseNumber _value };
|
||||
_value
|
||||
};
|
||||
|
||||
private _factions = [];
|
||||
{
|
||||
_x params ["_faction", "_display", "_value"];
|
||||
_factions pushBack createHashMapFromArray [
|
||||
["faction", _faction],
|
||||
["display", _display],
|
||||
["value", _value]
|
||||
];
|
||||
} forEach (_self call ["getEnemyFactionOptions", []]);
|
||||
|
||||
private _defaultFactionParam = GETMVAR(enemyFaction,6);
|
||||
if (_defaultFactionParam isEqualTo 6) then {
|
||||
private _paramValue = ["enemyFaction", -1] call BIS_fnc_getParamValue;
|
||||
if (_paramValue isNotEqualTo -1) then { _defaultFactionParam = _paramValue; };
|
||||
};
|
||||
|
||||
private _defaultFaction = _self call ["resolveEnemyFactionParam", [_defaultFactionParam, "IND_G_F"]];
|
||||
private _hasDefaultFaction = false;
|
||||
{
|
||||
if ((_x getOrDefault ["faction", ""]) isEqualTo _defaultFaction) exitWith { _hasDefaultFaction = true; };
|
||||
} forEach _factions;
|
||||
|
||||
if (!_hasDefaultFaction && { _factions isNotEqualTo [] }) then {
|
||||
_defaultFaction = (_factions select 0) getOrDefault ["faction", _defaultFaction];
|
||||
};
|
||||
|
||||
createHashMapFromArray [
|
||||
["factions", _factions],
|
||||
["settings", createHashMapFromArray [
|
||||
["enemyFaction", _defaultFaction],
|
||||
["maxConcurrentMissions", ["maxConcurrentMissions", getNumber (_missionConfig >> "maxConcurrentMissions")] call _paramOrDefault],
|
||||
["missionInterval", ["missionInterval", getNumber (_missionConfig >> "missionInterval")] call _paramOrDefault],
|
||||
["locationReuseCooldown", ["locationReuseCooldown", getNumber (_missionConfig >> "locationReuseCooldown")] call _paramOrDefault],
|
||||
["moneyMin", ["moneyMin", 500] call _paramOrDefault],
|
||||
["moneyMax", ["moneyMax", 1000] call _paramOrDefault],
|
||||
["reputationMin", ["reputationMin", 25] call _paramOrDefault],
|
||||
["reputationMax", ["reputationMax", 100] call _paramOrDefault],
|
||||
["penaltyMin", ["penaltyMin", -5] call _paramOrDefault],
|
||||
["penaltyMax", ["penaltyMax", -25] call _paramOrDefault],
|
||||
["timeLimitMin", ["timeLimitMin", 600] call _paramOrDefault],
|
||||
["timeLimitMax", ["timeLimitMax", 900] call _paramOrDefault]
|
||||
]]
|
||||
]
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(MissionSetupRepository) = createHashMapObject [GVAR(MissionSetupRepositoryBaseClass)];
|
||||
GVAR(MissionSetupRepository)
|
||||
58
arma/client/addons/mission_setup/functions/fnc_openUI.sqf
Normal file
58
arma/client/addons/mission_setup/functions/fnc_openUI.sqf
Normal file
@ -0,0 +1,58 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Opens the framework mission setup UI.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* UI opened <BOOL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
if !(hasInterface) exitWith {
|
||||
diag_log "[FORGE:Client:MissionSetup] openUI skipped: no interface.";
|
||||
false
|
||||
};
|
||||
if !(isNull (uiNamespace getVariable ["RscMissionSetup", displayNull])) exitWith {
|
||||
diag_log "[FORGE:Client:MissionSetup] openUI skipped: dialog already open.";
|
||||
true
|
||||
};
|
||||
|
||||
diag_log "[FORGE:Client:MissionSetup] Creating mission setup dialog.";
|
||||
|
||||
private _display = createDialog ["RscMissionSetup", true];
|
||||
if (isNull _display) exitWith {
|
||||
diag_log "[FORGE:Client:MissionSetup] createDialog returned null display.";
|
||||
false
|
||||
};
|
||||
|
||||
uiNamespace setVariable [QGVAR(MissionSetupHandled), false];
|
||||
_display displayAddEventHandler ["Unload", {
|
||||
if !(uiNamespace getVariable [QGVAR(MissionSetupHandled), false]) then {
|
||||
diag_log "[FORGE:Client:MissionSetup] Dialog unloaded before apply/cancel; applying default mission setup settings.";
|
||||
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
|
||||
};
|
||||
|
||||
uiNamespace setVariable [QGVAR(MissionSetupHandled), nil];
|
||||
}];
|
||||
|
||||
private _control = _display displayCtrl 94011;
|
||||
if (isNull _control) exitWith {
|
||||
diag_log "[FORGE:Client:MissionSetup] Browser control 94011 not found. Closing dialog.";
|
||||
closeDialog 1;
|
||||
false
|
||||
};
|
||||
|
||||
_control ctrlAddEventHandler ["JSDialog", {
|
||||
params ["_control", "_isConfirmDialog", "_message"];
|
||||
[_control, _isConfirmDialog, _message] call FUNC(handleUIEvents);
|
||||
}];
|
||||
|
||||
_control ctrlWebBrowserAction ["LoadFile", QPATHTOF2(ui\_site\index.html)];
|
||||
diag_log "[FORGE:Client:MissionSetup] Mission setup UI load requested.";
|
||||
|
||||
true
|
||||
9
arma/client/addons/mission_setup/script_component.hpp
Normal file
9
arma/client/addons/mission_setup/script_component.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#define COMPONENT mission_setup
|
||||
#define COMPONENT_BEAUTIFIED Mission_Setup
|
||||
#include "\forge\forge_client\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#include "\forge\forge_client\addons\main\script_macros.hpp"
|
||||
23
arma/client/addons/mission_setup/ui/RscMissionSetup.hpp
Normal file
23
arma/client/addons/mission_setup/ui/RscMissionSetup.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
class RscText;
|
||||
|
||||
class RscMissionSetup {
|
||||
idd = 94010;
|
||||
fadeIn = 0;
|
||||
fadeOut = 0;
|
||||
duration = 1e011;
|
||||
onLoad = "uiNamespace setVariable ['RscMissionSetup', _this select 0]";
|
||||
onUnLoad = "uiNamespace setVariable ['RscMissionSetup', nil]";
|
||||
|
||||
class controlsBackground {};
|
||||
class controls {
|
||||
class Browser: RscText {
|
||||
type = 106;
|
||||
idc = 94011;
|
||||
x = "safeZoneXAbs + (safeZoneWAbs * 0.125)";
|
||||
y = "safeZoneY + (safeZoneH * 0.125)";
|
||||
w = "safeZoneWAbs * 0.75";
|
||||
h = "safeZoneH * 0.75";
|
||||
colorBackground[] = {0, 0, 0, 0};
|
||||
};
|
||||
};
|
||||
};
|
||||
1
arma/client/addons/mission_setup/ui/_site/index.html
Normal file
1
arma/client/addons/mission_setup/ui/_site/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>FORGE Mission Setup</title><script>window.ForgeSiteConfig={addonName:"mission_setup",logLabel:"Mission Setup UI",styles:["mission-setup.css"],commonScripts:[],scripts:["mission-setup.js"]},function(){const e="../../../common/ui/_site/forge-site-loader.js";("undefined"!=typeof A3API&&A3API&&"function"==typeof A3API.RequestFile?A3API.RequestFile("forge\\forge_client\\addons\\common\\ui\\_site\\forge-site-loader.js"):fetch(e).then(o=>{if(!o.ok)throw new Error("Failed to load "+e);return o.text()})).then(function(e){const o=document.createElement("script");o.text=e,document.head.appendChild(o)}).catch(e=>{console.error("[Mission Setup UI] Failed to load Forge site loader.",e)})}()</script></head><body><div id="app"></div></body></html>
|
||||
259
arma/client/addons/mission_setup/ui/_site/mission-setup.css
Normal file
259
arma/client/addons/mission_setup/ui/_site/mission-setup.css
Normal file
@ -0,0 +1,259 @@
|
||||
:root {
|
||||
--bg-app: rgba(9, 12, 18, 0.88);
|
||||
--surface: rgba(20, 24, 33, 0.9);
|
||||
--border: rgba(255, 255, 255, 0.1);
|
||||
--border-strong: rgba(255, 255, 255, 0.2);
|
||||
--text-main: rgba(245, 248, 255, 0.92);
|
||||
--text-muted: rgba(245, 248, 255, 0.62);
|
||||
--text-subtle: rgba(245, 248, 255, 0.42);
|
||||
--accent: rgba(104, 196, 255, 0.95);
|
||||
--accent-soft: rgba(104, 196, 255, 0.13);
|
||||
--accent-wash: rgba(41, 69, 93, 0.18);
|
||||
--danger: rgba(255, 138, 128, 0.95);
|
||||
--danger-bg: rgba(92, 18, 18, 0.78);
|
||||
--shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
||||
color: var(--text-main);
|
||||
background:
|
||||
radial-gradient(circle at top left, var(--accent-wash), transparent 30%),
|
||||
linear-gradient(180deg, rgba(9, 14, 20, 0.96), rgba(15, 22, 31, 0.98)),
|
||||
var(--bg-app);
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.shell {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
}
|
||||
|
||||
.titlebar {
|
||||
min-height: 3.25rem;
|
||||
padding: 0 1.6rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: linear-gradient(90deg, rgba(16, 22, 31, 0.96), rgba(19, 26, 36, 0.94) 55%, rgba(15, 20, 28, 0.96));
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
|
||||
.kicker {
|
||||
color: var(--accent);
|
||||
font-size: 0.76rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
option {
|
||||
background: rgb(20, 24, 33);
|
||||
color: rgb(245, 248, 255);
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 96, 96, 0.1);
|
||||
color: rgba(255, 220, 220, 0.95);
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: 0;
|
||||
padding: 1.5rem;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.grid {
|
||||
max-width: 78rem;
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 0.9fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.panel {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--border);
|
||||
background: linear-gradient(180deg, rgba(23, 31, 40, 0.86), var(--surface) 9rem);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
padding: 1.15rem 1.25rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.panel-head h1,
|
||||
.panel-head h2 {
|
||||
margin: 0.2rem 0 0;
|
||||
font-size: 1.45rem;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.form {
|
||||
padding: 1.25rem;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
label {
|
||||
color: var(--text-subtle);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
min-height: 2.65rem;
|
||||
padding: 0 0.85rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(24, 31, 40, 0.9);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.toggle input {
|
||||
width: 1rem;
|
||||
min-height: 1rem;
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
min-height: 2.65rem;
|
||||
padding: 0 0.85rem;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(24, 31, 40, 0.9);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
input:focus,
|
||||
select:focus,
|
||||
button:focus-visible {
|
||||
outline: 2px solid rgba(104, 196, 255, 0.34);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.summary {
|
||||
padding: 1.25rem;
|
||||
display: grid;
|
||||
gap: 0.8rem;
|
||||
}
|
||||
|
||||
.summary-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding-bottom: 0.8rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.summary-row span {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.summary-row strong {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin-top: 1rem;
|
||||
padding: 0.85rem 1rem;
|
||||
color: var(--danger);
|
||||
background: var(--danger-bg);
|
||||
border: 1px solid rgba(255, 107, 107, 0.38);
|
||||
}
|
||||
|
||||
.actions {
|
||||
padding: 1rem 1.5rem;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.75rem;
|
||||
border-top: 1px solid var(--border);
|
||||
background: linear-gradient(90deg, rgba(11, 17, 24, 0.82), rgba(23, 31, 40, 0.86));
|
||||
}
|
||||
|
||||
.btn {
|
||||
min-height: 2.75rem;
|
||||
padding: 0.72rem 1rem;
|
||||
border: 1px solid var(--border-strong);
|
||||
background: rgba(24, 31, 40, 0.9);
|
||||
color: var(--text-main);
|
||||
font-size: 0.82rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.btn.primary {
|
||||
background: rgba(24, 86, 126, 0.95);
|
||||
color: #ffffff;
|
||||
border-color: rgba(104, 196, 255, 0.34);
|
||||
}
|
||||
|
||||
.btn.primary:hover {
|
||||
background: rgba(32, 108, 156, 0.98);
|
||||
}
|
||||
|
||||
.btn.secondary {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.btn.secondary:hover {
|
||||
background: var(--accent-soft);
|
||||
border-color: rgba(104, 196, 255, 0.28);
|
||||
}
|
||||
250
arma/client/addons/mission_setup/ui/_site/mission-setup.js
Normal file
250
arma/client/addons/mission_setup/ui/_site/mission-setup.js
Normal file
@ -0,0 +1,250 @@
|
||||
(function () {
|
||||
const state = {
|
||||
factions: [],
|
||||
settings: {
|
||||
enemyFaction: "IND_G_F",
|
||||
maxConcurrentMissions: 3,
|
||||
missionInterval: 300,
|
||||
locationReuseCooldown: 900,
|
||||
moneyMin: 500,
|
||||
moneyMax: 1000,
|
||||
reputationMin: 25,
|
||||
reputationMax: 100,
|
||||
penaltyMin: -5,
|
||||
penaltyMax: -25,
|
||||
timeLimitMin: 600,
|
||||
timeLimitMax: 900,
|
||||
},
|
||||
error: "",
|
||||
};
|
||||
|
||||
function send(event, data = {}) {
|
||||
if (!window.A3API || typeof window.A3API.SendAlert !== "function") {
|
||||
return false;
|
||||
}
|
||||
|
||||
window.A3API.SendAlert(JSON.stringify({ event, data }));
|
||||
return true;
|
||||
}
|
||||
|
||||
function fieldNumber(id) {
|
||||
const value = Number(document.getElementById(id)?.value || 0);
|
||||
return Number.isFinite(value) ? value : 0;
|
||||
}
|
||||
|
||||
function readSettings() {
|
||||
return {
|
||||
enemyFaction: String(document.getElementById("enemyFaction")?.value || "IND_G_F"),
|
||||
maxConcurrentMissions: fieldNumber("maxConcurrentMissions"),
|
||||
missionInterval: fieldNumber("missionInterval"),
|
||||
locationReuseCooldown: fieldNumber("locationReuseCooldown"),
|
||||
moneyMin: fieldNumber("moneyMin"),
|
||||
moneyMax: fieldNumber("moneyMax"),
|
||||
reputationMin: fieldNumber("reputationMin"),
|
||||
reputationMax: fieldNumber("reputationMax"),
|
||||
penaltyMin: fieldNumber("penaltyMin"),
|
||||
penaltyMax: fieldNumber("penaltyMax"),
|
||||
timeLimitMin: fieldNumber("timeLimitMin"),
|
||||
timeLimitMax: fieldNumber("timeLimitMax"),
|
||||
};
|
||||
}
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value ?? "")
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
function apply() {
|
||||
const settings = readSettings();
|
||||
if (settings.moneyMax < settings.moneyMin) {
|
||||
state.error = "Money max must be greater than or equal to money min.";
|
||||
render();
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.reputationMax < settings.reputationMin) {
|
||||
state.error = "Reputation max must be greater than or equal to reputation min.";
|
||||
render();
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.penaltyMin > 0 || settings.penaltyMax > 0) {
|
||||
state.error = "Reputation hits must be zero or negative values.";
|
||||
render();
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.timeLimitMax < settings.timeLimitMin) {
|
||||
state.error = "Time limit max must be greater than or equal to time limit min.";
|
||||
render();
|
||||
return;
|
||||
}
|
||||
|
||||
state.error = "";
|
||||
send("missionSetup::apply", settings);
|
||||
}
|
||||
|
||||
function close() {
|
||||
send("missionSetup::cancel", {});
|
||||
}
|
||||
|
||||
function option(faction) {
|
||||
const selected = faction.faction === state.settings.enemyFaction ? " selected" : "";
|
||||
return `<option value="${escapeHtml(faction.faction)}"${selected}>${escapeHtml(faction.display)}</option>`;
|
||||
}
|
||||
|
||||
function render() {
|
||||
const settings = state.settings;
|
||||
const faction = state.factions.find((item) => item.faction === settings.enemyFaction);
|
||||
const factionLabel = faction ? faction.display : settings.enemyFaction;
|
||||
|
||||
document.getElementById("app").innerHTML = `
|
||||
<div class="shell">
|
||||
<header class="titlebar">
|
||||
<div class="brand">
|
||||
<span class="kicker">FORGE</span>
|
||||
<span class="title">Mission Setup</span>
|
||||
</div>
|
||||
<button class="close" type="button" aria-label="Close" data-action="close">x</button>
|
||||
</header>
|
||||
|
||||
<main class="content">
|
||||
<div class="grid">
|
||||
<section class="panel">
|
||||
<div class="panel-head">
|
||||
<span class="kicker">Deployment Profile</span>
|
||||
<h1>Operation Settings</h1>
|
||||
</div>
|
||||
<div class="form">
|
||||
<div class="field">
|
||||
<label for="enemyFaction">Opposing Faction</label>
|
||||
<select id="enemyFaction">${state.factions.map(option).join("")}</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="locationReuseCooldown">Location Cooldown</label>
|
||||
<input id="locationReuseCooldown" type="number" min="0" step="60" value="${settings.locationReuseCooldown}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="maxConcurrentMissions">Concurrent Missions</label>
|
||||
<input id="maxConcurrentMissions" type="number" min="1" max="50" value="${settings.maxConcurrentMissions}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="missionInterval">Mission Interval</label>
|
||||
<input id="missionInterval" type="number" min="1" step="30" value="${settings.missionInterval}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="moneyMin">Min Funds</label>
|
||||
<input id="moneyMin" type="number" min="0" step="100" value="${settings.moneyMin}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="moneyMax">Max Funds</label>
|
||||
<input id="moneyMax" type="number" min="0" step="100" value="${settings.moneyMax}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="reputationMin">Min Rating</label>
|
||||
<input id="reputationMin" type="number" step="1" value="${settings.reputationMin}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="reputationMax">Max Rating</label>
|
||||
<input id="reputationMax" type="number" step="1" value="${settings.reputationMax}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="penaltyMin">Min Rep Hit</label>
|
||||
<input id="penaltyMin" type="number" max="0" step="1" value="${settings.penaltyMin}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="penaltyMax">Max Rep Hit</label>
|
||||
<input id="penaltyMax" type="number" max="0" step="1" value="${settings.penaltyMax}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="timeLimitMin">Min Time</label>
|
||||
<input id="timeLimitMin" type="number" min="1" step="60" value="${settings.timeLimitMin}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="timeLimitMax">Max Time</label>
|
||||
<input id="timeLimitMax" type="number" min="1" step="60" value="${settings.timeLimitMax}" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside class="panel">
|
||||
<div class="panel-head">
|
||||
<span class="kicker">Current Selection</span>
|
||||
<h2>Generator Runtime</h2>
|
||||
</div>
|
||||
<div class="summary">
|
||||
<div class="summary-row"><span>Faction</span><strong>${escapeHtml(factionLabel)}</strong></div>
|
||||
<div class="summary-row"><span>Mission Cap</span><strong>${settings.maxConcurrentMissions}</strong></div>
|
||||
<div class="summary-row"><span>Interval</span><strong>${settings.missionInterval}s</strong></div>
|
||||
<div class="summary-row"><span>Location Cooldown</span><strong>${settings.locationReuseCooldown}s</strong></div>
|
||||
<div class="summary-row"><span>Reward Range</span><strong>$${Number(settings.moneyMin).toLocaleString()} - $${Number(settings.moneyMax).toLocaleString()}</strong></div>
|
||||
<div class="summary-row"><span>Reputation</span><strong>${settings.reputationMin} - ${settings.reputationMax}</strong></div>
|
||||
<div class="summary-row"><span>Reputation Hit</span><strong>${settings.penaltyMin} to ${settings.penaltyMax}</strong></div>
|
||||
<div class="summary-row"><span>Time Limit</span><strong>${settings.timeLimitMin}s - ${settings.timeLimitMax}s</strong></div>
|
||||
${state.error ? `<div class="notice">${state.error}</div>` : ""}
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="actions">
|
||||
<button class="btn secondary" type="button" data-action="close">Cancel</button>
|
||||
<button class="btn primary" type="button" data-action="apply">Apply Settings</button>
|
||||
</footer>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.querySelectorAll("input, select").forEach((input) => {
|
||||
input.addEventListener("change", () => {
|
||||
state.settings = readSettings();
|
||||
render();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-action='close']").forEach((button) => {
|
||||
button.addEventListener("click", close);
|
||||
});
|
||||
|
||||
document.querySelector("[data-action='apply']").addEventListener("click", apply);
|
||||
}
|
||||
|
||||
window.MissionSetupBridge = {
|
||||
receive(payload) {
|
||||
if (!payload || typeof payload !== "object") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (payload.event === "missionSetup::hydrate") {
|
||||
let factions = Array.isArray(payload.data?.factions) ? payload.data.factions : [];
|
||||
const seen = new Set();
|
||||
factions = factions.filter((faction) => {
|
||||
const key = ((faction.display || faction.faction) + "").toLowerCase().trim();
|
||||
if (seen.has(key)) {
|
||||
return false;
|
||||
}
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
state.factions = factions;
|
||||
state.settings = Object.assign({}, state.settings, payload.data?.settings || {});
|
||||
render();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (payload.event === "missionSetup::error") {
|
||||
state.error = String(payload.data?.message || "Mission setup failed.");
|
||||
render();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
};
|
||||
|
||||
render();
|
||||
send("missionSetup::ready", { loaded: true });
|
||||
})();
|
||||
@ -5,7 +5,7 @@
|
||||
}, {
|
||||
("NotificationHudLayer" call BFUNC(rscLayer)) cutRsc ["RscNotifications", "PLAIN"];
|
||||
call FUNC(openUI);
|
||||
if (isNil QGVAR(NotificationService)) then { call FUNC(initService); };
|
||||
if (isNil QGVAR(NotificationService)) then { call FUNC(initService); true };
|
||||
}] call CFUNC(waitUntilAndExecute);
|
||||
|
||||
[QGVAR(recieveNotification), {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(OrgRepository)) then { call FUNC(initRepository); };
|
||||
if (isNil QGVAR(OrgUIBridge)) then { call FUNC(initUIBridge); };
|
||||
if (isNil QGVAR(OrgRepository)) then { call FUNC(initRepository); true };
|
||||
if (isNil QGVAR(OrgUIBridge)) then { call FUNC(initUIBridge); true };
|
||||
|
||||
[QGVAR(initOrg), {
|
||||
GVAR(OrgRepository) call ["init", []];
|
||||
|
||||
@ -24,8 +24,9 @@
|
||||
private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
|
||||
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
|
||||
|
||||
GVAR(OrgUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#base", _webUIBridgeDeclaration],
|
||||
GVAR(OrgUIBridgeBaseClass) = compileFinal ([
|
||||
_webUIBridgeDeclaration,
|
||||
createHashMapFromArray [
|
||||
["#type", "OrgUIBridgeBaseClass"],
|
||||
["setPendingBrowserControl", compileFinal {
|
||||
params [["_control", controlNull, [controlNull]]];
|
||||
@ -242,7 +243,13 @@ GVAR(OrgUIBridgeBaseClass) = compileFinal createHashMapFromArray [
|
||||
["refreshPortal", compileFinal {
|
||||
_self call ["requestHydrate", ["org::sync"]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(OrgUIBridge) = createHashMapObject [GVAR(OrgUIBridgeBaseClass)];
|
||||
GVAR(OrgUIBridge)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(OrgUIBridge) = createHashMapObject [GVAR(OrgUIBridgeBaseClass), []];
|
||||
true
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
[QGVAR(initPhone), []] call CFUNC(localEvent);
|
||||
}] call CFUNC(waitUntilAndExecute);
|
||||
|
||||
if (isNil QGVAR(PhoneRepository)) then { [] call FUNC(initRepository); };
|
||||
if (isNil QGVAR(PhoneRepository)) then { [] call FUNC(initRepository); true };
|
||||
|
||||
[QGVAR(initPhone), {
|
||||
GVAR(PhoneRepository) call ["init", []];
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(StoreUIBridge)) then { call FUNC(initUIBridge); };
|
||||
if (isNil QGVAR(StoreUIBridge)) then { call FUNC(initUIBridge); true };
|
||||
|
||||
[QGVAR(responseCategory), {
|
||||
params [["_payload", createHashMap, [createHashMap]]];
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
protocol = 1;
|
||||
publishedid = MOD_ID;
|
||||
publishedid = 0;
|
||||
name = "forge-client";
|
||||
timestamp = 5250140732737923549;
|
||||
|
||||
2
arma/mod/.hemtt/lints.toml
Normal file
2
arma/mod/.hemtt/lints.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[config]
|
||||
unknown_external = "allow"
|
||||
24
arma/mod/.hemtt/project.toml
Normal file
24
arma/mod/.hemtt/project.toml
Normal file
@ -0,0 +1,24 @@
|
||||
name = "forge-mod"
|
||||
author = "J.Schmidt"
|
||||
prefix = "forge_mod"
|
||||
mainprefix = "forge"
|
||||
|
||||
[version]
|
||||
path = "addons/main/script_version.hpp"
|
||||
git_hash = 0
|
||||
|
||||
[files]
|
||||
include = [
|
||||
"mod.cpp",
|
||||
"meta.cpp",
|
||||
"icon_64_ca.paa",
|
||||
"icon_128_ca.paa",
|
||||
"icon_128_highlight_ca.paa",
|
||||
"title_ca.paa",
|
||||
"LICENSE.md",
|
||||
"README.md",
|
||||
]
|
||||
exclude = []
|
||||
|
||||
[properties]
|
||||
author = "J.Schmidt"
|
||||
119
arma/mod/LICENSE.md
Normal file
119
arma/mod/LICENSE.md
Normal file
@ -0,0 +1,119 @@
|
||||

|
||||
|
||||
## Brief summary of this Licence
|
||||
|
||||
PLEASE, NOTE THAT THIS SUMMARY HAS NO LEGAL EFFECT AND IS ONLY OF AN INFORMATORY NATURE DESIGNED FOR YOU TO GET THE BASIC INFORMATION ABOUT THE CONTENT OF THIS LICENCE. THE ONLY LEGALLY BINDING PROVISIONS ARE THOSE IN THE ORIGINAL AND FULL TEXT OF THIS LICENCE.
|
||||
|
||||
With this licence you are free to adapt (i.e. modify, rework or update) and share (i.e. copy, distribute or transmit) the material under the following conditions:
|
||||
|
||||
- **Attribution** - You must attribute the material in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the material).
|
||||
- **Noncommercial** - You may not use this material for any commercial purposes.
|
||||
- **Arma Only** - You may not convert or adapt this material to be used in other games than Arma.
|
||||
- **Share Alike** - If you adapt, or build upon this material, you may distribute the resulting material only under the same license.
|
||||
|
||||
---
|
||||
|
||||
# Full version of licence
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Arma Public License - Share Alike ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||
|
||||
### Section 1 – Definitions
|
||||
|
||||
1. **Adapted Material** means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||
2. **Adapter's License** means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
||||
3. **ArmaOnly** means primarily intended for or directed towards the use in any of existing and future Arma games, including but not limited to Arma: Cold War Assault, Arma, Arma 2 and Arma 3 and its official sequels and expansion packs.
|
||||
4. **Arma Public Share Alike Compatible License** means a license listed at [https://www.bohemia.net/community/licenses](https://www.bohemia.net/community/licenses) as essentially the equivalent of this Public License.
|
||||
5. **Copyright and Similar Rights** means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
6. **Effective Technological Measures** means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||
7. **Exceptions and Limitations** means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||
8. **Licensed Material** means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||
9. **Licensed Rights** means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||
10. **Licensor** means the individual(s) or entity(ies) granting rights under this Public License.
|
||||
11. **NonCommercial** means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
||||
12. **Share** means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||
13. **Sui Generis Database Rights** means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||
14. **You** means the individual or entity exercising the Licensed Rights under this Public License. **Your** has a corresponding meaning.
|
||||
|
||||
### Section 2 – Scope
|
||||
|
||||
1. **License grant**
|
||||
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||
1. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial and ArmaOnly purposes only; and
|
||||
2. produce, reproduce, and Share Adapted Material for NonCommercial and ArmaOnly purposes only.
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||
3. Term. The term of this Public License is specified in Section 6(a).
|
||||
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||
5. Downstream recipients.
|
||||
1. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||
2. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
|
||||
3. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(a)(i).
|
||||
2. **Other rights**
|
||||
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
2. Patent and trademark rights are not licensed under this Public License.
|
||||
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial and ArmaOnly purposes.
|
||||
|
||||
### Section 3 – License Conditions
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
||||
|
||||
1. **Attribution**
|
||||
1. If You Share the Licensed Material (including in modified form), You must:
|
||||
1. retain the following if it is supplied by the Licensor with the Licensed Material:
|
||||
1. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
||||
2. a copyright notice;
|
||||
3. a notice that refers to this Public License;
|
||||
4. a notice that refers to the disclaimer of warranties;
|
||||
5. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||
2. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
||||
3. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
||||
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(a) to the extent reasonably practicable.
|
||||
2. **ShareAlike**
|
||||
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
|
||||
1. The Adapter’s License You apply must be this Public License, or an Arma Public Share Alike Compatible License.
|
||||
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
|
||||
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
|
||||
|
||||
### Section 4 – Sui Generis Database Rights
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
||||
|
||||
1. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial and ArmaOnly purposes only;
|
||||
2. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
|
||||
3. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
||||
|
||||
### Section 5 – Disclaimer of Warranties and Limitation of Liability
|
||||
|
||||
1. **Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.**
|
||||
2. **To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.**
|
||||
3. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
### Section 6 – Term and Termination
|
||||
|
||||
1. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
||||
2. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
||||
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
||||
2. upon express reinstatement by the Licensor.
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
||||
3. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
||||
4. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
### Section 7 – Other Terms and Conditions
|
||||
|
||||
1. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
||||
2. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
||||
|
||||
### Section 8 – Interpretation
|
||||
|
||||
1. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
||||
2. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
||||
3. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
||||
4. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
||||
|
||||
### Bohemia Interactive Notices
|
||||
|
||||
1. Bohemia Interactive a.s. is not a party to this License, and makes no warranty whatsoever in connection with the Licensed Material. Bohemia Interactive a.s. will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, Bohemia Interactive a.s. may elect to apply the Public License to material it publishes and in those instances it becomes the "Licensor".
|
||||
2. Except for the limited purpose of indicating to the public that the Licensed Material is shared under this Public License, Bohemia Interactive a.s. does not authorize the use by either party of the trademarks "Arma", "Bohemia Interactive" or any related trademark or logo of Arma or Bohemia Interactive without the prior written consent of Bohemia Interactive a.s.
|
||||
19
arma/mod/README.md
Normal file
19
arma/mod/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# FORGE Shared Mod
|
||||
|
||||
Shared client/server config classes for FORGE missions. This HEMTT project
|
||||
builds to `@forge_mod`.
|
||||
|
||||
Load `@forge_mod` on both clients and servers. Server runtime systems remain in
|
||||
`@forge_server`, and player-facing UI remains in `@forge_client`.
|
||||
|
||||
## Addons
|
||||
|
||||
- `forge_mod_common`: shared vehicle/config definitions, including
|
||||
`forge_bodyBag`.
|
||||
- `forge_mod_task`: Forge Eden task module classes used by missions. The module
|
||||
config points at server-side task functions, but those functions are still
|
||||
provided by `@forge_server`.
|
||||
|
||||
Mission `requiredAddons` should reference `forge_mod_*` packages for shared
|
||||
classes. Clients should never need `@forge_server` just to load or edit a Forge
|
||||
mission.
|
||||
1
arma/mod/addons/common/$PBOPREFIX$
Normal file
1
arma/mod/addons/common/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
forge\forge_mod\addons\common
|
||||
20
arma/mod/addons/common/config.cpp
Normal file
20
arma/mod/addons/common/config.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
author = AUTHOR;
|
||||
authors[] = {"IDSolutions"};
|
||||
url = "https://github.com/IDSolutions/MOD_REPO";
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_mod_main",
|
||||
"A3_Characters_F"
|
||||
};
|
||||
units[] = {"forge_bodyBag"};
|
||||
weapons[] = {};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgVehicles.hpp"
|
||||
4
arma/mod/addons/common/script_component.hpp
Normal file
4
arma/mod/addons/common/script_component.hpp
Normal file
@ -0,0 +1,4 @@
|
||||
#define COMPONENT common
|
||||
#define COMPONENT_BEAUTIFIED Common
|
||||
#include "\forge\forge_mod\addons\main\script_mod.hpp"
|
||||
#include "\forge\forge_mod\addons\main\script_macros.hpp"
|
||||
1
arma/mod/addons/main/$PBOPREFIX$
Normal file
1
arma/mod/addons/main/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
forge\forge_mod\addons\main
|
||||
15
arma/mod/addons/main/config.cpp
Normal file
15
arma/mod/addons/main/config.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
author = AUTHOR;
|
||||
authors[] = {"J.Schmidt"};
|
||||
url = "https://github.com/IDSolutions/MOD_REPO";
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"cba_main"};
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
4
arma/mod/addons/main/script_component.hpp
Normal file
4
arma/mod/addons/main/script_component.hpp
Normal file
@ -0,0 +1,4 @@
|
||||
#define COMPONENT main
|
||||
#define COMPONENT_BEAUTIFIED Main
|
||||
#include "script_mod.hpp"
|
||||
#include "script_macros.hpp"
|
||||
8
arma/mod/addons/main/script_macros.hpp
Normal file
8
arma/mod/addons/main/script_macros.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#define QUOTE(var1) #var1
|
||||
#define DOUBLES(var1,var2) var1##_##var2
|
||||
#define TRIPLES(var1,var2,var3) DOUBLES(DOUBLES(var1,var2),var3)
|
||||
|
||||
#define ADDON DOUBLES(PREFIX,COMPONENT)
|
||||
#define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION_STR); versionAr[] = {VERSION_AR}
|
||||
|
||||
#define SERVER_TASK_FUNC(var1) QUOTE(TRIPLES(DOUBLES(forge_server,task),fnc,var1))
|
||||
18
arma/mod/addons/main/script_mod.hpp
Normal file
18
arma/mod/addons/main/script_mod.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
#define MAINPREFIX forge
|
||||
#define PREFIX forge_mod
|
||||
#define MOD_NAME forge-mod
|
||||
#define AUTHOR "J.Schmidt"
|
||||
|
||||
#define REQUIRED_VERSION 2.20
|
||||
|
||||
#include "script_version.hpp"
|
||||
|
||||
#define VERSION MAJOR.MINOR
|
||||
#define VERSION_STR MAJOR.MINOR.PATCH.BUILD
|
||||
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD
|
||||
|
||||
#ifndef COMPONENT_BEAUTIFIED
|
||||
#define COMPONENT_BEAUTIFIED COMPONENT
|
||||
#endif
|
||||
|
||||
#define COMPONENT_NAME QUOTE(MOD_NAME - COMPONENT_BEAUTIFIED)
|
||||
4
arma/mod/addons/main/script_version.hpp
Normal file
4
arma/mod/addons/main/script_version.hpp
Normal file
@ -0,0 +1,4 @@
|
||||
#define MAJOR 1
|
||||
#define MINOR 0
|
||||
#define PATCH 0
|
||||
#define BUILD 0
|
||||
1
arma/mod/addons/task/$PBOPREFIX$
Normal file
1
arma/mod/addons/task/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
forge\forge_mod\addons\task
|
||||
@ -14,7 +14,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(attackModule);
|
||||
function = SERVER_TASK_FUNC(attackModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -127,7 +127,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(explosivesModule);
|
||||
function = SERVER_TASK_FUNC(explosivesModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -164,7 +164,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(hostagesModule);
|
||||
function = SERVER_TASK_FUNC(hostagesModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -201,7 +201,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(shootersModule);
|
||||
function = SERVER_TASK_FUNC(shootersModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -238,7 +238,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(protectedModule);
|
||||
function = SERVER_TASK_FUNC(protectedModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -274,7 +274,7 @@ class CfgVehicles {
|
||||
displayName = "Defend Task";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(defendModule);
|
||||
function = SERVER_TASK_FUNC(defendModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -399,7 +399,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(defuseModule);
|
||||
function = SERVER_TASK_FUNC(defuseModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -512,7 +512,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(destroyModule);
|
||||
function = SERVER_TASK_FUNC(destroyModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -625,7 +625,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(hostageModule);
|
||||
function = SERVER_TASK_FUNC(hostageModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -775,7 +775,7 @@ class CfgVehicles {
|
||||
displayName = "Delivery Task";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(deliveryModule);
|
||||
function = SERVER_TASK_FUNC(deliveryModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
@ -892,7 +892,7 @@ class CfgVehicles {
|
||||
displayName = "Cargo Entities";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(cargoModule);
|
||||
function = SERVER_TASK_FUNC(cargoModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -928,7 +928,7 @@ class CfgVehicles {
|
||||
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
|
||||
category = "FORGE_Modules";
|
||||
|
||||
function = QFUNC(hvtModule);
|
||||
function = SERVER_TASK_FUNC(hvtModule);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 1;
|
||||
34
arma/mod/addons/task/config.cpp
Normal file
34
arma/mod/addons/task/config.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
author = AUTHOR;
|
||||
authors[] = {"J.Schmidt"};
|
||||
url = "https://github.com/IDSolutions/MOD_REPO";
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_mod_main",
|
||||
"A3_Modules_F"
|
||||
};
|
||||
units[] = {
|
||||
"FORGE_Module_Attack",
|
||||
"FORGE_Module_Explosives",
|
||||
"FORGE_Module_Hostages",
|
||||
"FORGE_Module_Shooters",
|
||||
"FORGE_Module_Protected",
|
||||
"FORGE_Module_Defend",
|
||||
"FORGE_Module_Defuse",
|
||||
"FORGE_Module_Destroy",
|
||||
"FORGE_Module_Hostage",
|
||||
"FORGE_Module_Delivery",
|
||||
"FORGE_Module_Cargo",
|
||||
"FORGE_Module_HVT"
|
||||
};
|
||||
weapons[] = {};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgFactionClasses.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
44
arma/mod/addons/task/script_component.hpp
Normal file
44
arma/mod/addons/task/script_component.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
#define COMPONENT task
|
||||
#define COMPONENT_BEAUTIFIED Task
|
||||
#include "\forge\forge_mod\addons\main\script_mod.hpp"
|
||||
#include "\forge\forge_mod\addons\main\script_macros.hpp"
|
||||
|
||||
#define REWARD_ARRAY_ATTRIBUTES(PREFIX) \
|
||||
class EquipmentRewards: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,EquipmentRewards)); \
|
||||
displayName = "Equipment Rewards"; \
|
||||
tooltip = "Comma-separated equipment class names, e.g. ItemGPS, ItemCompass. Legacy SQF arrays still work."; \
|
||||
typeName = "STRING"; \
|
||||
}; \
|
||||
class SupplyRewards: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,SupplyRewards)); \
|
||||
displayName = "Supply Rewards"; \
|
||||
tooltip = "Comma-separated supply class names, e.g. FirstAidKit, Medikit. Legacy SQF arrays still work."; \
|
||||
typeName = "STRING"; \
|
||||
}; \
|
||||
class WeaponRewards: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,WeaponRewards)); \
|
||||
displayName = "Weapon Rewards"; \
|
||||
tooltip = "Comma-separated weapon class names, e.g. arifle_MX_F, arifle_Katiba_F. Legacy SQF arrays still work."; \
|
||||
typeName = "STRING"; \
|
||||
}; \
|
||||
class VehicleRewards: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,VehicleRewards)); \
|
||||
displayName = "Vehicle Rewards"; \
|
||||
tooltip = "Comma-separated vehicle class names, e.g. B_MRAP_01_F, B_Quadbike_01_F. Legacy SQF arrays still work."; \
|
||||
typeName = "STRING"; \
|
||||
}; \
|
||||
class SpecialRewards: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,SpecialRewards)); \
|
||||
displayName = "Special Rewards"; \
|
||||
tooltip = "Comma-separated special reward class names, e.g. B_UAV_01_F, B_Heli_Light_01_F. Legacy SQF arrays still work."; \
|
||||
typeName = "STRING"; \
|
||||
};
|
||||
|
||||
#define TASK_CHAIN_ATTRIBUTES(PREFIX) \
|
||||
class PrerequisiteTaskIds: Edit { \
|
||||
property = QUOTE(DOUBLES(PREFIX,PrerequisiteTaskIds)); \
|
||||
displayName = "Prerequisite Task IDs"; \
|
||||
tooltip = "Comma-separated task IDs that must succeed before this task appears in CAD or can be assigned"; \
|
||||
typeName = "STRING"; \
|
||||
};
|
||||
BIN
arma/mod/icon_128_ca.paa
Normal file
BIN
arma/mod/icon_128_ca.paa
Normal file
Binary file not shown.
BIN
arma/mod/icon_128_highlight_ca.paa
Normal file
BIN
arma/mod/icon_128_highlight_ca.paa
Normal file
Binary file not shown.
BIN
arma/mod/icon_64_ca.paa
Normal file
BIN
arma/mod/icon_64_ca.paa
Normal file
Binary file not shown.
4
arma/mod/meta.cpp
Normal file
4
arma/mod/meta.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
protocol = 1;
|
||||
publishedid = 0;
|
||||
name = "forge-mod";
|
||||
timestamp = 5250140732737923549;
|
||||
15
arma/mod/mod.cpp
Normal file
15
arma/mod/mod.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
dir = "@forge_mod";
|
||||
author = "J.Schmidt";
|
||||
name = "Forge Mod";
|
||||
description = "Forge Shared Mod - Version 1.0.0";
|
||||
overview = "";
|
||||
overviewPicture = "title_ca.paa";
|
||||
picture = "title_ca.paa";
|
||||
logoSmall = "icon_64_ca.paa";
|
||||
logo = "icon_128_ca.paa";
|
||||
logoOver = "icon_128_highlight_ca.paa";
|
||||
tooltip = "Forge Mod";
|
||||
tooltipOwned = "IDS Owned";
|
||||
action = "https://innovativedevsolutions.org";
|
||||
actionName = "Website";
|
||||
dlcColor[] = {0.45, 0.47, 0.41, 1};
|
||||
BIN
arma/mod/title_ca.paa
Normal file
BIN
arma/mod/title_ca.paa
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(BankAccountCreatedEventTokens)) then {
|
||||
private _welcomeNewActor = {
|
||||
params ["_event"];
|
||||
|
||||
@ -105,11 +105,13 @@ GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(ActorBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(ActorBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "ActorBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "Actor Store Initialized!"] call EFUNC(common,log);
|
||||
true
|
||||
}],
|
||||
["cacheActor", compileFinal {
|
||||
params [["_uid", "", [""]], ["_actor", createHashMap, [createHashMap]]];
|
||||
@ -561,7 +563,13 @@ GVAR(ActorBaseStore) = compileFinal createHashMapFromArray [
|
||||
|
||||
_self call ["override", [_uid, _finalActor, false]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(ActorStore) = createHashMapObject [GVAR(ActorBaseStore)];
|
||||
GVAR(ActorStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(ActorStore) = createHashMapObject [GVAR(ActorBaseStore), []];
|
||||
true
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
call FUNC(initBank);
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(AccountSyncEventTokens)) then {
|
||||
private _sendAccountSync = {
|
||||
params ["_event"];
|
||||
|
||||
@ -14,11 +14,13 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(BankBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(BankBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "BankBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "Bank Store Initialized!"] call EFUNC(common,log);
|
||||
true
|
||||
}],
|
||||
["normalizeAccount", compileFinal {
|
||||
params [["_uid", "", [""]], ["_account", createHashMap, [createHashMap]], ["_playerName", "", [""]]];
|
||||
@ -571,7 +573,13 @@ GVAR(BankBaseStore) = compileFinal createHashMapFromArray [
|
||||
]
|
||||
]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(BankStore) = createHashMapObject [GVAR(BankBaseStore)];
|
||||
GVAR(BankStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(BankStore) = createHashMapObject [GVAR(BankBaseStore), []];
|
||||
true
|
||||
|
||||
@ -91,20 +91,19 @@ call FUNC(registerEventListeners);
|
||||
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
|
||||
};
|
||||
|
||||
if (isNil "forge_pmc_fnc_requestMissionTask") exitWith {
|
||||
_result set ["message", "This mission does not expose dispatcher-generated tasks."];
|
||||
if (isNil QEFUNC(task,requestMissionTask)) exitWith {
|
||||
_result set ["message", "Framework generated mission requests are unavailable."];
|
||||
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
|
||||
};
|
||||
|
||||
// Temporary mission-owned integration point. This keeps simulator-specific
|
||||
// generator logic in the mission until CAD/task grows a framework-level
|
||||
// on-demand generation interface.
|
||||
_result = [_taskType, _metadata, _uid] call forge_pmc_fnc_requestMissionTask;
|
||||
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
|
||||
_result = [_taskType, _metadata, _uid] call EFUNC(task,requestMissionTask);
|
||||
|
||||
if (_result getOrDefault ["success", false]) then {
|
||||
[CRPC(cad,invalidateCadState), []] call CFUNC(globalEvent);
|
||||
if !(_result getOrDefault ["success", false]) exitWith {
|
||||
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
|
||||
};
|
||||
|
||||
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
|
||||
[CRPC(cad,invalidateCadState), []] call CFUNC(globalEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSubmitCadSupportRequest), {
|
||||
|
||||
@ -299,6 +299,33 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
private _permissionService = _self get "PermissionService";
|
||||
private _groupRepository = _self get "GroupRepository";
|
||||
private _generatedTaskTypes = [];
|
||||
if (missionNamespace getVariable [QEGVAR(task,enableGenerator), false]) then {
|
||||
_generatedTaskTypes = [
|
||||
createHashMapFromArray [["value", "attack"], ["label", "Attack"]],
|
||||
createHashMapFromArray [["value", "defend"], ["label", "Defend"]],
|
||||
createHashMapFromArray [["value", "defuse"], ["label", "Defuse"]],
|
||||
createHashMapFromArray [["value", "delivery"], ["label", "Delivery"]],
|
||||
createHashMapFromArray [["value", "destroy"], ["label", "Destroy"]],
|
||||
createHashMapFromArray [["value", "hostage"], ["label", "Hostage"]],
|
||||
createHashMapFromArray [["value", "hvtkill"], ["label", "Kill HVT"]],
|
||||
createHashMapFromArray [["value", "hvtcapture"], ["label", "Capture HVT"]]
|
||||
];
|
||||
["INFO", "CAD hydrate using framework generator fallback type list while checking task mission manager."] call EFUNC(common,log);
|
||||
|
||||
if (isNil QEGVAR(task,MissionManager) && { !(isNil QEFUNC(task,missionManager)) }) then {
|
||||
call EFUNC(task,missionManager);
|
||||
};
|
||||
|
||||
if !(isNil QEGVAR(task,MissionManager)) then {
|
||||
_generatedTaskTypes = EGVAR(task,MissionManager) call ["getGeneratedTaskTypes", []];
|
||||
["INFO", format ["CAD hydrate using task mission manager generated types: %1", _generatedTaskTypes apply { _x getOrDefault ["value", ""] }]] call EFUNC(common,log);
|
||||
} else {
|
||||
["INFO", "CAD hydrate task mission manager is not ready; sending fallback generated task types."] call EFUNC(common,log);
|
||||
};
|
||||
} else {
|
||||
["INFO", "CAD hydrate generated task types disabled by forge_server_task_enableGenerator."] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
private _groupID = _groupRepository call ["getPlayerGroupId", [_uid]];
|
||||
private _session = createHashMapFromArray [
|
||||
@ -311,6 +338,7 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _seed = createHashMapFromArray [
|
||||
["groups", _groupRepository call ["buildGroups", []]],
|
||||
["activeTasks", EGVAR(task,TaskStore) call ["getActiveTaskCatalog", []]],
|
||||
["generatedTaskTypes", _generatedTaskTypes],
|
||||
["session", _session]
|
||||
];
|
||||
private _emptyPayload = createHashMapFromArray [
|
||||
@ -319,6 +347,7 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
||||
["requests", []],
|
||||
["assignments", []],
|
||||
["activity", []],
|
||||
["generatedTaskTypes", _generatedTaskTypes],
|
||||
["session", _session]
|
||||
];
|
||||
private _persistenceService = _self getOrDefault ["PersistenceService", createHashMap];
|
||||
@ -330,7 +359,9 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
private _hydrateResult = _persistenceService call ["buildHydratePayload", [_seed]];
|
||||
if (_hydrateResult getOrDefault ["success", false]) exitWith {
|
||||
_hydrateResult getOrDefault ["data", createHashMap]
|
||||
private _data = _hydrateResult getOrDefault ["data", createHashMap];
|
||||
_data set ["generatedTaskTypes", _generatedTaskTypes];
|
||||
_data
|
||||
};
|
||||
|
||||
["WARNING", "CAD hydrate failed in the extension; returning seed-only payload."] call EFUNC(common,log);
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
class CfgVehicles {
|
||||
class Land_Bodybag_01_black_F;
|
||||
class forge_bodyBag: Land_Bodybag_01_black_F {
|
||||
maximumLoad = 2000;
|
||||
transportMaxWeapons = 500;
|
||||
transportMaxMagazines = 2000;
|
||||
transportMaxItems = 1000;
|
||||
ace_dragging_canCarry = 1;
|
||||
ace_dragging_carryPosition[] = {0, 0.5, 1.2};
|
||||
ace_dragging_carryDirection = 90;
|
||||
};
|
||||
};
|
||||
@ -6,7 +6,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
||||
|
||||
if (isNil QGVAR(EventBus)) then { call FUNC(eventBus); };
|
||||
if (isNil QGVAR(EventBus)) then { call FUNC(eventBus); true };
|
||||
if (isNil QGVAR(NotificationEventTokens)) then {
|
||||
private _sendNotification = {
|
||||
params ["_event"];
|
||||
|
||||
@ -8,7 +8,8 @@ class CfgPatches {
|
||||
name = COMPONENT_NAME;
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_server_main"
|
||||
"forge_server_main",
|
||||
"forge_mod_common"
|
||||
};
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
@ -18,4 +19,3 @@ class CfgPatches {
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
@ -37,8 +37,14 @@ if (_stackTrace) then {
|
||||
|
||||
// private _timestamp = format (["%1-%2-%3 %4:%5:%6:%7"] + systemTimeUTC);
|
||||
|
||||
if (isNil "_file") then { _file = ["", _fnc_scriptName] select (!isNil "_fnc_scriptName"); };
|
||||
if (isNil "_callingFile" && !isNil "_fnc_scriptNameParent") then { _callingFile = _fnc_scriptNameParent; };
|
||||
if (isNil "_file") then {
|
||||
_file = "";
|
||||
if (!isNil "_fnc_scriptName") then {
|
||||
_file = _fnc_scriptName;
|
||||
};
|
||||
};
|
||||
|
||||
if (isNil "_callingFile" && {!isNil "_fnc_scriptNameParent"}) then { _callingFile = _fnc_scriptNameParent; };
|
||||
|
||||
// private _callingFileText = if !(isNil "_callingFile") then { format ["Called By: %1", _callingFile] } else { "" };
|
||||
|
||||
|
||||
@ -6,9 +6,9 @@ PREP_RECOMPILE_END;
|
||||
|
||||
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
||||
|
||||
if (isNil QGVAR(MEconomyStore)) then { call FUNC(initMEconomyStore); };
|
||||
if (isNil QGVAR(FEconomyStore)) then { call FUNC(initFEconomyStore); };
|
||||
if (isNil QGVAR(SEconomyStore)) then { call FUNC(initSEconomyStore); };
|
||||
if (isNil QGVAR(MEconomyStore)) then { call FUNC(initMEconomyStore); true };
|
||||
if (isNil QGVAR(FEconomyStore)) then { call FUNC(initFEconomyStore); true };
|
||||
if (isNil QGVAR(SEconomyStore)) then { call FUNC(initSEconomyStore); true };
|
||||
|
||||
[QGVAR(FuelStart), {
|
||||
params ["_source", "_target", "_unit"];
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
call FUNC(initGarage);
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(SyncEventTokens)) then {
|
||||
private _sendVGarageSync = {
|
||||
params ["_event"];
|
||||
|
||||
@ -22,13 +22,15 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(GarageBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(GarageBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "GarageBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "Garage Store Initialized!"] call EFUNC(common,log);
|
||||
_self set ["lastCallSucceeded", false];
|
||||
_self set ["lastError", ""];
|
||||
true
|
||||
}],
|
||||
["callHotGarage", compileFinal {
|
||||
params [["_function", "", [""]], ["_arguments", [], [[]]]];
|
||||
@ -114,7 +116,13 @@ GVAR(GarageBaseStore) = compileFinal createHashMapFromArray [
|
||||
if (_uid isEqualTo "" || { _payloadJson isEqualTo "" }) exitWith { createHashMap };
|
||||
_self call ["callHotGarage", ["garage:hot:remove_vehicle", [_uid, _payloadJson]]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(GarageStore) = createHashMapObject [GVAR(GarageBaseStore)];
|
||||
GVAR(GarageStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(GarageStore) = createHashMapObject [GVAR(GarageBaseStore), []];
|
||||
true
|
||||
|
||||
@ -38,11 +38,13 @@ GVAR(VGarageModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VGBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(VGBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "VGBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "VGarage Store Initialized!"] call EFUNC(common,log);
|
||||
true
|
||||
}],
|
||||
["callHotVGarage", compileFinal {
|
||||
params [["_function", "", [""]], ["_arguments", [], [[]]]];
|
||||
@ -90,7 +92,13 @@ GVAR(VGBaseStore) = compileFinal createHashMapFromArray [
|
||||
if (_uid isEqualTo "") exitWith { createHashMap };
|
||||
_self call ["callHotVGarage", ["owned:garage:hot:save", [_uid]]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(VGarageStore) = createHashMapObject [GVAR(VGBaseStore)];
|
||||
GVAR(VGarageStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(VGarageStore) = createHashMapObject [GVAR(VGBaseStore), []];
|
||||
true
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
call FUNC(initLocker);
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(SyncEventTokens)) then {
|
||||
private _sendLockerSync = {
|
||||
params ["_event"];
|
||||
|
||||
@ -22,11 +22,13 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(LockerBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(LockerBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "LockerBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "Locker Store Initialized!"] call EFUNC(common,log);
|
||||
true
|
||||
}],
|
||||
["callHotLocker", compileFinal {
|
||||
params [["_function", "", [""]], ["_arguments", [], [[]]]];
|
||||
@ -92,7 +94,13 @@ GVAR(LockerBaseStore) = compileFinal createHashMapFromArray [
|
||||
if (_uid isEqualTo "") exitWith { createHashMap };
|
||||
_self call ["callHotLocker", ["locker:hot:save", [_uid]]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(LockerStore) = createHashMapObject [GVAR(LockerBaseStore)];
|
||||
GVAR(LockerStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(LockerStore) = createHashMapObject [GVAR(LockerBaseStore), []];
|
||||
true
|
||||
|
||||
@ -36,11 +36,13 @@ GVAR(VArsenalModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VABaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(VABaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "VABaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "VArsenal Store Initialized!"] call EFUNC(common,log);
|
||||
true
|
||||
}],
|
||||
["callHotVArsenal", compileFinal {
|
||||
params [["_function", "", [""]], ["_arguments", [], [[]]]];
|
||||
@ -88,7 +90,13 @@ GVAR(VABaseStore) = compileFinal createHashMapFromArray [
|
||||
if (_uid isEqualTo "") exitWith { createHashMap };
|
||||
_self call ["callHotVArsenal", ["owned:locker:hot:save", [_uid]]]
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(VAStore) = createHashMapObject [GVAR(VABaseStore)];
|
||||
GVAR(VAStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(VAStore) = createHashMapObject [GVAR(VABaseStore), []];
|
||||
true
|
||||
|
||||
@ -6,6 +6,8 @@ PREP_RECOMPILE_END;
|
||||
|
||||
GVAR(PlayerBootstrapRegistry) = createHashMap;
|
||||
|
||||
if (isServer) then { "forge_server" callExtension ["surreal:reconnect", []]; };
|
||||
|
||||
["forge_icom_event", {
|
||||
params [["_event", "", [""]], ["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
|
||||
@ -17,37 +17,37 @@
|
||||
*/
|
||||
|
||||
// Base
|
||||
if (isNil QEGVAR(common,BaseStore)) then { call EFUNC(common,baseStore); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,BaseStore)) then { call EFUNC(common,baseStore); true };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
|
||||
// Actor
|
||||
if (isNil QEGVAR(actor,ActorStore)) then { call EFUNC(actor,initActorStore); };
|
||||
if (isNil QEGVAR(actor,ActorStore)) then { call EFUNC(actor,initActorStore); true };
|
||||
|
||||
// Bank
|
||||
if (isNil QEGVAR(bank,BankSessionManager)) then { call EFUNC(bank,initSessionManager); };
|
||||
if (isNil QEGVAR(bank,BankMessenger)) then { call EFUNC(bank,initMessenger); };
|
||||
if (isNil QEGVAR(bank,BankModel)) then { call EFUNC(bank,initModel); };
|
||||
if (isNil QEGVAR(bank,BankPayloadBuilder)) then { call EFUNC(bank,initPayloadBuilder); };
|
||||
if (isNil QEGVAR(bank,BankStore)) then { call EFUNC(bank,initBankStore); };
|
||||
if (isNil QEGVAR(bank,BankSessionManager)) then { call EFUNC(bank,initSessionManager); true };
|
||||
if (isNil QEGVAR(bank,BankMessenger)) then { call EFUNC(bank,initMessenger); true };
|
||||
if (isNil QEGVAR(bank,BankModel)) then { call EFUNC(bank,initModel); true };
|
||||
if (isNil QEGVAR(bank,BankPayloadBuilder)) then { call EFUNC(bank,initPayloadBuilder); true };
|
||||
if (isNil QEGVAR(bank,BankStore)) then { call EFUNC(bank,initBankStore); true };
|
||||
|
||||
// Garage
|
||||
if (isNil QEGVAR(garage,GarageStore)) then { call EFUNC(garage,initGarageStore); };
|
||||
if (isNil QEGVAR(garage,GarageStore)) then { call EFUNC(garage,initGarageStore); true };
|
||||
|
||||
// VGarage
|
||||
if (isNil QEGVAR(garage,VGarageStore)) then { call EFUNC(garage,initVGStore); };
|
||||
if (isNil QEGVAR(garage,VGarageStore)) then { call EFUNC(garage,initVGStore); true };
|
||||
|
||||
// Locker
|
||||
if (isNil QEGVAR(locker,LockerStore)) then { call EFUNC(locker,initLockerStore); };
|
||||
if (isNil QEGVAR(locker,LockerStore)) then { call EFUNC(locker,initLockerStore); true };
|
||||
|
||||
// VArsenal
|
||||
if (isNil QEGVAR(locker,VAStore)) then { call EFUNC(locker,initVAStore); };
|
||||
if (isNil QEGVAR(locker,VAStore)) then { call EFUNC(locker,initVAStore); true };
|
||||
|
||||
// Org
|
||||
if (isNil QEGVAR(org,OrgPayloadBuilder)) then { call EFUNC(org,initPayloadBuilder); };
|
||||
if (isNil QEGVAR(org,OrgStore)) then { call EFUNC(org,initOrgStore); };
|
||||
if (isNil QEGVAR(org,OrgPayloadBuilder)) then { call EFUNC(org,initPayloadBuilder); true };
|
||||
if (isNil QEGVAR(org,OrgStore)) then { call EFUNC(org,initOrgStore); true };
|
||||
|
||||
// Store
|
||||
if (isNil QEGVAR(store,StorefrontStore)) then { call EFUNC(store,initStorefrontStore); };
|
||||
if (isNil QEGVAR(store,StorefrontStore)) then { call EFUNC(store,initStorefrontStore); true };
|
||||
|
||||
// Validation Harness
|
||||
if (isNil QGVAR(ValidationHarness)) then { call FUNC(initValidationHarness); };
|
||||
if (isNil QGVAR(ValidationHarness)) then { call FUNC(initValidationHarness); true };
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
|
||||
#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
|
||||
#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETMPVAR(var1,var2) missionNamespace SETPVAR_SYS(var1,var2)
|
||||
#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2)
|
||||
#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(SyncEventTokens)) then {
|
||||
private _sendOrgSync = {
|
||||
params ["_event"];
|
||||
|
||||
@ -148,8 +148,9 @@ GVAR(OrgModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(OrgBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
GVAR(OrgBaseStore) = compileFinal ([
|
||||
EGVAR(common,BaseStore),
|
||||
createHashMapFromArray [
|
||||
["#type", "OrgBaseStore"],
|
||||
["#create", compileFinal {
|
||||
["INFO", "Org Store Initialized!"] call EFUNC(common,log);
|
||||
@ -157,20 +158,7 @@ GVAR(OrgBaseStore) = compileFinal createHashMapFromArray [
|
||||
["org:exists", ["default"]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
if !(_isSuccess) exitWith {
|
||||
["ERROR", "Failed to check for default org!"] call EFUNC(common,log);
|
||||
|
||||
private _defaultOrg = createHashMapFromArray [
|
||||
["id", "default"],
|
||||
["owner", "server"],
|
||||
["name", "Forge Dynamics"],
|
||||
["funds", 200000],
|
||||
["reputation", 0],
|
||||
["credit_lines", createHashMap],
|
||||
["assets", createHashMap],
|
||||
["fleet", createHashMap],
|
||||
["members", createHashMap],
|
||||
["pending_invites", createHashMap]
|
||||
];
|
||||
_defaultOrg
|
||||
true
|
||||
};
|
||||
|
||||
if (_result != "true") then {
|
||||
@ -207,7 +195,7 @@ GVAR(OrgBaseStore) = compileFinal createHashMapFromArray [
|
||||
];
|
||||
};
|
||||
|
||||
_loadedDefaultOrg
|
||||
true
|
||||
}],
|
||||
["callHotOrg", compileFinal {
|
||||
params [["_function", "", [""]], ["_arguments", [], [[]]]];
|
||||
@ -1363,7 +1351,13 @@ GVAR(OrgBaseStore) = compileFinal createHashMapFromArray [
|
||||
|
||||
_finalOrg
|
||||
}]
|
||||
];
|
||||
]] call {
|
||||
params ["_base", "_child"];
|
||||
|
||||
GVAR(OrgStore) = createHashMapObject [GVAR(OrgBaseStore)];
|
||||
GVAR(OrgStore)
|
||||
private _merged = +_base;
|
||||
{ _merged set [_x, _y]; } forEach _child;
|
||||
_merged
|
||||
});
|
||||
|
||||
GVAR(OrgStore) = createHashMapObject [GVAR(OrgBaseStore), []];
|
||||
true
|
||||
|
||||
@ -6,7 +6,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
||||
|
||||
if (isNil QGVAR(PhoneStore)) then { [] call FUNC(initPhoneStore); };
|
||||
if (isNil QGVAR(PhoneStore)) then { [] call FUNC(initPhoneStore); true };
|
||||
|
||||
// Contact Management Events
|
||||
[QGVAR(requestInitPhone), {
|
||||
|
||||
@ -1,167 +1,68 @@
|
||||
// TODO: Move to mission template and provide documentation
|
||||
/*
|
||||
* PMC simulator dynamic mission configuration.
|
||||
*
|
||||
* This file is read by the mission setup UI, the mission manager, and the
|
||||
* mission generators under functions\missionGenerators.
|
||||
*
|
||||
* Startup UI behavior:
|
||||
* - Arma mission params/defaults provide the startup setup UI defaults.
|
||||
* - If the setup UI is cancelled, those same params/defaults are applied.
|
||||
* - If the setup UI is submitted, UI values override compatible ranges.
|
||||
*
|
||||
* Generator behavior:
|
||||
* - maxConcurrentMissions and missionInterval are copied into
|
||||
* forge_server_task_missionSetup_settings by the framework mission setup service.
|
||||
* - Reward, reputation, penalty, and timeLimit ranges are read through
|
||||
* forge_server_task_fnc_getMissionSettingRange so UI overrides and config fallbacks
|
||||
* use the same path.
|
||||
*/
|
||||
class CfgMissions {
|
||||
// Global settings
|
||||
// Maximum number of generated missions allowed to be active at once.
|
||||
maxConcurrentMissions = 3;
|
||||
missionInterval = 300; // 5 minutes between mission generation
|
||||
|
||||
// Mission type weights
|
||||
|
||||
// Seconds between mission generation attempts.
|
||||
missionInterval = 300;
|
||||
|
||||
// Seconds before a generated mission location can be reused.
|
||||
locationReuseCooldown = 900;
|
||||
|
||||
// Enemy faction selection is ultimately exported to ENEMY_FACTION_STR and
|
||||
// ENEMY_SIDE for server-side generators.
|
||||
class EnemyFactionConfig {
|
||||
// Mission param key used by fallback/default setup application.
|
||||
enemyFactionParam = "enemyFaction";
|
||||
};
|
||||
|
||||
// Relative generation weights. The values do not need to add to 1; the
|
||||
// mission manager treats them as weighted proportions.
|
||||
class MissionWeights {
|
||||
attack = 0.2;
|
||||
defend = 0.2;
|
||||
hostage = 0.2;
|
||||
hvt = 0.15;
|
||||
hvtkill = 0.15;
|
||||
hvtcapture = 0.15;
|
||||
defuse = 0.15;
|
||||
delivery = 0.1;
|
||||
destroy = 0.2;
|
||||
};
|
||||
|
||||
// Mission locations
|
||||
class Locations {
|
||||
class CityOne {
|
||||
position[] = {1000, 1000, 0};
|
||||
type = "city";
|
||||
radius = 300;
|
||||
suitable[] = {"attack", "defend", "hostage"};
|
||||
};
|
||||
class MilitaryBase {
|
||||
position[] = {2000, 2000, 0};
|
||||
type = "military";
|
||||
radius = 500;
|
||||
suitable[] = {"hvt", "defend", "attack"};
|
||||
};
|
||||
class Industrial {
|
||||
position[] = {3000, 3000, 0};
|
||||
type = "industrial";
|
||||
radius = 200;
|
||||
suitable[] = {"delivery", "defuse"};
|
||||
};
|
||||
};
|
||||
|
||||
// AI Groups configuration
|
||||
class AIGroups {
|
||||
class Infantry {
|
||||
side = "EAST";
|
||||
class Units {
|
||||
class Unit0 {
|
||||
vehicle = "O_Soldier_TL_F";
|
||||
rank = "SERGEANT";
|
||||
position[] = {0, 0, 0};
|
||||
};
|
||||
class Unit1 {
|
||||
vehicle = "O_Soldier_AR_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {5, -5, 0};
|
||||
};
|
||||
class Unit2 {
|
||||
vehicle = "O_Soldier_LAT_F";
|
||||
rank = "PRIVATE";
|
||||
position[] = {-5, -5, 0};
|
||||
};
|
||||
};
|
||||
suitable[] = {"attack", "defend", "hostage"};
|
||||
};
|
||||
class Assault {
|
||||
side = "EAST";
|
||||
class Units {
|
||||
class Unit0 {
|
||||
vehicle = "O_Soldier_SL_F";
|
||||
rank = "SERGEANT";
|
||||
position[] = {0, 0, 0};
|
||||
};
|
||||
class Unit1 {
|
||||
vehicle = "O_Soldier_GL_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {4, -3, 0};
|
||||
};
|
||||
class Unit2 {
|
||||
vehicle = "O_Soldier_AR_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {-4, -3, 0};
|
||||
};
|
||||
class Unit3 {
|
||||
vehicle = "O_medic_F";
|
||||
rank = "PRIVATE";
|
||||
position[] = {7, -6, 0};
|
||||
};
|
||||
};
|
||||
suitable[] = {"attack", "defend"};
|
||||
};
|
||||
class MotorizedPatrol {
|
||||
side = "EAST";
|
||||
class Units {
|
||||
class Unit0 {
|
||||
vehicle = "O_Soldier_TL_F";
|
||||
rank = "SERGEANT";
|
||||
position[] = {0, 0, 0};
|
||||
};
|
||||
class Unit1 {
|
||||
vehicle = "O_Soldier_LAT_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {5, -4, 0};
|
||||
};
|
||||
class Unit2 {
|
||||
vehicle = "O_Soldier_F";
|
||||
rank = "PRIVATE";
|
||||
position[] = {-5, -4, 0};
|
||||
};
|
||||
class Unit3 {
|
||||
vehicle = "O_Soldier_A_F";
|
||||
rank = "PRIVATE";
|
||||
position[] = {8, -7, 0};
|
||||
};
|
||||
};
|
||||
suitable[] = {"attack", "defend"};
|
||||
};
|
||||
class SpecOps {
|
||||
side = "EAST";
|
||||
class Units {
|
||||
class Unit0 {
|
||||
vehicle = "O_recon_TL_F";
|
||||
rank = "SERGEANT";
|
||||
position[] = {0, 0, 0};
|
||||
};
|
||||
class Unit1 {
|
||||
vehicle = "O_recon_M_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {5, -5, 0};
|
||||
};
|
||||
};
|
||||
suitable[] = {"hvt", "hostage"};
|
||||
};
|
||||
class ReconRaid {
|
||||
side = "EAST";
|
||||
class Units {
|
||||
class Unit0 {
|
||||
vehicle = "O_recon_TL_F";
|
||||
rank = "SERGEANT";
|
||||
position[] = {0, 0, 0};
|
||||
};
|
||||
class Unit1 {
|
||||
vehicle = "O_recon_M_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {4, -4, 0};
|
||||
};
|
||||
class Unit2 {
|
||||
vehicle = "O_recon_LAT_F";
|
||||
rank = "CORPORAL";
|
||||
position[] = {-4, -4, 0};
|
||||
};
|
||||
class Unit3 {
|
||||
vehicle = "O_recon_medic_F";
|
||||
rank = "PRIVATE";
|
||||
position[] = {7, -7, 0};
|
||||
};
|
||||
};
|
||||
suitable[] = {"attack", "hvt", "hostage"};
|
||||
};
|
||||
};
|
||||
|
||||
// TODO: Continue to refine mission types and their specific settings
|
||||
// Mission type specific settings
|
||||
/*
|
||||
* Mission type settings.
|
||||
*
|
||||
* Common fields:
|
||||
* - Rewards.money[]: min/max funds reward.
|
||||
* - Rewards.reputation[]: min/max reputation reward.
|
||||
* - Rewards.<category>[]: item reward rolls as {classname, chance}.
|
||||
* - penalty[]: numeric min/max reputation penalty on failure. UI settings
|
||||
* may express these as min/max reputation hits, then the helper sorts the
|
||||
* numeric roll range before generators use it.
|
||||
* - timeLimit[]: min/max task time limit in seconds.
|
||||
*/
|
||||
class MissionTypes {
|
||||
// Search-and-destroy infantry engagement.
|
||||
class Attack {
|
||||
minUnits = 4;
|
||||
maxUnits = 8;
|
||||
patrolRadius = 200;
|
||||
class Rewards {
|
||||
money[] = {25000, 60000};
|
||||
reputation[] = {6, 14};
|
||||
@ -172,13 +73,16 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-8, -3};
|
||||
timeLimit[] = {900, 1800}; // 15-30 minutes
|
||||
timeLimit[] = {900, 1800};
|
||||
};
|
||||
|
||||
|
||||
// Hold a generated position through multiple enemy waves.
|
||||
class Defend {
|
||||
minWaves = 3;
|
||||
maxWaves = 8;
|
||||
// Min/max units spawned per wave before active-player scaling.
|
||||
unitsPerWave[] = {4, 8};
|
||||
// Seconds between wave spawns.
|
||||
waveCooldown = 300;
|
||||
class Rewards {
|
||||
money[] = {40000, 90000};
|
||||
@ -190,13 +94,15 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-12, -4};
|
||||
timeLimit[] = {1800, 3600}; // 30-60 minutes
|
||||
timeLimit[] = {300, 1800};
|
||||
};
|
||||
|
||||
|
||||
// Rescue a hostage from a generated hostile site.
|
||||
class Hostage {
|
||||
// Candidate hostage classnames by broad source category.
|
||||
class Hostages {
|
||||
civilian[] = {"C_man_1", "C_man_polo_1_F"};
|
||||
military[] = {"B_Pilot_F", "B_officer_F"};
|
||||
civilian[] = {"C_journalist_F", "C_Journalist_01_War_F", "C_Man_Paramedic_01_F", "C_scientist_F", "C_IDAP_Pilot_RF", "C_IDAP_Man_Paramedic_01_F", "C_IDAP_Pilot_01_F", "C_IDAP_Man_AidWorker_01_F", "C_IDAP_Man_AidWorker_05_F", "C_pilot_story_RF", "C_pilot2_story_RF", "C_Orestes", "C_Nikos", "C_Journalist_lxWS"};
|
||||
military[] = {"B_helicrew_F", "B_Helipilot_F", "B_officer_F", "B_Fighter_Pilot_F", "B_Captain_Jay_F", "B_CTRG_soldier_M_medic_F", "B_Story_Pilot_F", "B_CTRG_soldier_GL_LAT_F", "B_Captain_Pettka_F", "B_Survivor_F", "B_Pilot_F"};
|
||||
};
|
||||
class Rewards {
|
||||
money[] = {60000, 140000};
|
||||
@ -208,14 +114,17 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-16, -6};
|
||||
timeLimit[] = {600, 900}; // 10-15 minutes
|
||||
timeLimit[] = {600, 900};
|
||||
};
|
||||
|
||||
class HVT {
|
||||
// Eliminate a high-value target with escort security.
|
||||
class HVTKill {
|
||||
// Candidate target classnames by role.
|
||||
class Targets {
|
||||
officer[] = {"O_officer_F"};
|
||||
sniper[] = {"O_sniper_F"};
|
||||
};
|
||||
// Number of escort units to attempt around the target.
|
||||
escorts = 4;
|
||||
class Rewards {
|
||||
money[] = {50000, 120000};
|
||||
@ -227,15 +136,40 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-14, -5};
|
||||
timeLimit[] = {900, 1800}; // 15-30 minutes
|
||||
timeLimit[] = {900, 1800};
|
||||
};
|
||||
|
||||
class Defuse {
|
||||
class Devices {
|
||||
small[] = {"DemoCharge_Remote_Mag"};
|
||||
large[] = {"SatchelCharge_Remote_Mag"};
|
||||
// Capture and extract a high-value target.
|
||||
class HVTCapture {
|
||||
// Candidate capturable target classnames.
|
||||
class Targets {
|
||||
civilian[] = {"C_journalist_F", "C_Journalist_01_War_F", "C_Man_Paramedic_01_F", "C_scientist_F", "C_IDAP_Pilot_RF", "C_IDAP_Man_Paramedic_01_F", "C_IDAP_Pilot_01_F", "C_IDAP_Man_AidWorker_01_F", "C_IDAP_Man_AidWorker_05_F", "C_pilot_story_RF", "C_pilot2_story_RF", "C_Orestes", "C_Nikos", "C_Journalist_lxWS"};
|
||||
};
|
||||
maxDevices = 3;
|
||||
// Number of escort units to attempt around the target.
|
||||
escorts = 4;
|
||||
class Rewards {
|
||||
money[] = {50000, 120000};
|
||||
reputation[] = {10, 22};
|
||||
equipment[] = {{"ItemGPS", 0.5}, {"ItemCompass", 0.3}};
|
||||
supplies[] = {{"FirstAidKit", 0.2}, {"Medikit", 0.1}};
|
||||
weapons[] = {{"arifle_MX_F", 0.3}, {"arifle_Katiba_F", 0.2}};
|
||||
vehicles[] = {{"B_MRAP_01_F", 0.1}, {"B_APC_Wheeled_01_cannon_F", 0.05}};
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-14, -5};
|
||||
timeLimit[] = {900, 1800};
|
||||
};
|
||||
|
||||
// Defuse explosive devices and protect nearby critical objects.
|
||||
class Defuse {
|
||||
// Device and protected-object candidate classnames.
|
||||
class Devices {
|
||||
small[] = {"DemoCharge_F", "IEDLandSmall_F", "IEDUrbanSmall_F", "ACE_IEDLandSmall_Range", "ACE_IEDUrbanSmall_Range"};
|
||||
large[] = {"SatchelCharge_F", "IEDLandBig_F", "IEDUrbanBig_F", "ACE_IEDLandBig_Range", "ACE_IEDUrbanBig_Range"};
|
||||
protected[] = {"CargoNet_01_barrels_F", "CargoNet_01_box_F", "B_CargoNet_01_ammo_F", "C_IDAP_CargoNet_01_supplies_F", "Box_NATO_AmmoVeh_F", "B_supplyCrate_F"};
|
||||
};
|
||||
// Maximum explosive devices to place for one generated task.
|
||||
maxDevices = 1;
|
||||
class Rewards {
|
||||
money[] = {20000, 50000};
|
||||
reputation[] = {5, 12};
|
||||
@ -246,13 +180,15 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-9, -3};
|
||||
timeLimit[] = {600, 900}; // 10-15 minutes
|
||||
timeLimit[] = {600, 900};
|
||||
};
|
||||
|
||||
// Deliver cargo or vehicles between generated locations.
|
||||
class Delivery {
|
||||
// Candidate delivery objects grouped by cargo type.
|
||||
class Cargo {
|
||||
supplies[] = {"Land_CargoBox_V1_F"};
|
||||
vehicles[] = {"B_MRAP_01_F", "B_Truck_01_transport_F"};
|
||||
supplies[] = {"CargoNet_01_barrels_F", "CargoNet_01_box_F", "B_CargoNet_01_ammo_F", "C_IDAP_CargoNet_01_supplies_F", "Box_NATO_AmmoVeh_F", "B_supplyCrate_F"};
|
||||
vehicles[] = {};
|
||||
};
|
||||
class Rewards {
|
||||
money[] = {10000, 30000};
|
||||
@ -264,7 +200,26 @@ class CfgMissions {
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-6, -2};
|
||||
timeLimit[] = {900, 1800}; // 15-30 minutes
|
||||
timeLimit[] = {0, 0};
|
||||
};
|
||||
|
||||
// Destroy generated infrastructure targets.
|
||||
class Destroy {
|
||||
// Candidate destructible target classnames.
|
||||
class Bomb {
|
||||
building[] = {"Land_Radar_F", "Land_Radar_Small_F", "Land_MobileRadar_01_radar_F", "Land_MobileRadar_01_generator_F", "Land_Communication_F", "Land_spp_Tower_F", "Land_TTowerSmall_1_F", "Land_TTowerSmall_2_F", "Land_TTowerBig_1_F", "Land_TTowerBig_2_F"};
|
||||
};
|
||||
class Rewards {
|
||||
money[] = {10000, 30000};
|
||||
reputation[] = {3, 8};
|
||||
equipment[] = {{"ItemGPS", 0.5}, {"ItemCompass", 0.3}};
|
||||
supplies[] = {{"FirstAidKit", 0.2}, {"Medikit", 0.1}};
|
||||
weapons[] = {{"arifle_MX_F", 0.3}, {"arifle_Katiba_F", 0.2}};
|
||||
vehicles[] = {{"B_MRAP_01_F", 0.1}, {"B_APC_Wheeled_01_cannon_F", 0.05}};
|
||||
special[] = {{"B_UAV_01_F", 0.05}, {"B_Heli_Light_01_F", 0.02}};
|
||||
};
|
||||
penalty[] = {-6, -2};
|
||||
timeLimit[] = {900, 1800};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -95,7 +95,8 @@ Mission designers can create tasks in four ways:
|
||||
intentionally fall back to the `default` org. This path expects the BIS task
|
||||
to already exist if map-task visibility is required.
|
||||
|
||||
The dynamic mission manager can also generate attack tasks from config. That is
|
||||
The dynamic mission manager can also generate attack, defend, defuse, delivery,
|
||||
destroy, hostage, HVT kill, and HVT capture tasks from config. That is
|
||||
system-generated content rather than a hand-authored task creation path.
|
||||
|
||||
### CAD Compatibility
|
||||
@ -110,7 +111,7 @@ CAD-compatible creation paths:
|
||||
- Eden modules: compatible because they delegate to `fnc_startTask.sqf`
|
||||
- `fnc_startTask.sqf`: compatible because it registers the catalog entry,
|
||||
creates the BIS task, and dispatches through `fnc_handler.sqf`
|
||||
- dynamic mission manager attack tasks: compatible because the mission manager
|
||||
- dynamic mission manager tasks: compatible because the mission manager
|
||||
uses `fnc_startTask.sqf`
|
||||
|
||||
Limited or incompatible paths:
|
||||
@ -244,7 +245,8 @@ Task module emits the following events to the event bus:
|
||||
- `task.notification.requested` - participant notifications pending dispatch
|
||||
|
||||
## Notes
|
||||
- the dynamic mission manager in `fnc_missionManager.sqf` is initialized during task post-init; mission generation only runs when the `forge_task_enableGenerator` CBA setting is enabled
|
||||
- the dynamic mission manager in `fnc_missionManager.sqf` is initialized during task post-init; timer-based mission generation only runs when the `forge_server_task_enableGenerator` CBA setting is enabled
|
||||
- CAD can request a specific generated mission type through `fnc_requestMissionTask.sqf`
|
||||
- it starts server-owned tasks through `fnc_handler.sqf` and binds them to the `default` org
|
||||
- task lifecycle for the mission manager is tracked through `TaskStore` status entries
|
||||
- task backend state is intentionally transient and resets with the active server/mission lifecycle
|
||||
|
||||
@ -6,6 +6,7 @@ PREP(destroy);
|
||||
PREP(handler);
|
||||
PREP(hostage);
|
||||
PREP(hvt);
|
||||
PREP(initMissionSetupService);
|
||||
PREP(makeCargo);
|
||||
PREP(makeHostage);
|
||||
PREP(makeHVT);
|
||||
@ -14,15 +15,26 @@ PREP(makeObject);
|
||||
PREP(makeShooter);
|
||||
PREP(makeTarget);
|
||||
PREP(missionManager);
|
||||
PREP(requestMissionTask);
|
||||
PREP(initTaskStore);
|
||||
|
||||
PREP_SUBDIR(generators,attackMissionGenerator);
|
||||
PREP_SUBDIR(generators,captureHvtMissionGenerator);
|
||||
PREP_SUBDIR(generators,defendMissionGenerator);
|
||||
PREP_SUBDIR(generators,defuseMissionGenerator);
|
||||
PREP_SUBDIR(generators,deliveryMissionGenerator);
|
||||
PREP_SUBDIR(generators,destroyMissionGenerator);
|
||||
PREP_SUBDIR(generators,hostageMissionGenerator);
|
||||
PREP_SUBDIR(generators,hvtMissionGenerator);
|
||||
|
||||
PREP_SUBDIR(helpers,getEnemyFactionUnitPool);
|
||||
PREP_SUBDIR(helpers,getMissionSettingRange);
|
||||
PREP_SUBDIR(helpers,handleTaskRewards);
|
||||
PREP_SUBDIR(helpers,parseTaskChainAttributes);
|
||||
PREP_SUBDIR(helpers,parseRewards);
|
||||
PREP_SUBDIR(helpers,spawnEnemyWave);
|
||||
PREP_SUBDIR(helpers,startTask);
|
||||
PREP_SUBDIR(helpers,updateEnemyCountFromActivePlayers);
|
||||
|
||||
PREP_SUBDIR(modules,attackModule);
|
||||
PREP_SUBDIR(modules,cargoModule);
|
||||
|
||||
@ -1,11 +1,115 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
|
||||
if (isNil QGVAR(MissionSetupService)) then { call FUNC(initMissionSetupService); };
|
||||
|
||||
[SRPC(task,requestOpenMissionSetup), {
|
||||
params [
|
||||
["_requester", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _notifyDenied = {
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_message", "", [""]]
|
||||
];
|
||||
|
||||
if (isNull _unit || { _message isEqualTo "" }) exitWith {};
|
||||
[CRPC(notifications,recieveNotification), ["warning", "Mission Setup", _message], _unit] call CFUNC(targetEvent);
|
||||
};
|
||||
|
||||
if (isNull _requester) exitWith {
|
||||
["WARNING", "Mission setup open request ignored: requester was null."] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
private _requesterVar = toLowerANSI vehicleVarName _requester;
|
||||
["INFO", format [
|
||||
"Mission setup open requested. Requester=%1 VarName=%2 Enabled=%3 Applied=%4",
|
||||
_requester,
|
||||
_requesterVar,
|
||||
GETGVAR(enableMissionSetup,false),
|
||||
GETGVAR(missionSetup_settingsApplied,false)
|
||||
]] call EFUNC(common,log);
|
||||
|
||||
if !(GETGVAR(enableMissionSetup,false)) exitWith {
|
||||
["INFO", "Mission setup open denied: framework mission setup is disabled."] call EFUNC(common,log);
|
||||
[_requester, "Framework mission setup is disabled for this mission."] call _notifyDenied;
|
||||
};
|
||||
if (GETGVAR(missionSetup_settingsApplied,false)) exitWith {
|
||||
["INFO", "Mission setup open denied: settings were already applied."] call EFUNC(common,log);
|
||||
[_requester, "Mission setup has already been applied and cannot be reopened."] call _notifyDenied;
|
||||
};
|
||||
|
||||
private _allowedVariables = GETGVAR(missionSetup_allowedUnitVariables,["ceo"]);
|
||||
if !(_allowedVariables isEqualType []) then { _allowedVariables = ["ceo"]; };
|
||||
_allowedVariables = _allowedVariables apply {
|
||||
if (_x isEqualType "") then { toLowerANSI _x } else { toLowerANSI str _x }
|
||||
};
|
||||
|
||||
private _isSetupOperator = _requesterVar in _allowedVariables;
|
||||
if !(_isSetupOperator) then {
|
||||
{
|
||||
private _unit = missionNamespace getVariable [_x, objNull];
|
||||
if (!isNull _unit && { _requester isEqualTo _unit }) exitWith {
|
||||
_isSetupOperator = true;
|
||||
};
|
||||
} forEach _allowedVariables;
|
||||
};
|
||||
|
||||
if !(_isSetupOperator) exitWith {
|
||||
["INFO", format [
|
||||
"Mission setup open denied: requester is not an allowed setup operator. VarName=%1 Allowed=%2",
|
||||
_requesterVar,
|
||||
_allowedVariables
|
||||
]] call EFUNC(common,log);
|
||||
[_requester, "You are not allowed to open mission setup."] call _notifyDenied;
|
||||
};
|
||||
|
||||
["INFO", format ["Mission setup open approved. Target=%1 VarName=%2", _requester, _requesterVar]] call EFUNC(common,log);
|
||||
[CRPC(mission_setup,openMissionSetup), [], _requester] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[SRPC(task,requestApplyMissionSetupSettings), {
|
||||
params [
|
||||
["_overrides", createHashMap, [createHashMap]],
|
||||
["_requester", objNull, [objNull]]
|
||||
];
|
||||
|
||||
private _allowedVariables = GETGVAR(missionSetup_allowedUnitVariables,["ceo"]);
|
||||
if !(_allowedVariables isEqualType []) then { _allowedVariables = ["ceo"]; };
|
||||
_allowedVariables = _allowedVariables apply {
|
||||
if (_x isEqualType "") then { toLowerANSI _x } else { toLowerANSI str _x }
|
||||
};
|
||||
|
||||
private _requesterVar = toLowerANSI vehicleVarName _requester;
|
||||
private _isSetupOperator = _requesterVar in _allowedVariables;
|
||||
if !(_isSetupOperator) then {
|
||||
{
|
||||
private _unit = missionNamespace getVariable [_x, objNull];
|
||||
if (!isNull _unit && { _requester isEqualTo _unit }) exitWith {
|
||||
_isSetupOperator = true;
|
||||
};
|
||||
} forEach _allowedVariables;
|
||||
};
|
||||
|
||||
if !(_isSetupOperator) exitWith {
|
||||
["WARNING", format [
|
||||
"Mission setup apply request denied. Requester=%1 VarName=%2",
|
||||
_requester,
|
||||
_requesterVar
|
||||
]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
if (isNil QGVAR(MissionSetupService)) then { call FUNC(initMissionSetupService); };
|
||||
["INFO", format ["Mission setup apply request accepted. Requester=%1 VarName=%2", _requester, _requesterVar]] call EFUNC(common,log);
|
||||
GVAR(MissionSetupService) call ["apply", [_overrides]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
||||
private _logTaskLifecycleEvent = {
|
||||
params ["_event"];
|
||||
|
||||
if !(missionNamespace getVariable [QGVAR(enableEventLogs), false]) exitWith {};
|
||||
if !(GETGVAR(enableEventLogs,false)) exitWith {};
|
||||
|
||||
["INFO", format [
|
||||
"Task lifecycle event: %1 taskID=%2 taskType=%3 status=%4 participants=%5",
|
||||
@ -20,7 +124,7 @@ if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
||||
private _logTaskRewardEvent = {
|
||||
params ["_event"];
|
||||
|
||||
if !(missionNamespace getVariable [QGVAR(enableEventLogs), false]) exitWith {};
|
||||
if !(GETGVAR(enableEventLogs,false)) exitWith {};
|
||||
|
||||
["INFO", format [
|
||||
"Task reward event: %1 taskID=%2 success=%3 message=%4",
|
||||
@ -62,7 +166,7 @@ if (isNil QGVAR(TaskNotificationEventTokens)) then {
|
||||
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
||||
} forEach _participantUids;
|
||||
|
||||
if (missionNamespace getVariable [QGVAR(enableEventLogs), false]) then {
|
||||
if (GETGVAR(enableEventLogs,false)) then {
|
||||
["INFO", format [
|
||||
"Task notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
||||
_event getOrDefault ["taskID", ""],
|
||||
@ -89,7 +193,7 @@ if (isNil QGVAR(TaskNotificationEventTokens)) then {
|
||||
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
||||
} forEach _memberUids;
|
||||
|
||||
if (missionNamespace getVariable [QGVAR(enableEventLogs), false]) then {
|
||||
if (GETGVAR(enableEventLogs,false)) then {
|
||||
["INFO", format [
|
||||
"Task reward notification event: taskID=%1 type=%2 recipients=%3 message=%4",
|
||||
_event getOrDefault ["taskID", ""],
|
||||
|
||||
@ -33,4 +33,5 @@ private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
|
||||
[] call FUNC(DefendTaskBaseClass);
|
||||
|
||||
call FUNC(initTaskStore);
|
||||
call FUNC(initMissionSetupService);
|
||||
if !(isNil QGVAR(TaskStore)) then { GVAR(TaskStore) call ["resetMissionState", []]; };
|
||||
|
||||
@ -9,7 +9,8 @@ class CfgPatches {
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {
|
||||
"forge_server_main",
|
||||
"forge_server_common"
|
||||
"forge_server_common",
|
||||
"forge_mod_task"
|
||||
};
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
@ -18,6 +19,4 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgFactionClasses.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgMissions.hpp"
|
||||
|
||||
@ -0,0 +1,176 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Initializes the framework mission setup service.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Mission setup service object <HASHMAP OBJECT>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(MissionSetupServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "MissionSetupServiceBaseClass"],
|
||||
["getMissionConfig", compileFinal {
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then {
|
||||
_missionConfig = configFile >> "CfgMissions";
|
||||
};
|
||||
_missionConfig
|
||||
}],
|
||||
["numberOrDefault", compileFinal {
|
||||
params ["_value", "_default"];
|
||||
|
||||
if (_value isEqualType "") exitWith {
|
||||
private _parsed = parseNumber _value;
|
||||
[_default, _parsed] select (_parsed isEqualType 0)
|
||||
};
|
||||
|
||||
if (_value isEqualType 0) exitWith { _value };
|
||||
_default
|
||||
}],
|
||||
["resolveFactionSide", compileFinal {
|
||||
params [["_faction", "", [""]], ["_fallbackSide", east]];
|
||||
|
||||
private _cfgFaction = configFile >> "CfgFactionClasses" >> _faction;
|
||||
if !(isClass _cfgFaction) exitWith { _fallbackSide };
|
||||
|
||||
private _sideNumber = -1;
|
||||
if (isNumber (_cfgFaction >> "side")) then {
|
||||
_sideNumber = getNumber (_cfgFaction >> "side");
|
||||
} else {
|
||||
private _sideText = toUpperANSI getText (_cfgFaction >> "side");
|
||||
_sideNumber = switch (_sideText) do {
|
||||
case "0";
|
||||
case "EAST";
|
||||
case "OPFOR": { 0 };
|
||||
case "2";
|
||||
case "GUER";
|
||||
case "GUERRILA";
|
||||
case "GUERRILLA";
|
||||
case "INDEPENDENT";
|
||||
case "RESISTANCE": { 2 };
|
||||
default { -1 };
|
||||
};
|
||||
};
|
||||
|
||||
switch (_sideNumber) do {
|
||||
case 0: { east };
|
||||
case 2: { resistance };
|
||||
default { _fallbackSide };
|
||||
}
|
||||
}],
|
||||
["apply", compileFinal {
|
||||
if !(isServer) exitWith { false };
|
||||
|
||||
params [
|
||||
["_overrides", createHashMap, [createHashMap]]
|
||||
];
|
||||
|
||||
private _missionConfig = _self call ["getMissionConfig", []];
|
||||
private _paramOrDefault = {
|
||||
params ["_varName", "_default", "_overrides"];
|
||||
|
||||
if (_varName in _overrides) exitWith {
|
||||
_overrides getOrDefault [_varName, _default]
|
||||
};
|
||||
|
||||
missionNamespace getVariable [_varName, _default]
|
||||
};
|
||||
|
||||
private _maxConcurrent = [
|
||||
["maxConcurrentMissions", getNumber (_missionConfig >> "maxConcurrentMissions"), _overrides] call _paramOrDefault,
|
||||
3
|
||||
] call (_self get "numberOrDefault");
|
||||
private _interval = [
|
||||
["missionInterval", getNumber (_missionConfig >> "missionInterval"), _overrides] call _paramOrDefault,
|
||||
300
|
||||
] call (_self get "numberOrDefault");
|
||||
private _locationReuseCooldown = [
|
||||
["locationReuseCooldown", getNumber (_missionConfig >> "locationReuseCooldown"), _overrides] call _paramOrDefault,
|
||||
900
|
||||
] call (_self get "numberOrDefault");
|
||||
|
||||
private _moneyMin = [["moneyMin", 500, _overrides] call _paramOrDefault, 500] call (_self get "numberOrDefault");
|
||||
private _moneyMax = [["moneyMax", 1000, _overrides] call _paramOrDefault, 1000] call (_self get "numberOrDefault");
|
||||
private _repMin = [["reputationMin", 25, _overrides] call _paramOrDefault, 25] call (_self get "numberOrDefault");
|
||||
private _repMax = [["reputationMax", 100, _overrides] call _paramOrDefault, 100] call (_self get "numberOrDefault");
|
||||
private _penMin = [["penaltyMin", -5, _overrides] call _paramOrDefault, -5] call (_self get "numberOrDefault");
|
||||
private _penMax = [["penaltyMax", -25, _overrides] call _paramOrDefault, -25] call (_self get "numberOrDefault");
|
||||
private _timeMin = [["timeLimitMin", 600, _overrides] call _paramOrDefault, 600] call (_self get "numberOrDefault");
|
||||
private _timeMax = [["timeLimitMax", 900, _overrides] call _paramOrDefault, 900] call (_self get "numberOrDefault");
|
||||
|
||||
private _enemyFaction = _overrides getOrDefault [
|
||||
"enemyFaction",
|
||||
GETMVAR(ENEMY_FACTION_STR,GETMVAR(enemyFaction,"IND_G_F"))
|
||||
];
|
||||
if !(_enemyFaction isEqualType "") then { _enemyFaction = str _enemyFaction; };
|
||||
if (_enemyFaction isEqualTo "") then { _enemyFaction = "IND_G_F"; };
|
||||
|
||||
_maxConcurrent = (_maxConcurrent max 1) min 50;
|
||||
_interval = _interval max 1;
|
||||
_locationReuseCooldown = _locationReuseCooldown max 0;
|
||||
|
||||
_moneyMin = _moneyMin max 0;
|
||||
_moneyMax = _moneyMax max _moneyMin;
|
||||
|
||||
_repMin = _repMin max -100000;
|
||||
_repMax = _repMax max _repMin;
|
||||
|
||||
_penMin = _penMin min 0;
|
||||
_penMax = _penMax min 0;
|
||||
|
||||
_timeMin = _timeMin max 1;
|
||||
_timeMax = _timeMax max _timeMin;
|
||||
|
||||
private _settings = createHashMapFromArray [
|
||||
["useMenuSettings", true],
|
||||
["maxConcurrentMissions", _maxConcurrent],
|
||||
["missionInterval", _interval],
|
||||
["locationReuseCooldown", _locationReuseCooldown],
|
||||
["moneyMin", _moneyMin],
|
||||
["moneyMax", _moneyMax],
|
||||
["reputationMin", _repMin],
|
||||
["reputationMax", _repMax],
|
||||
["penaltyMin", _penMin],
|
||||
["penaltyMax", _penMax],
|
||||
["timeLimitMin", _timeMin],
|
||||
["timeLimitMax", _timeMax],
|
||||
["enemyFaction", _enemyFaction]
|
||||
];
|
||||
|
||||
SETMPVAR(GVAR(missionSetup_settings),_settings);
|
||||
SETMPVAR(GVAR(missionSetup_settingsApplied),true);
|
||||
|
||||
private _side = _self call ["resolveFactionSide", [_enemyFaction, east]];
|
||||
ENEMY_SIDE = _side;
|
||||
SETMPVAR(ENEMY_FACTION_STR,_enemyFaction);
|
||||
publicVariable "ENEMY_SIDE";
|
||||
|
||||
["INFO", format [
|
||||
"Framework mission setup applied. Faction=%1, Side=%2, MaxConcurrent=%3, Interval=%4",
|
||||
_enemyFaction,
|
||||
_side,
|
||||
_maxConcurrent,
|
||||
_interval
|
||||
]] call EFUNC(common,log);
|
||||
|
||||
if !(isNil QEGVAR(common,EventBus)) then {
|
||||
EGVAR(common,EventBus) call ["emit", [
|
||||
"mission.setup.applied",
|
||||
createHashMapFromArray [["settings", _settings]],
|
||||
createHashMapFromArray [["source", "task"]]
|
||||
]];
|
||||
};
|
||||
|
||||
true
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(MissionSetupService) = createHashMapObject [GVAR(MissionSetupServiceBaseClass)];
|
||||
GVAR(MissionSetupService)
|
||||
@ -18,7 +18,37 @@
|
||||
|
||||
if !(isServer) exitWith { false };
|
||||
if !(isNil QGVAR(MissionManagerPFH)) exitWith { false };
|
||||
|
||||
if (
|
||||
(GETGVAR(enableMissionSetup,false)) &&
|
||||
{ !(GETGVAR(missionSetup_settingsApplied,false)) }
|
||||
) exitWith {
|
||||
if !(GETGVAR(MissionManagerSetupPending,false)) then {
|
||||
SETMPVAR(GVAR(MissionManagerSetupPending),true);
|
||||
["INFO", "Mission manager startup deferred until framework mission setup settings are applied."] call EFUNC(common,log);
|
||||
|
||||
[] spawn {
|
||||
waitUntil {
|
||||
sleep 1;
|
||||
GETGVAR(missionSetup_settingsApplied,false)
|
||||
};
|
||||
|
||||
SETMPVAR(GVAR(MissionManagerSetupPending),false);
|
||||
call FUNC(missionManager);
|
||||
};
|
||||
};
|
||||
|
||||
true
|
||||
};
|
||||
|
||||
if (isNil QGVAR(AttackMissionGeneratorBaseClass)) then { call FUNC(attackMissionGenerator); };
|
||||
if (isNil QGVAR(DefendMissionGeneratorBaseClass)) then { call FUNC(defendMissionGenerator); };
|
||||
if (isNil QGVAR(DefuseMissionGeneratorBaseClass)) then { call FUNC(defuseMissionGenerator); };
|
||||
if (isNil QGVAR(DeliveryMissionGeneratorBaseClass)) then { call FUNC(deliveryMissionGenerator); };
|
||||
if (isNil QGVAR(DestroyMissionGeneratorBaseClass)) then { call FUNC(destroyMissionGenerator); };
|
||||
if (isNil QGVAR(HostageMissionGeneratorBaseClass)) then { call FUNC(hostageMissionGenerator); };
|
||||
if (isNil QGVAR(KillHvtMissionGeneratorBaseClass)) then { call FUNC(hvtMissionGenerator); };
|
||||
if (isNil QGVAR(CaptureHvtMissionGeneratorBaseClass)) then { call FUNC(captureHvtMissionGenerator); };
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [
|
||||
@ -27,11 +57,59 @@ GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [
|
||||
_self set ["lastMissionGenerationAt", -1e10];
|
||||
_self set ["recentLocationRegistry", []];
|
||||
_self set ["activeMissionRegistry", createHashMap];
|
||||
_self set ["generators", [createHashMapObject [GVAR(AttackMissionGeneratorBaseClass)]]];
|
||||
_self set ["generators", [
|
||||
["attack", createHashMapObject [GVAR(AttackMissionGeneratorBaseClass)]],
|
||||
["defend", createHashMapObject [GVAR(DefendMissionGeneratorBaseClass)]],
|
||||
["defuse", createHashMapObject [GVAR(DefuseMissionGeneratorBaseClass)]],
|
||||
["delivery", createHashMapObject [GVAR(DeliveryMissionGeneratorBaseClass)]],
|
||||
["destroy", createHashMapObject [GVAR(DestroyMissionGeneratorBaseClass)]],
|
||||
["hostage", createHashMapObject [GVAR(HostageMissionGeneratorBaseClass)]],
|
||||
["hvtkill", createHashMapObject [GVAR(KillHvtMissionGeneratorBaseClass)]],
|
||||
["hvtcapture", createHashMapObject [GVAR(CaptureHvtMissionGeneratorBaseClass)]]
|
||||
]];
|
||||
["INFO", format [
|
||||
"Mission manager registered generator entries: %1",
|
||||
(_self getOrDefault ["generators", []]) apply { _x param [0, ""] }
|
||||
]] call EFUNC(common,log);
|
||||
}],
|
||||
["getGenerators", compileFinal {
|
||||
(_self getOrDefault ["generators", []]) apply { _x param [1, createHashMap, [createHashMap]] }
|
||||
}],
|
||||
["getGeneratorEntries", compileFinal {
|
||||
_self getOrDefault ["generators", []]
|
||||
}],
|
||||
["getGeneratorByType", compileFinal {
|
||||
params [["_generatorType", "", [""]]];
|
||||
|
||||
private _result = createHashMap;
|
||||
{
|
||||
if ((_x param [0, "", [""]]) isEqualTo _generatorType) exitWith {
|
||||
_result = _x param [1, createHashMap, [createHashMap]];
|
||||
};
|
||||
} forEach (_self call ["getGeneratorEntries", []]);
|
||||
|
||||
_result
|
||||
}],
|
||||
["getGeneratedTaskTypes", compileFinal {
|
||||
private _labels = createHashMapFromArray [
|
||||
["attack", "Attack"],
|
||||
["defend", "Defend"],
|
||||
["defuse", "Defuse"],
|
||||
["delivery", "Delivery"],
|
||||
["destroy", "Destroy"],
|
||||
["hostage", "Hostage"],
|
||||
["hvtkill", "Kill HVT"],
|
||||
["hvtcapture", "Capture HVT"]
|
||||
];
|
||||
|
||||
(_self call ["getGeneratorEntries", []]) apply {
|
||||
private _generatorType = _x param [0, "", [""]];
|
||||
createHashMapFromArray [
|
||||
["value", _generatorType],
|
||||
["label", _labels getOrDefault [_generatorType, _generatorType]]
|
||||
]
|
||||
}
|
||||
}],
|
||||
["getActiveMissionIds", compileFinal {
|
||||
private _activeMissionRegistry = _self getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
keys _activeMissionRegistry
|
||||
@ -119,15 +197,44 @@ GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [
|
||||
""
|
||||
};
|
||||
|
||||
private _startedTaskID = "";
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then {
|
||||
_missionConfig = configFile >> "CfgMissions";
|
||||
};
|
||||
private _weightsConfig = _missionConfig >> "MissionWeights";
|
||||
private _weighted = [];
|
||||
private _totalWeight = 0;
|
||||
{
|
||||
private _taskID = _x call ["startMission", [_self]];
|
||||
if (_taskID isNotEqualTo "") exitWith {
|
||||
_startedTaskID = _taskID;
|
||||
};
|
||||
} forEach (_self call ["getGenerators", []]);
|
||||
private _generatorType = _x param [0, "", [""]];
|
||||
private _generator = _x param [1, createHashMap, [createHashMap]];
|
||||
if (_generatorType isEqualTo "" || { _generator isEqualTo createHashMap }) then { continue; };
|
||||
|
||||
_startedTaskID
|
||||
private _weight = getNumber (_weightsConfig >> _generatorType);
|
||||
if (_weight <= 0) then { _weight = 1; };
|
||||
|
||||
_totalWeight = _totalWeight + _weight;
|
||||
_weighted pushBack [_generatorType, _generator, _totalWeight];
|
||||
} forEach (_self call ["getGeneratorEntries", []]);
|
||||
|
||||
if (_weighted isEqualTo [] || { _totalWeight <= 0 }) exitWith { "" };
|
||||
|
||||
private _roll = random _totalWeight;
|
||||
private _selected = _weighted select 0;
|
||||
{
|
||||
if (_roll <= (_x param [2, 0, [0]])) exitWith {
|
||||
_selected = _x;
|
||||
};
|
||||
} forEach _weighted;
|
||||
|
||||
private _generatorType = _selected param [0, "", [""]];
|
||||
private _generator = _selected param [1, createHashMap, [createHashMap]];
|
||||
private _taskID = _generator call ["startMission", [_self]];
|
||||
if (_taskID isEqualTo "") exitWith {
|
||||
["WARNING", format ["Mission manager failed to start '%1' generated mission.", _generatorType]] call EFUNC(common,log);
|
||||
""
|
||||
};
|
||||
|
||||
_taskID
|
||||
}]
|
||||
];
|
||||
|
||||
@ -154,6 +261,8 @@ if (isNil QGVAR(MissionManagerTaskEventTokens)) then {
|
||||
|
||||
if (GVAR(enableGenerator)) then {
|
||||
GVAR(MissionManagerPFH) = [{
|
||||
if !(GVAR(enableGenerator)) exitWith {};
|
||||
|
||||
GVAR(MissionManager) call ["cleanupCompletedMissions", []];
|
||||
|
||||
private _now = diag_tickTime;
|
||||
|
||||
120
arma/server/addons/task/functions/fnc_requestMissionTask.sqf
Normal file
120
arma/server/addons/task/functions/fnc_requestMissionTask.sqf
Normal file
@ -0,0 +1,120 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Framework-owned on-demand dynamic mission request entry point for CAD and
|
||||
* other server-side dispatchers.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Generator type <STRING>
|
||||
* 1: Request metadata <HASHMAP> (Default: createHashMap)
|
||||
* 2: Requesting player UID <STRING> (Default: "")
|
||||
*
|
||||
* Return Value:
|
||||
* Request result with success, message, taskID, and taskType keys <HASHMAP>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
if !(isServer) exitWith {
|
||||
createHashMapFromArray [
|
||||
["success", false],
|
||||
["message", "Generated task requests must run on the server."]
|
||||
]
|
||||
};
|
||||
|
||||
params [
|
||||
["_requestedType", "", [""]],
|
||||
["_metadata", createHashMap, [createHashMap]],
|
||||
["_requesterUid", "", [""]]
|
||||
];
|
||||
|
||||
private _result = createHashMapFromArray [
|
||||
["success", false],
|
||||
["message", "Generated task request failed."],
|
||||
["taskID", ""],
|
||||
["taskType", _requestedType]
|
||||
];
|
||||
|
||||
if !(GVAR(enableGenerator)) exitWith {
|
||||
_result set ["message", "Generated task requests are disabled by server settings."];
|
||||
_result
|
||||
};
|
||||
|
||||
private _typeAliases = createHashMapFromArray [
|
||||
["attack", "attack"],
|
||||
["defend", "defend"],
|
||||
["defense", "defend"],
|
||||
["delivery", "delivery"],
|
||||
["deliver", "delivery"],
|
||||
["destroy", "destroy"],
|
||||
["defuse", "defuse"],
|
||||
["hostage", "hostage"],
|
||||
["hvt", "hvtkill"],
|
||||
["hvtkill", "hvtkill"],
|
||||
["killhvt", "hvtkill"],
|
||||
["kill_hvt", "hvtkill"],
|
||||
["hvtcapture", "hvtcapture"],
|
||||
["capturehvt", "hvtcapture"],
|
||||
["capture_hvt", "hvtcapture"]
|
||||
];
|
||||
|
||||
private _generatorType = _typeAliases getOrDefault [toLowerANSI _requestedType, ""];
|
||||
if (_generatorType isEqualTo "") exitWith {
|
||||
_result set ["message", format ["Unknown generated task type: %1", _requestedType]];
|
||||
_result
|
||||
};
|
||||
_result set ["taskType", _generatorType];
|
||||
|
||||
if (isNil QGVAR(TaskStore)) exitWith {
|
||||
_result set ["message", "Task store is not ready yet."];
|
||||
_result
|
||||
};
|
||||
|
||||
if (isNil QGVAR(MissionManager)) then {
|
||||
call FUNC(missionManager);
|
||||
};
|
||||
|
||||
if (isNil QGVAR(MissionManager)) exitWith {
|
||||
_result set ["message", "Mission manager is not ready yet."];
|
||||
_result
|
||||
};
|
||||
|
||||
GVAR(MissionManager) call ["cleanupCompletedMissions", []];
|
||||
|
||||
private _activeCount = count (GVAR(MissionManager) call ["getActiveMissionIds", []]);
|
||||
private _maxConcurrent = GVAR(MissionManager) call ["getMaxConcurrentMissions", []];
|
||||
if (_activeCount >= _maxConcurrent) exitWith {
|
||||
_result set ["message", format [
|
||||
"Mission cap reached (%1/%2 active). Close or complete a task before requesting another.",
|
||||
_activeCount,
|
||||
_maxConcurrent
|
||||
]];
|
||||
_result
|
||||
};
|
||||
|
||||
private _generator = GVAR(MissionManager) call ["getGeneratorByType", [_generatorType]];
|
||||
if (_generator isEqualTo createHashMap) exitWith {
|
||||
_result set ["message", format ["Generated task type is unavailable: %1", _generatorType]];
|
||||
_result
|
||||
};
|
||||
|
||||
private _taskID = _generator call ["startMission", [GVAR(MissionManager)]];
|
||||
if (_taskID isEqualTo "") exitWith {
|
||||
_result set ["message", format ["Mission generator failed to start task type: %1", _generatorType]];
|
||||
_result
|
||||
};
|
||||
|
||||
GVAR(MissionManager) set ["lastMissionGenerationAt", diag_tickTime];
|
||||
|
||||
["INFO", format [
|
||||
"Dispatcher %1 requested generated %2 mission %3.",
|
||||
_requesterUid,
|
||||
_generatorType,
|
||||
_taskID
|
||||
]] call EFUNC(common,log);
|
||||
|
||||
_result set ["success", true];
|
||||
_result set ["message", format ["Generated %1 task %2.", _generatorType, _taskID]];
|
||||
_result set ["taskID", _taskID];
|
||||
_result
|
||||
@ -1,17 +1,17 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions
|
||||
* Attack mission generator used by the dynamic mission manager.
|
||||
* Author: IDSolutions, Blackbox AI, MrPākehā
|
||||
* Defines the Attack mission generator base class used by the dynamic
|
||||
* mission manager. The generator selects a location, spawns required
|
||||
* entities, registers a Forge task, and cleans up manager state when the
|
||||
* task completes.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call forge_server_task_fnc_attackMissionGenerator
|
||||
* N/A. Defines GVAR(AttackMissionGeneratorBaseClass) in missionNamespace.
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -21,23 +21,35 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "AttackMissionGeneratorBaseClass"],
|
||||
["#create", compileFinal {
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then {
|
||||
_missionConfig = configFile >> "CfgMissions";
|
||||
};
|
||||
_self set ["missionConfig", _missionConfig];
|
||||
_self set ["aiGroupsConfig", (_missionConfig >> "AIGroups")];
|
||||
_self set ["attackConfig", (_missionConfig >> "MissionTypes" >> "Attack")];
|
||||
_self set ["generatorType", "attack"];
|
||||
["INFO", format ["Mission generator registered. Type=attack, ConfigPath=%1", _missionConfig]] call EFUNC(common,log);
|
||||
}],
|
||||
["getGeneratorType", compileFinal {
|
||||
_self getOrDefault ["generatorType", "attack"]
|
||||
}],
|
||||
["getMissionInterval", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _interval = getNumber (_missionConfig >> "missionInterval");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_interval = _settings getOrDefault ["missionInterval", _interval];
|
||||
};
|
||||
if (_interval <= 0) then { _interval = 300; };
|
||||
_interval
|
||||
}],
|
||||
["getMaxConcurrentMissions", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _maxConcurrent = getNumber (_missionConfig >> "maxConcurrentMissions");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_maxConcurrent = _settings getOrDefault ["maxConcurrentMissions", _maxConcurrent];
|
||||
};
|
||||
if (_maxConcurrent <= 0) then { _maxConcurrent = 1; };
|
||||
_maxConcurrent
|
||||
}],
|
||||
@ -85,6 +97,7 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _safeDist = 800;
|
||||
private _playerPos = _center;
|
||||
private _minEdgeDist = _safeDist + 200;
|
||||
private _searchRadius = (_worldSize / 2 - _minEdgeDist) max 500;
|
||||
|
||||
private _recentLocationRegistry = _self call ["pruneRecentLocations", [_manager]];
|
||||
private _activeMissionPositions = _self call ["getActiveMissionPositions", [_manager]];
|
||||
@ -104,7 +117,7 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
while { _attempt < _maxAttempts && { _taskPos isEqualTo [] } } do {
|
||||
_attempt = _attempt + 1;
|
||||
private _candidate = [_center, _worldSize / 2 - _minEdgeDist, _worldSize / 2 - _minEdgeDist, 3, 0, 0.3, 0] call BIS_fnc_findSafePos;
|
||||
private _candidate = [_center, _searchRadius, _searchRadius, 3, 0, 0.3, 0] call BFUNC(findSafePos);
|
||||
|
||||
if (_candidate isEqualTo [0, 0, 0]) then { continue; };
|
||||
if (_candidate distance2D _playerPos < _safeDist) then { continue; };
|
||||
@ -134,7 +147,7 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
} forEach _blkListMarkers;
|
||||
|
||||
if (!_inBlkList) then {
|
||||
if !(_inBlkList) then {
|
||||
_taskPos = _candidate;
|
||||
};
|
||||
};
|
||||
@ -161,35 +174,42 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
} forEach ("true" configClasses _aiGroupsConfig);
|
||||
|
||||
if (_groups isEqualTo []) exitWith {
|
||||
["WARNING", "Attack mission generator: no AI group configs are suitable for attack missions."] call EFUNC(common,log);
|
||||
grpNull
|
||||
};
|
||||
private _side = GETMVAR(ENEMY_SIDE,east);
|
||||
private _sideText = str _side;
|
||||
private _group = createGroup _side;
|
||||
[] call FUNC(updateEnemyCountFromActivePlayers);
|
||||
|
||||
private _groupConfig = selectRandom _groups;
|
||||
private _side = getText (_groupConfig >> "side");
|
||||
private _group = createGroup (call compile _side);
|
||||
private _minUnits = getNumber (_attackConfig >> "minUnits");
|
||||
private _maxUnits = getNumber (_attackConfig >> "maxUnits");
|
||||
private _enemyMult = GETGVAR(enemyCountMultiplier,1);
|
||||
private _minUnitsBase = getNumber (_attackConfig >> "minUnits");
|
||||
private _maxUnitsBase = getNumber (_attackConfig >> "maxUnits");
|
||||
private _patrolRadius = getNumber (_attackConfig >> "patrolRadius");
|
||||
|
||||
if (_minUnits <= 0) then { _minUnits = 4; };
|
||||
if (_maxUnits < _minUnits) then { _maxUnits = _minUnits; };
|
||||
if (_minUnitsBase <= 0) then { _minUnitsBase = 4; };
|
||||
if (_maxUnitsBase < _minUnitsBase) then { _maxUnitsBase = _minUnitsBase; };
|
||||
if (_patrolRadius <= 0) then { _patrolRadius = 200; };
|
||||
|
||||
private _targetUnitCount = floor random [_minUnits, ceil ((_minUnits + _maxUnits) / 2), _maxUnits + 1];
|
||||
private _unitPool = [];
|
||||
{
|
||||
if ((getText (_x >> "side")) isNotEqualTo _side) then { continue; };
|
||||
private _minUnits = floor ((_minUnitsBase max 1) * _enemyMult);
|
||||
private _maxUnits = ceil ((_maxUnitsBase max _minUnitsBase) * _enemyMult);
|
||||
if (_minUnits <= 0) then { _minUnits = 1; };
|
||||
if (_maxUnits < _minUnits) then { _maxUnits = _minUnits; };
|
||||
|
||||
private _targetUnitCount = floor random [_minUnits, ceil ((_minUnits + _maxUnits) / 2), _maxUnits + 1];
|
||||
private _enemyFaction = GETMVAR(ENEMY_FACTION_STR,GETMVAR(enemyFaction,"IND_G_F"));
|
||||
private _unitPool = [_enemyFaction, _side] call FUNC(getEnemyFactionUnitPool);
|
||||
|
||||
if (_unitPool isEqualTo [] && { _groups isNotEqualTo [] }) then {
|
||||
{
|
||||
_unitPool pushBack createHashMapFromArray [
|
||||
["vehicle", getText (_x >> "vehicle")],
|
||||
["rank", getText (_x >> "rank")],
|
||||
["position", getArray (_x >> "position")]
|
||||
];
|
||||
} forEach ("true" configClasses (_x >> "Units"));
|
||||
} forEach _groups;
|
||||
if ((getText (_x >> "side")) isNotEqualTo _sideText) then { continue; };
|
||||
|
||||
{
|
||||
_unitPool pushBack createHashMapFromArray [
|
||||
["vehicle", getText (_x >> "vehicle")],
|
||||
["rank", getText (_x >> "rank")],
|
||||
["position", getArray (_x >> "position")]
|
||||
];
|
||||
} forEach ("true" configClasses (_x >> "Units"));
|
||||
} forEach _groups;
|
||||
};
|
||||
|
||||
if (_unitPool isEqualTo []) exitWith {
|
||||
["WARNING", format ["Attack mission generator: selected AI group side '%1' produced an empty unit pool.", _side]] call EFUNC(common,log);
|
||||
@ -301,10 +321,10 @@ GVAR(AttackMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
|
||||
private _taskID = format ["task_attack_%1", round (diag_tickTime * 1000)];
|
||||
private _rewardRange = getArray (_attackConfig >> "Rewards" >> "money");
|
||||
private _reputationRange = getArray (_attackConfig >> "Rewards" >> "reputation");
|
||||
private _penaltyRange = getArray (_attackConfig >> "penalty");
|
||||
private _timeRange = getArray (_attackConfig >> "timeLimit");
|
||||
private _rewardRange = [_attackConfig, ["Rewards", "money"], "moneyMin", "moneyMax", [25000, 60000]] call FUNC(getMissionSettingRange);
|
||||
private _reputationRange = [_attackConfig, ["Rewards", "reputation"], "reputationMin", "reputationMax", [6, 14]] call FUNC(getMissionSettingRange);
|
||||
private _penaltyRange = [_attackConfig, ["penalty"], "penaltyMin", "penaltyMax", [-8, -3]] call FUNC(getMissionSettingRange);
|
||||
private _timeRange = [_attackConfig, ["timeLimit"], "timeLimitMin", "timeLimitMax", [900, 1800]] call FUNC(getMissionSettingRange);
|
||||
private _rewards = _self call ["rollRewards"];
|
||||
private _fundsReward = _rewardRange call BFUNC(randomNum);
|
||||
private _reputationReward = _reputationRange call BFUNC(randomNum);
|
||||
|
||||
@ -0,0 +1,455 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions, Blackbox AI, MrPākehā
|
||||
* Defines the HVT capture mission generator base class used by the dynamic
|
||||
* mission manager. The generator selects a location, spawns required
|
||||
* entities, registers a Forge task, and cleans up manager state when the
|
||||
* task completes.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* N/A. Defines GVAR(CaptureHvtMissionGeneratorBaseClass) in missionNamespace.
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(CaptureHvtMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "CaptureHvtMissionGeneratorBaseClass"],
|
||||
["#create", compileFinal {
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then {
|
||||
_missionConfig = configFile >> "CfgMissions";
|
||||
};
|
||||
_self set ["missionConfig", _missionConfig];
|
||||
_self set ["aiGroupsConfig", (_missionConfig >> "AIGroups")];
|
||||
_self set ["hvtConfig", (_missionConfig >> "MissionTypes" >> "HVTCapture")];
|
||||
_self set ["generatorType", "hvtcapture"];
|
||||
["INFO", format ["Mission generator registered. Type=hvtcapture, ConfigPath=%1", _missionConfig]] call EFUNC(common,log);
|
||||
}],
|
||||
["getGeneratorType", compileFinal {
|
||||
_self getOrDefault ["generatorType", "hvtcapture"]
|
||||
}],
|
||||
["getMissionInterval", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _interval = getNumber (_missionConfig >> "missionInterval");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_interval = _settings getOrDefault ["missionInterval", _interval];
|
||||
};
|
||||
if (_interval <= 0) then { _interval = 300; };
|
||||
_interval
|
||||
}],
|
||||
["getMaxConcurrentMissions", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _maxConcurrent = getNumber (_missionConfig >> "maxConcurrentMissions");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_maxConcurrent = _settings getOrDefault ["maxConcurrentMissions", _maxConcurrent];
|
||||
};
|
||||
if (_maxConcurrent <= 0) then { _maxConcurrent = 1; };
|
||||
_maxConcurrent
|
||||
}],
|
||||
["getLocationReuseCooldown", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _cooldown = getNumber (_missionConfig >> "locationReuseCooldown");
|
||||
if (_cooldown <= 0) then { _cooldown = 900; };
|
||||
_cooldown
|
||||
}],
|
||||
["pruneRecentLocations", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _recentLocationRegistry = _manager getOrDefault ["recentLocationRegistry", []];
|
||||
private _reuseCooldown = _self call ["getLocationReuseCooldown", []];
|
||||
private _now = serverTime;
|
||||
|
||||
_recentLocationRegistry = _recentLocationRegistry select {
|
||||
private _usedAt = _x param [1, -1, [0]];
|
||||
(_usedAt >= 0) && { (_now - _usedAt) < _reuseCooldown }
|
||||
};
|
||||
|
||||
_manager set ["recentLocationRegistry", _recentLocationRegistry];
|
||||
_recentLocationRegistry
|
||||
}],
|
||||
["getActiveMissionPositions", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
private _positions = [];
|
||||
{
|
||||
if ((_y getOrDefault ["generatorType", ""]) isNotEqualTo "hvtcapture") then { continue; };
|
||||
|
||||
private _position = _y getOrDefault ["position", []];
|
||||
if (_position isEqualType [] && { count _position >= 2 }) then {
|
||||
_positions pushBack _position;
|
||||
};
|
||||
} forEach _activeMissionRegistry;
|
||||
_positions
|
||||
}],
|
||||
["selectLocation", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _worldSize = worldSize;
|
||||
private _center = [_worldSize / 2, _worldSize / 2, 0];
|
||||
private _safeDist = 800;
|
||||
private _playerPos = _center;
|
||||
private _minEdgeDist = _safeDist + 200;
|
||||
private _searchRadius = (_worldSize / 2 - _minEdgeDist) max 500;
|
||||
|
||||
private _recentLocationRegistry = _self call ["pruneRecentLocations", [_manager]];
|
||||
private _activeMissionPositions = _self call ["getActiveMissionPositions", [_manager]];
|
||||
|
||||
private _blkListMarkers = allMapMarkers select { markerShape _x in ["RECTANGLE", "ELLIPSE"] };
|
||||
_blkListMarkers = _blkListMarkers select {
|
||||
(
|
||||
(toLowerANSI _x find "blklist") == 0
|
||||
|| { (toLowerANSI (markerText _x) find "blklist") == 0 }
|
||||
)
|
||||
&& { getMarkerPos _x distance2D [0, 0] > 0 }
|
||||
};
|
||||
|
||||
private _taskPos = [];
|
||||
private _attempt = 0;
|
||||
private _maxAttempts = 50;
|
||||
|
||||
while { _attempt < _maxAttempts && { _taskPos isEqualTo [] } } do {
|
||||
_attempt = _attempt + 1;
|
||||
private _candidate = [_center, _searchRadius, _searchRadius, 3, 0, 0.3, 0] call BFUNC(findSafePos);
|
||||
|
||||
if (_candidate isEqualTo [0, 0, 0]) then { continue; };
|
||||
if (_candidate distance2D _playerPos < _safeDist) then { continue; };
|
||||
|
||||
private _isTooClose = false;
|
||||
{
|
||||
private _prevPos = _x param [0, [], [[]]];
|
||||
if (_prevPos isEqualType [] && { count _prevPos >= 2 } && { _candidate distance2D _prevPos < 500 }) exitWith {
|
||||
_isTooClose = true;
|
||||
};
|
||||
} forEach _recentLocationRegistry;
|
||||
|
||||
if (_isTooClose) then { continue; };
|
||||
|
||||
{
|
||||
if (_candidate distance2D _x < 500) exitWith {
|
||||
_isTooClose = true;
|
||||
};
|
||||
} forEach _activeMissionPositions;
|
||||
|
||||
if (_isTooClose) then { continue; };
|
||||
|
||||
private _inBlkList = false;
|
||||
{
|
||||
if (_candidate inArea _x) exitWith {
|
||||
_inBlkList = true;
|
||||
};
|
||||
} forEach _blkListMarkers;
|
||||
|
||||
if !(_inBlkList) then {
|
||||
_taskPos = _candidate;
|
||||
};
|
||||
};
|
||||
|
||||
if (_taskPos isEqualTo []) exitWith {
|
||||
["WARNING", "Capture HVT mission generator: selectLocation failed to find a valid dynamic position."] call EFUNC(common,log);
|
||||
createHashMap
|
||||
};
|
||||
|
||||
private _building = objNull;
|
||||
private _buildingCandidates = nearestObjects [
|
||||
_taskPos,
|
||||
["House_F", "House", "Building", "BuildingBase"],
|
||||
200
|
||||
];
|
||||
if (_buildingCandidates isNotEqualTo []) then {
|
||||
_building = selectRandom _buildingCandidates;
|
||||
};
|
||||
|
||||
private _buildingPositions = [];
|
||||
if !(isNull _building) then {
|
||||
for "_i" from 0 to 100 do {
|
||||
private _buildingPos = _building buildingPos _i;
|
||||
if (_buildingPos isEqualTo [0, 0, 0]) exitWith {};
|
||||
_buildingPositions pushBack _buildingPos;
|
||||
};
|
||||
};
|
||||
|
||||
createHashMapFromArray [
|
||||
["position", _taskPos],
|
||||
["grid", mapGridPosition _taskPos],
|
||||
["buildingPositions", _buildingPositions]
|
||||
]
|
||||
}],
|
||||
|
||||
["spawnHvtTarget", compileFinal {
|
||||
params [['_position', [0, 0, 0], [[]]], ["_buildingPositions", [], [[]]]];
|
||||
|
||||
private _hvtConfig = _self getOrDefault ["hvtConfig", configNull];
|
||||
private _side = GETMVAR(ENEMY_SIDE,east);
|
||||
private _enemyFaction = GETMVAR(ENEMY_FACTION_STR,GETMVAR(enemyFaction,"IND_G_F"));
|
||||
private _unitPool = [_enemyFaction, _side] call FUNC(getEnemyFactionUnitPool);
|
||||
if (_unitPool isEqualTo []) exitWith { [] };
|
||||
|
||||
private _leaderPool = _unitPool select {
|
||||
toUpperANSI (_x getOrDefault ["rank", "PRIVATE"]) in ["SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"]
|
||||
};
|
||||
if (_leaderPool isEqualTo []) then { _leaderPool = +_unitPool; };
|
||||
|
||||
private _targetDef = selectRandom _leaderPool;
|
||||
private _targetClass = _targetDef getOrDefault ["vehicle", ""];
|
||||
if (_targetClass isEqualTo "") exitWith { [] };
|
||||
|
||||
private _group = createGroup _side;
|
||||
private _leaderPos = if (_buildingPositions isEqualTo []) then {
|
||||
_position vectorAdd [(random 20 - 10), (random 20 - 10), 0]
|
||||
} else {
|
||||
selectRandom _buildingPositions
|
||||
};
|
||||
private _leader = _group createUnit [_targetClass, _leaderPos, [], 0, "NONE"];
|
||||
if (isNull _leader) exitWith {
|
||||
deleteGroup _group;
|
||||
[]
|
||||
};
|
||||
_leader setRank "LIEUTENANT";
|
||||
|
||||
[] call FUNC(updateEnemyCountFromActivePlayers);
|
||||
private _enemyMult = GETGVAR(enemyCountMultiplier,1);
|
||||
private _escortCount = getNumber (_hvtConfig >> "escorts");
|
||||
if (_escortCount < 0) then { _escortCount = 0; };
|
||||
_escortCount = floor (_escortCount * _enemyMult);
|
||||
private _escortUnits = [];
|
||||
for "_i" from 1 to _escortCount do {
|
||||
private _escortDef = selectRandom _unitPool;
|
||||
private _escortClass = _escortDef getOrDefault ["vehicle", ""];
|
||||
if (_escortClass isEqualTo "") then { continue; };
|
||||
private _escortPos = if (_buildingPositions isEqualTo []) then {
|
||||
_position vectorAdd [(random 35 - 17), (random 35 - 17), 0]
|
||||
} else {
|
||||
selectRandom _buildingPositions
|
||||
};
|
||||
private _escort = _group createUnit [_escortClass, _escortPos, [], 0, "NONE"];
|
||||
if !(isNull _escort) then {
|
||||
_escort setRank (_escortDef getOrDefault ["rank", "PRIVATE"]);
|
||||
_escortUnits pushBack _escort;
|
||||
};
|
||||
};
|
||||
|
||||
private _groupUnits = [_leader] + _escortUnits;
|
||||
|
||||
[_group, _position, 200] call BFUNC(taskPatrol);
|
||||
|
||||
[_leader, _groupUnits]
|
||||
}],
|
||||
|
||||
["rollRewards", compileFinal {
|
||||
private _hvtConfig = _self getOrDefault ["hvtConfig", configNull];
|
||||
private _equipmentRewards = [];
|
||||
private _supplyRewards = [];
|
||||
private _weaponRewards = [];
|
||||
private _vehicleRewards = [];
|
||||
private _specialRewards = [];
|
||||
|
||||
{
|
||||
private _category = _x;
|
||||
{
|
||||
_x params ["_item", "_chance"];
|
||||
if (random 1 < _chance) then {
|
||||
switch (_category) do {
|
||||
case "equipment": { _equipmentRewards pushBack _item; };
|
||||
case "supplies": { _supplyRewards pushBack _item; };
|
||||
case "weapons": { _weaponRewards pushBack _item; };
|
||||
case "vehicles": { _vehicleRewards pushBack _item; };
|
||||
case "special": { _specialRewards pushBack _item; };
|
||||
};
|
||||
};
|
||||
} forEach (getArray (_hvtConfig >> "Rewards" >> _category));
|
||||
} forEach ["equipment", "supplies", "weapons", "vehicles", "special"];
|
||||
|
||||
createHashMapFromArray [
|
||||
["equipment", _equipmentRewards],
|
||||
["supplies", _supplyRewards],
|
||||
["weapons", _weaponRewards],
|
||||
["vehicles", _vehicleRewards],
|
||||
["special", _specialRewards]
|
||||
]
|
||||
}],
|
||||
|
||||
["startMission", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _hvtConfig = _self getOrDefault ["hvtConfig", configNull];
|
||||
private _locationData = _self call ["selectLocation", [_manager]];
|
||||
if (_locationData isEqualTo createHashMap) exitWith { "" };
|
||||
|
||||
private _position = _locationData getOrDefault ["position", [0, 0, 0]];
|
||||
private _grid = _locationData getOrDefault ["grid", mapGridPosition _position];
|
||||
private _buildingPositions = _locationData getOrDefault ["buildingPositions", []];
|
||||
|
||||
["INFO", format [
|
||||
"Capture HVT mission generator: selected location. Grid=%1, Position=%2",
|
||||
_grid,
|
||||
_position
|
||||
]] call EFUNC(common,log);
|
||||
|
||||
private _taskID = format ["task_capture_hvt_%1", round (diag_tickTime * 1000)];
|
||||
private _rewardRange = [_hvtConfig, ["Rewards", "money"], "moneyMin", "moneyMax", [50000, 120000]] call FUNC(getMissionSettingRange);
|
||||
private _reputationRange = [_hvtConfig, ["Rewards", "reputation"], "reputationMin", "reputationMax", [10, 22]] call FUNC(getMissionSettingRange);
|
||||
private _penaltyRange = [_hvtConfig, ["penalty"], "penaltyMin", "penaltyMax", [-14, -5]] call FUNC(getMissionSettingRange);
|
||||
private _timeRange = [_hvtConfig, ["timeLimit"], "timeLimitMin", "timeLimitMax", [900, 1800]] call FUNC(getMissionSettingRange);
|
||||
private _rewards = _self call ["rollRewards"];
|
||||
|
||||
private _spawnResult = _self call ["spawnHvtTarget", [_position, _buildingPositions]];
|
||||
if !(_spawnResult isEqualType [] && { count _spawnResult >= 2 }) exitWith { "" };
|
||||
private _hvtTarget = _spawnResult select 0;
|
||||
private _hvtGroupUnits = _spawnResult select 1;
|
||||
if (isNull _hvtTarget || _hvtGroupUnits isEqualTo []) exitWith { "" };
|
||||
|
||||
private _fundsReward = _rewardRange call BFUNC(randomNum);
|
||||
private _reputationReward = _reputationRange call BFUNC(randomNum);
|
||||
private _reputationPenalty = _penaltyRange call BFUNC(randomNum);
|
||||
private _timeLimit = _timeRange call BFUNC(randomNum);
|
||||
|
||||
private _extZone = format ["forge_hvt_ext_zone_%1", _taskID];
|
||||
private _extPos = [0, 0, 0];
|
||||
private _extZoneMarkers = allMapMarkers select {
|
||||
(toLowerANSI (markerText _x) find "extzone") == 0
|
||||
|| { (toLowerANSI _x find "extzone") == 0 }
|
||||
|| { (toLowerANSI (markerText _x) find "extmarker") == 0 }
|
||||
|| { (toLowerANSI _x find "extmarker") == 0 }
|
||||
};
|
||||
|
||||
if (_extZoneMarkers isNotEqualTo []) then {
|
||||
_extPos = getMarkerPos (selectRandom _extZoneMarkers);
|
||||
_extPos set [2, 0];
|
||||
} else {
|
||||
private _blkListMarkers = allMapMarkers select { markerShape _x in ["RECTANGLE", "ELLIPSE"] };
|
||||
_blkListMarkers = _blkListMarkers select {
|
||||
(
|
||||
(toLowerANSI _x find "blklist") == 0
|
||||
|| { (toLowerANSI (markerText _x) find "blklist") == 0 }
|
||||
|| { (toLowerANSI _x find "blkmarker") == 0 }
|
||||
|| { (toLowerANSI (markerText _x) find "blkmarker") == 0 }
|
||||
)
|
||||
&& { getMarkerPos _x distance2D [0, 0] > 0 }
|
||||
};
|
||||
|
||||
if (_blkListMarkers isNotEqualTo []) then {
|
||||
private _selectedBlk = selectRandom _blkListMarkers;
|
||||
private _attempt = 0;
|
||||
while { _attempt < 60 && { _extPos isEqualTo [0, 0, 0] } } do {
|
||||
_attempt = _attempt + 1;
|
||||
private _candidate = [getMarkerPos _selectedBlk, 0, 2000, 3, 0, 0.3, 0] call BFUNC(findSafePos);
|
||||
if (_candidate isEqualTo [0, 0, 0]) then { continue; };
|
||||
if !(_candidate inArea _selectedBlk) then { continue; };
|
||||
_candidate set [2, 0];
|
||||
_extPos = _candidate;
|
||||
};
|
||||
};
|
||||
|
||||
if (_extPos isEqualTo [0, 0, 0]) then {
|
||||
private _attempt = 0;
|
||||
while { _attempt < 80 && { _extPos isEqualTo [0, 0, 0] } } do {
|
||||
_attempt = _attempt + 1;
|
||||
private _probe = [random worldSize, random worldSize, 0];
|
||||
if ((_probe distance2D _position) < 2000) then { continue; };
|
||||
private _safe = [_probe, 0, 500, 3, 0, 0.3, 0] call BFUNC(findSafePos);
|
||||
if (_safe isEqualTo [0, 0, 0]) then { continue; };
|
||||
_safe set [2, 0];
|
||||
_extPos = _safe;
|
||||
};
|
||||
};
|
||||
|
||||
if (_extPos isEqualTo [0, 0, 0]) then {
|
||||
_extPos = _position vectorAdd [2500, 0, 0];
|
||||
_extPos set [2, 0];
|
||||
};
|
||||
};
|
||||
|
||||
createMarker [_extZone, _extPos];
|
||||
_extZone setMarkerShapeLocal "ELLIPSE";
|
||||
_extZone setMarkerSizeLocal [160, 160];
|
||||
_extZone setMarkerTextLocal format ["HVT Extraction Zone %1", _grid];
|
||||
_extZone setMarkerAlphaLocal 0.5;
|
||||
_extZone setMarkerBrushLocal "DiagGrid";
|
||||
_extZone setMarkerColor "ColorOrange";
|
||||
|
||||
private _success = [
|
||||
"hvt",
|
||||
_taskID,
|
||||
_position,
|
||||
format ["HVT: Grid %1", _grid],
|
||||
format ["Capture the high-value target near grid %1.", _grid],
|
||||
createHashMapFromArray [["hvts", [_hvtTarget]]],
|
||||
createHashMapFromArray [
|
||||
["limitFail", 0],
|
||||
["limitSuccess", 1],
|
||||
["extractionZone", _extZone],
|
||||
["captureHvt", true],
|
||||
["funds", _fundsReward],
|
||||
["ratingFail", _reputationPenalty],
|
||||
["ratingSuccess", _reputationReward],
|
||||
["endSuccess", false],
|
||||
["endFail", false],
|
||||
["timeLimit", _timeLimit],
|
||||
["equipment", _rewards get "equipment"],
|
||||
["supplies", _rewards get "supplies"],
|
||||
["weapons", _rewards get "weapons"],
|
||||
["vehicles", _rewards get "vehicles"],
|
||||
["special", _rewards get "special"]
|
||||
],
|
||||
0,
|
||||
"",
|
||||
"mission_manager"
|
||||
] call FUNC(startTask);
|
||||
|
||||
if !(_success) exitWith {
|
||||
deleteMarker _extZone;
|
||||
""
|
||||
};
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
_activeMissionRegistry set [_taskID, createHashMapFromArray [
|
||||
["generatorType", _self call ["getGeneratorType", []]],
|
||||
["position", _position],
|
||||
["markers", [_extZone]],
|
||||
["startedAt", serverTime]
|
||||
]];
|
||||
_manager set ["activeMissionRegistry", _activeMissionRegistry];
|
||||
|
||||
_taskID
|
||||
}],
|
||||
|
||||
["completeMission", compileFinal {
|
||||
params [
|
||||
["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]],
|
||||
["_taskID", "", [""]]
|
||||
];
|
||||
|
||||
if (_taskID isEqualTo "") exitWith { false };
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
private _missionRecord = _activeMissionRegistry getOrDefault [_taskID, createHashMap];
|
||||
if ((_missionRecord getOrDefault ["generatorType", ""]) isNotEqualTo (_self call ["getGeneratorType", []])) exitWith { false };
|
||||
|
||||
private _position = _missionRecord getOrDefault ["position", []];
|
||||
private _markers = _missionRecord getOrDefault ["markers", []];
|
||||
{
|
||||
if (_x isEqualType "" && { _x in allMapMarkers }) then {
|
||||
deleteMarker _x;
|
||||
};
|
||||
} forEach _markers;
|
||||
|
||||
_activeMissionRegistry deleteAt _taskID;
|
||||
_manager set ["activeMissionRegistry", _activeMissionRegistry];
|
||||
|
||||
if (_position isEqualType [] && { count _position >= 2 }) then {
|
||||
private _recentLocationRegistry = _manager getOrDefault ["recentLocationRegistry", []];
|
||||
_recentLocationRegistry pushBack [_position, serverTime];
|
||||
_manager set ["recentLocationRegistry", _recentLocationRegistry];
|
||||
};
|
||||
|
||||
true
|
||||
}]
|
||||
];
|
||||
@ -0,0 +1,395 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* Author: IDSolutions, Blackbox AI, MrPākehā
|
||||
* Defines the Defend mission generator base class used by the dynamic
|
||||
* mission manager. The generator selects a location, spawns required
|
||||
* entities, registers a Forge task, and cleans up manager state when the
|
||||
* task completes.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* N/A. Defines GVAR(DefendMissionGeneratorBaseClass) in missionNamespace.
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(DefendMissionGeneratorBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "DefendMissionGeneratorBaseClass"],
|
||||
["#create", compileFinal {
|
||||
private _missionConfig = missionConfigFile >> "CfgMissions";
|
||||
if !(isClass _missionConfig) then {
|
||||
_missionConfig = configFile >> "CfgMissions";
|
||||
};
|
||||
_self set ["missionConfig", _missionConfig];
|
||||
_self set ["aiGroupsConfig", (_missionConfig >> "AIGroups")];
|
||||
_self set ["defendConfig", (_missionConfig >> "MissionTypes" >> "Defend")];
|
||||
_self set ["generatorType", "defend"];
|
||||
["INFO", format ["Mission generator registered. Type=defend, ConfigPath=%1", _missionConfig]] call EFUNC(common,log);
|
||||
}],
|
||||
["getGeneratorType", compileFinal {
|
||||
_self getOrDefault ["generatorType", "defend"]
|
||||
}],
|
||||
["getMissionInterval", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _interval = getNumber (_missionConfig >> "missionInterval");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_interval = _settings getOrDefault ["missionInterval", _interval];
|
||||
};
|
||||
if (_interval <= 0) then { _interval = 300; };
|
||||
_interval
|
||||
}],
|
||||
["getMaxConcurrentMissions", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _settings = GETGVAR(missionSetup_settings,createHashMap);
|
||||
private _maxConcurrent = getNumber (_missionConfig >> "maxConcurrentMissions");
|
||||
if (_settings isEqualType createHashMap) then {
|
||||
_maxConcurrent = _settings getOrDefault ["maxConcurrentMissions", _maxConcurrent];
|
||||
};
|
||||
if (_maxConcurrent <= 0) then { _maxConcurrent = 1; };
|
||||
_maxConcurrent
|
||||
}],
|
||||
["getLocationReuseCooldown", compileFinal {
|
||||
private _missionConfig = _self getOrDefault ["missionConfig", configNull];
|
||||
private _cooldown = getNumber (_missionConfig >> "locationReuseCooldown");
|
||||
if (_cooldown <= 0) then { _cooldown = 900; };
|
||||
_cooldown
|
||||
}],
|
||||
["pruneRecentLocations", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _recentLocationRegistry = _manager getOrDefault ["recentLocationRegistry", []];
|
||||
private _reuseCooldown = _self call ["getLocationReuseCooldown", []];
|
||||
private _now = serverTime;
|
||||
|
||||
_recentLocationRegistry = _recentLocationRegistry select {
|
||||
private _usedAt = _x param [1, -1, [0]];
|
||||
(_usedAt >= 0) && { (_now - _usedAt) < _reuseCooldown }
|
||||
};
|
||||
|
||||
_manager set ["recentLocationRegistry", _recentLocationRegistry];
|
||||
_recentLocationRegistry
|
||||
}],
|
||||
["getActiveMissionPositions", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
private _positions = [];
|
||||
{
|
||||
if ((_y getOrDefault ["generatorType", ""]) isNotEqualTo "defend") then { continue; };
|
||||
|
||||
private _position = _y getOrDefault ["position", []];
|
||||
if (_position isEqualType [] && { count _position >= 2 }) then {
|
||||
_positions pushBack _position;
|
||||
};
|
||||
} forEach _activeMissionRegistry;
|
||||
_positions
|
||||
}],
|
||||
["selectLocation", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _worldSize = worldSize;
|
||||
private _center = [_worldSize / 2, _worldSize / 2, 0];
|
||||
private _safeDist = 800;
|
||||
private _playerPos = _center;
|
||||
private _minEdgeDist = _safeDist + 200;
|
||||
private _searchRadius = (_worldSize / 2 - _minEdgeDist) max 500;
|
||||
|
||||
private _recentLocationRegistry = _self call ["pruneRecentLocations", [_manager]];
|
||||
private _activeMissionPositions = _self call ["getActiveMissionPositions", [_manager]];
|
||||
|
||||
private _blkListMarkers = allMapMarkers select { markerShape _x in ["RECTANGLE", "ELLIPSE"] };
|
||||
_blkListMarkers = _blkListMarkers select {
|
||||
(
|
||||
(toLowerANSI _x find "blklist") == 0
|
||||
|| { (toLowerANSI (markerText _x) find "blklist") == 0 }
|
||||
)
|
||||
&& { getMarkerPos _x distance2D [0, 0] > 0 }
|
||||
};
|
||||
|
||||
private _taskPos = [];
|
||||
private _attempt = 0;
|
||||
private _maxAttempts = 50;
|
||||
|
||||
while { _attempt < _maxAttempts && { _taskPos isEqualTo [] } } do {
|
||||
_attempt = _attempt + 1;
|
||||
private _candidate = [_center, _searchRadius, _searchRadius, 3, 0, 0.3, 0] call BFUNC(findSafePos);
|
||||
|
||||
if (_candidate isEqualTo [0, 0, 0]) then { continue; };
|
||||
if (_candidate distance2D _playerPos < _safeDist) then { continue; };
|
||||
|
||||
private _isTooClose = false;
|
||||
{
|
||||
private _prevPos = _x param [0, [], [[]]];
|
||||
if (_prevPos isEqualType [] && { count _prevPos >= 2 } && { _candidate distance2D _prevPos < 500 }) exitWith {
|
||||
_isTooClose = true;
|
||||
};
|
||||
} forEach _recentLocationRegistry;
|
||||
|
||||
if (_isTooClose) then { continue; };
|
||||
|
||||
{
|
||||
if (_candidate distance2D _x < 500) exitWith {
|
||||
_isTooClose = true;
|
||||
};
|
||||
} forEach _activeMissionPositions;
|
||||
|
||||
if (_isTooClose) then { continue; };
|
||||
|
||||
private _inBlkList = false;
|
||||
{
|
||||
if (_candidate inArea _x) exitWith {
|
||||
_inBlkList = true;
|
||||
};
|
||||
} forEach _blkListMarkers;
|
||||
|
||||
if !(_inBlkList) then {
|
||||
_taskPos = _candidate;
|
||||
};
|
||||
};
|
||||
|
||||
if (_taskPos isEqualTo []) exitWith {
|
||||
["WARNING", "Defend mission generator: selectLocation failed to find a valid dynamic position."] call EFUNC(common,log);
|
||||
createHashMap
|
||||
};
|
||||
|
||||
createHashMapFromArray [
|
||||
["position", _taskPos],
|
||||
["grid", mapGridPosition _taskPos]
|
||||
]
|
||||
}],
|
||||
|
||||
["buildDefendTemplateGroups", compileFinal {
|
||||
params [['_position', [0, 0, 0], [[]]]];
|
||||
|
||||
private _aiGroupsConfig = _self getOrDefault ["aiGroupsConfig", configNull];
|
||||
private _defendConfig = _self getOrDefault ["defendConfig", configNull];
|
||||
private _groups = [];
|
||||
|
||||
{
|
||||
if ("defend" in getArray (_x >> "suitable")) then {
|
||||
_groups pushBack _x;
|
||||
};
|
||||
} forEach ("true" configClasses _aiGroupsConfig);
|
||||
|
||||
if (_groups isEqualTo []) then {
|
||||
{
|
||||
if ("attack" in getArray (_x >> "suitable")) then {
|
||||
_groups pushBack _x;
|
||||
};
|
||||
} forEach ("true" configClasses _aiGroupsConfig);
|
||||
};
|
||||
|
||||
private _side = GETMVAR(ENEMY_SIDE,east);
|
||||
private _sideText = str _side;
|
||||
[] call FUNC(updateEnemyCountFromActivePlayers);
|
||||
private _enemyMult = GETGVAR(enemyCountMultiplier,1);
|
||||
private _unitCountConfig = getArray (_defendConfig >> "unitsPerWave");
|
||||
private _minUnits = _unitCountConfig select 0;
|
||||
private _maxUnits = _unitCountConfig select 1;
|
||||
if (_minUnits <= 0) then { _minUnits = 4; };
|
||||
if (_maxUnits < _minUnits) then { _maxUnits = _minUnits; };
|
||||
_minUnits = floor ((_minUnits max 1) * _enemyMult);
|
||||
_maxUnits = ceil ((_maxUnits max _minUnits) * _enemyMult);
|
||||
if (_minUnits <= 0) then { _minUnits = 1; };
|
||||
if (_maxUnits < _minUnits) then { _maxUnits = _minUnits; };
|
||||
private _targetUnitCount = _minUnits + floor random ((_maxUnits - _minUnits) + 1);
|
||||
|
||||
private _enemyFaction = GETMVAR(ENEMY_FACTION_STR,GETMVAR(enemyFaction,"IND_G_F"));
|
||||
private _unitPool = [_enemyFaction, _side] call FUNC(getEnemyFactionUnitPool);
|
||||
|
||||
if (_unitPool isEqualTo [] && { _groups isNotEqualTo [] }) then {
|
||||
{
|
||||
if ((getText (_x >> "side")) isNotEqualTo _sideText) then { continue; };
|
||||
|
||||
{
|
||||
_unitPool pushBack createHashMapFromArray [
|
||||
["vehicle", getText (_x >> "vehicle")],
|
||||
["rank", getText (_x >> "rank")],
|
||||
["position", getArray (_x >> "position")]
|
||||
];
|
||||
} forEach ("true" configClasses (_x >> "Units"));
|
||||
} forEach _groups;
|
||||
};
|
||||
|
||||
if (_unitPool isEqualTo []) exitWith { [] };
|
||||
|
||||
private _templateGroup = [];
|
||||
for "_i" from 1 to _targetUnitCount do {
|
||||
private _unitDef = selectRandom _unitPool;
|
||||
private _unitClass = _unitDef getOrDefault ["vehicle", ""];
|
||||
if (_unitClass isNotEqualTo "") then {
|
||||
_templateGroup pushBack createHashMapFromArray [
|
||||
["type", _unitClass],
|
||||
["side", _side],
|
||||
["rank", _unitDef getOrDefault ["rank", "PRIVATE"]],
|
||||
["skill", 0.45 + random 0.25]
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
if (_templateGroup isEqualTo []) exitWith { [] };
|
||||
[_templateGroup]
|
||||
}],
|
||||
|
||||
["rollRewards", compileFinal {
|
||||
private _defendConfig = _self getOrDefault ["defendConfig", configNull];
|
||||
private _equipmentRewards = [];
|
||||
private _supplyRewards = [];
|
||||
private _weaponRewards = [];
|
||||
private _vehicleRewards = [];
|
||||
private _specialRewards = [];
|
||||
|
||||
{
|
||||
private _category = _x;
|
||||
{
|
||||
_x params ["_item", "_chance"];
|
||||
if (random 1 < _chance) then {
|
||||
switch (_category) do {
|
||||
case "equipment": { _equipmentRewards pushBack _item; };
|
||||
case "supplies": { _supplyRewards pushBack _item; };
|
||||
case "weapons": { _weaponRewards pushBack _item; };
|
||||
case "vehicles": { _vehicleRewards pushBack _item; };
|
||||
case "special": { _specialRewards pushBack _item; };
|
||||
};
|
||||
};
|
||||
} forEach (getArray (_defendConfig >> "Rewards" >> _category));
|
||||
} forEach ["equipment", "supplies", "weapons", "vehicles", "special"];
|
||||
|
||||
createHashMapFromArray [
|
||||
["equipment", _equipmentRewards],
|
||||
["supplies", _supplyRewards],
|
||||
["weapons", _weaponRewards],
|
||||
["vehicles", _vehicleRewards],
|
||||
["special", _specialRewards]
|
||||
]
|
||||
}],
|
||||
|
||||
["startMission", compileFinal {
|
||||
params [["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]]];
|
||||
|
||||
private _defendConfig = _self getOrDefault ["defendConfig", configNull];
|
||||
private _locationData = _self call ["selectLocation", [_manager]];
|
||||
if (_locationData isEqualTo createHashMap) exitWith { "" };
|
||||
|
||||
private _position = _locationData getOrDefault ["position", [0, 0, 0]];
|
||||
private _grid = _locationData getOrDefault ["grid", mapGridPosition _position];
|
||||
|
||||
private _taskID = format ["task_defend_%1", round (diag_tickTime * 1000)];
|
||||
private _rewardRange = [_defendConfig, ["Rewards", "money"], "moneyMin", "moneyMax", [40000, 90000]] call FUNC(getMissionSettingRange);
|
||||
private _reputationRange = [_defendConfig, ["Rewards", "reputation"], "reputationMin", "reputationMax", [8, 18]] call FUNC(getMissionSettingRange);
|
||||
private _penaltyRange = [_defendConfig, ["penalty"], "penaltyMin", "penaltyMax", [-12, -4]] call FUNC(getMissionSettingRange);
|
||||
private _timeRange = [_defendConfig, ["timeLimit"], "timeLimitMin", "timeLimitMax", [300, 1800]] call FUNC(getMissionSettingRange);
|
||||
private _rewards = _self call ["rollRewards"];
|
||||
private _enemyTemplates = _self call ["buildDefendTemplateGroups", [_position]];
|
||||
if (_enemyTemplates isEqualTo []) exitWith { "" };
|
||||
|
||||
private _fundsReward = _rewardRange call BFUNC(randomNum);
|
||||
private _reputationReward = _reputationRange call BFUNC(randomNum);
|
||||
private _reputationPenalty = _penaltyRange call BFUNC(randomNum);
|
||||
private _timeLimit = _timeRange call BFUNC(randomNum);
|
||||
|
||||
private _minWaves = getNumber (_defendConfig >> "minWaves");
|
||||
if (_minWaves <= 0) then { _minWaves = 3; };
|
||||
private _maxWaves = getNumber (_defendConfig >> "maxWaves");
|
||||
if (_maxWaves < _minWaves) then { _maxWaves = _minWaves; };
|
||||
private _limitSuccess = _minWaves + floor random ((_maxWaves - _minWaves) + 1);
|
||||
private _waveCooldown = getNumber (_defendConfig >> "waveCooldown");
|
||||
if (_waveCooldown <= 0) then { _waveCooldown = 300; };
|
||||
private _minBlufor = 1;
|
||||
|
||||
private _defenseZone = format ["forge_defend_zone_%1", _taskID];
|
||||
createMarker [_defenseZone, _position];
|
||||
_defenseZone setMarkerShapeLocal "ELLIPSE";
|
||||
_defenseZone setMarkerSizeLocal [25, 25];
|
||||
_defenseZone setMarkerTextLocal format ["Defense Zone %1", _grid];
|
||||
_defenseZone setMarkerAlphaLocal 0.5;
|
||||
_defenseZone setMarkerBrushLocal "DiagGrid";
|
||||
_defenseZone setMarkerColor "ColorOrange";
|
||||
|
||||
private _success = [
|
||||
"defend",
|
||||
_taskID,
|
||||
_position,
|
||||
format ["Defend: Grid %1", _grid],
|
||||
format ["Hold the area in and around grid %1.", _grid],
|
||||
createHashMapFromArray [],
|
||||
createHashMapFromArray [
|
||||
["limitFail", 0],
|
||||
["limitSuccess", _limitSuccess],
|
||||
["funds", _fundsReward],
|
||||
["ratingFail", _reputationPenalty],
|
||||
["ratingSuccess", _reputationReward],
|
||||
["endSuccess", false],
|
||||
["endFail", false],
|
||||
["timeLimit", _timeLimit],
|
||||
["equipment", _rewards get "equipment"],
|
||||
["supplies", _rewards get "supplies"],
|
||||
["weapons", _rewards get "weapons"],
|
||||
["vehicles", _rewards get "vehicles"],
|
||||
["special", _rewards get "special"],
|
||||
["defenseZone", _defenseZone],
|
||||
["defendTime", _timeLimit],
|
||||
["waveCount", _limitSuccess],
|
||||
["waveCooldown", _waveCooldown],
|
||||
["minBlufor", _minBlufor],
|
||||
["enemyTemplates", _enemyTemplates]
|
||||
],
|
||||
0,
|
||||
"",
|
||||
"mission_manager"
|
||||
] call FUNC(startTask);
|
||||
|
||||
if !(_success) exitWith {
|
||||
deleteMarker _defenseZone;
|
||||
""
|
||||
};
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
_activeMissionRegistry set [_taskID, createHashMapFromArray [
|
||||
["generatorType", _self call ["getGeneratorType", []]],
|
||||
["position", _position],
|
||||
["markers", [_defenseZone]],
|
||||
["startedAt", serverTime]
|
||||
]];
|
||||
_manager set ["activeMissionRegistry", _activeMissionRegistry];
|
||||
|
||||
_taskID
|
||||
}],
|
||||
|
||||
["completeMission", compileFinal {
|
||||
params [
|
||||
["_manager", createHashMapObject [createHashMapFromArray []], [createHashMap]],
|
||||
["_taskID", "", [""]]
|
||||
];
|
||||
|
||||
if (_taskID isEqualTo "") exitWith { false };
|
||||
|
||||
private _activeMissionRegistry = _manager getOrDefault ["activeMissionRegistry", createHashMap];
|
||||
private _missionRecord = _activeMissionRegistry getOrDefault [_taskID, createHashMap];
|
||||
if ((_missionRecord getOrDefault ["generatorType", ""]) isNotEqualTo (_self call ["getGeneratorType", []])) exitWith { false };
|
||||
|
||||
private _position = _missionRecord getOrDefault ["position", []];
|
||||
private _markers = _missionRecord getOrDefault ["markers", []];
|
||||
{
|
||||
if (_x isEqualType "" && { _x in allMapMarkers }) then {
|
||||
deleteMarker _x;
|
||||
};
|
||||
} forEach _markers;
|
||||
|
||||
_activeMissionRegistry deleteAt _taskID;
|
||||
_manager set ["activeMissionRegistry", _activeMissionRegistry];
|
||||
|
||||
if (_position isEqualType [] && { count _position >= 2 }) then {
|
||||
private _recentLocationRegistry = _manager getOrDefault ["recentLocationRegistry", []];
|
||||
_recentLocationRegistry pushBack [_position, serverTime];
|
||||
_manager set ["recentLocationRegistry", _recentLocationRegistry];
|
||||
};
|
||||
|
||||
true
|
||||
}]
|
||||
];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user