mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added cse_main source
This commit is contained in:
parent
c8f832bdca
commit
29af88b71b
22
TO_MERGE/cse/main/CfgFactionClasses.h
Normal file
22
TO_MERGE/cse/main/CfgFactionClasses.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class CfgFactionClasses
|
||||||
|
{
|
||||||
|
class NO_CATEGORY;
|
||||||
|
class cseModules: NO_CATEGORY {
|
||||||
|
displayName = "CSE Modules";
|
||||||
|
};
|
||||||
|
class cseDebug: NO_CATEGORY {
|
||||||
|
displayName = "CSE Debug";
|
||||||
|
};
|
||||||
|
class cseMisc: NO_CATEGORY {
|
||||||
|
displayName = "CSE Misc";
|
||||||
|
};
|
||||||
|
class cse_equipment: NO_CATEGORY {
|
||||||
|
displayName = "CSE Equipment";
|
||||||
|
};
|
||||||
|
class cse_medical: NO_CATEGORY {
|
||||||
|
displayName = "CSE Medical";
|
||||||
|
};
|
||||||
|
class cseCCModule: NO_CATEGORY {
|
||||||
|
displayName = "CSE Command & Control";
|
||||||
|
};
|
||||||
|
};
|
154
TO_MERGE/cse/main/CfgFunctions.h
Normal file
154
TO_MERGE/cse/main/CfgFunctions.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
class CfgFunctions {
|
||||||
|
class CSE {
|
||||||
|
class Strings {
|
||||||
|
file = "cse\cse_main\strings\functions";
|
||||||
|
class stringCompare { recompile = 1; };
|
||||||
|
class string_removeWhiteSpace { recompile = 1; };
|
||||||
|
};
|
||||||
|
class HC {
|
||||||
|
file = "cse\cse_main\hc\functions";
|
||||||
|
class isHC { recompile = 1; };
|
||||||
|
};
|
||||||
|
class Requests {
|
||||||
|
file = "cse\cse_main\requests\functions";
|
||||||
|
class sendRequest_f { recompile = 1; };
|
||||||
|
class requestCallback { recompile = 1; };
|
||||||
|
class receiveRequest { recompile = 1; };
|
||||||
|
class onAnswerRequest { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Debug {
|
||||||
|
file = "cse\cse_main\debug\functions";
|
||||||
|
class debug { recompile = 1; };
|
||||||
|
class debugModule { recompile = 1; };
|
||||||
|
class traceModule { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class TaskPool {
|
||||||
|
file = "cse\cse_main\tasks\functions";
|
||||||
|
class addTaskToPool_f { recompile = 1; };
|
||||||
|
class removeTaskFromPool_f { recompile = 1; };
|
||||||
|
class loopThroughPool_f { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Mutex {
|
||||||
|
file = "cse\cse_main\mutex\functions";
|
||||||
|
class createMutex { recompile = 1; };
|
||||||
|
class releaseMutex { recompile = 1; };
|
||||||
|
class waitForSingleMutex { recompile = 1; };
|
||||||
|
class waitForMultipleMutex { recompile = 1; };
|
||||||
|
class lockMutex { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Variables {
|
||||||
|
file = "cse\cse_main\variables\functions";
|
||||||
|
class defineVariable { recompile = 1; };
|
||||||
|
class setVariable { recompile = 1; };
|
||||||
|
class getVariable { recompile = 1; };
|
||||||
|
class getAllSetVariables { recompile = 1; };
|
||||||
|
class getVariableInfo { recompile = 1; };
|
||||||
|
class getVariableDefault { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Messages {
|
||||||
|
file = "cse\cse_main\messages\functions";
|
||||||
|
class sendHintTo { recompile = 1; };
|
||||||
|
class sendMessageTo { recompile = 1; };
|
||||||
|
class sendDisplayInformationTo { recompile = 1; };
|
||||||
|
class sendDisplayMessageTo { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Anim {
|
||||||
|
file = "cse\cse_main\anim\functions";
|
||||||
|
class broadcastAnim { recompile = 1; };
|
||||||
|
class getDeathAnim { recompile = 1; };
|
||||||
|
class switchAnim { recompile = 1; };
|
||||||
|
class playMoveNow { recompile = 1; };
|
||||||
|
class localAnim { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Arrays {
|
||||||
|
file = "cse\cse_main\arrays\functions";
|
||||||
|
class insertionSort { recompile = 1; };
|
||||||
|
class findIf { recompile = 1; };
|
||||||
|
class findIn { recompile = 1; };
|
||||||
|
class findAll { recompile = 1; };
|
||||||
|
class uniqueElementsOnly { recompile = 1; };
|
||||||
|
class foreachDo { recompile = 1; };
|
||||||
|
class sortAlphabeticallyBy { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class EquipmentLib {
|
||||||
|
file = "cse\cse_main\equipment\functions";
|
||||||
|
class hasMagazine { recompile = 1; };
|
||||||
|
class useMagazine { recompile = 1; };
|
||||||
|
class findMagazine { recompile = 1; };
|
||||||
|
class hasItem { recompile = 1; };
|
||||||
|
class useItem { recompile = 1; };
|
||||||
|
class findItem { recompile = 1; };
|
||||||
|
class getNumberMagazinesIn { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
class Interaction {
|
||||||
|
file = "cse\cse_main\interaction\functions";
|
||||||
|
class registerInteractingWith { recompile = 1; };
|
||||||
|
class getInteractionTarget { recompile = 1; };
|
||||||
|
class isRegisteredInteractingWith { recompile = 1; };
|
||||||
|
class unregisterInteractingWith { recompile = 1; };
|
||||||
|
class getAllMonitoredVariables { recompile = 1; };
|
||||||
|
class registerVariableMonitor { recompile = 1; };
|
||||||
|
class setOnUpdateVariableEH { recompile = 1; };
|
||||||
|
class getOnUpdateVariableEH { recompile = 1; };
|
||||||
|
class getRegisteredMonitorVariablesOwners { recompile = 1; };
|
||||||
|
class getMonitoredVariableName { recompile = 1; };
|
||||||
|
class getMonitoredVariableValue { recompile = 1; };
|
||||||
|
class setMonitoredVariableValue { recompile = 1; };
|
||||||
|
class broadcastMonitoredVariable { recompile = 1; };
|
||||||
|
class setCanInteract { recompile = 1; };
|
||||||
|
class getCanInteract { recompile = 1; };
|
||||||
|
class canInteract { recompile = 1; };
|
||||||
|
};
|
||||||
|
class Misc {
|
||||||
|
file = "cse\cse_main\misc\functions";
|
||||||
|
class resetAllDefaults_f { recompile = 1; };
|
||||||
|
class broadcastSound3D_f { recompile = 1; };
|
||||||
|
class getName { recompile = 1; };
|
||||||
|
class setDead { recompile = 1; };
|
||||||
|
class isAwake { recompile = 1; };
|
||||||
|
class setProne { recompile = 1; };
|
||||||
|
class isInBuilding { recompile = 1; };
|
||||||
|
class disableKeyInput_f { recompile = 1; };
|
||||||
|
class disableUserInput_f { recompile = 1; };
|
||||||
|
class dropWeapon_f { recompile = 1; };
|
||||||
|
class inWater_f { recompile = 1; };
|
||||||
|
class setVolume_f { recompile = 1; };
|
||||||
|
class lockVehicleOfUnitUntil { recompile = 1; };
|
||||||
|
class closeAllDialogs_f { recompile = 1; };
|
||||||
|
class disableAI_f { recompile = 1; };
|
||||||
|
class moduleEnableBasicRevive { recompile = 1; };
|
||||||
|
class switchToGroupSide_f { recompile = 1; };
|
||||||
|
class hasItem_f { recompile = 1; };
|
||||||
|
class getFirstObjectIntersection { recompile = 1; };
|
||||||
|
class getFirstTerrainIntersection { recompile = 1; };
|
||||||
|
class setHearingCapability { recompile = 1; };
|
||||||
|
class revealObject_f { recompile = 1; };
|
||||||
|
class getWeaponItems_f { recompile = 1; };
|
||||||
|
};
|
||||||
|
class Mods {
|
||||||
|
file = "cse\cse_main\mods\functions";
|
||||||
|
class ALiVE_Bus_Mod { recompile = 1; };
|
||||||
|
class isLoaded_ALiVE_Mod { recompile = 1; };
|
||||||
|
class isModLoaded_f { recompile = 1; };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Config {
|
||||||
|
file = "cse\cse_main\config\functions";
|
||||||
|
class inheritsFrom;
|
||||||
|
};
|
||||||
|
class Version {
|
||||||
|
file = "cse\cse_main\version\functions";
|
||||||
|
class getVersion;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
27
TO_MERGE/cse/main/CfgHints.h
Normal file
27
TO_MERGE/cse/main/CfgHints.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class CfgHints
|
||||||
|
{
|
||||||
|
class Combat_Space_Enhancement
|
||||||
|
{
|
||||||
|
displayName = "Combat Space Enhancement";
|
||||||
|
class Main
|
||||||
|
{
|
||||||
|
displayName = "Combat Space Enhancement";
|
||||||
|
displayNameShort = "Combat Space Enhancement";
|
||||||
|
description = "Combat Space Enhancement is a standalone modification for the game Arma III and is developed by the team behind Combat Medical System. All features from CSE are build on top of our in house developed framework, allowing for compatibility between various modules/features with ease by both our in house created modules and any third party made content.";
|
||||||
|
tip = "";
|
||||||
|
arguments[] = {};
|
||||||
|
image = "";
|
||||||
|
noImage = true;
|
||||||
|
};
|
||||||
|
class Credits
|
||||||
|
{
|
||||||
|
displayName = "Credits";
|
||||||
|
displayNameShort = "Credits";
|
||||||
|
description = "Glowbal, Project Lead & lead developer (Scripting, Graphics, Design) %2Kieran, Webmaster %2Rye, PR & Testing %1%1Contributions by:%2Aposky, Artist (Graphics & Models)%2Janus, Artist (Graphics & Models)%2DocScarle (Medical Knowledge)%2-FM- (Medical Knowledge)%2Carrot (Medical Knowledge)%2Ogirdor (Graphics)%2Beardmoresam (Medical Knowledge)%2Raptor 6 Actual (Medical Knowledge)%2Bovine3dom (Some script contributions & assistance with calculations)%2Donny (Models)%2Deadman (Graphics & Models)%1%1Additional:%2This project contains some free icons by http://icons8.com/%2ALIVE Team (ALiVE & CSE integration)%2LondonLad (Allowing use of dedicated server for testing)%2bodybag.p3d file and textures by Bohemia Interactive.";
|
||||||
|
tip = "";
|
||||||
|
arguments[] = {};
|
||||||
|
image = "";
|
||||||
|
noImage = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
115
TO_MERGE/cse/main/CfgVehicles.h
Normal file
115
TO_MERGE/cse/main/CfgVehicles.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
#include "CfgFactionClasses.h"
|
||||||
|
|
||||||
|
class CfgVehicles {
|
||||||
|
class Logic;
|
||||||
|
class Module_F: Logic {
|
||||||
|
class ArgumentsBaseUnits {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class cse_enableLogging: Module_F {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "Logging [CSE]";
|
||||||
|
icon = "\cse\cse_main\data\cse_logging_icon.paa";
|
||||||
|
category = "cseDebug";
|
||||||
|
function = "cse_fnc_debugModule";
|
||||||
|
functionPriority = 1;
|
||||||
|
isGlobal = 1;
|
||||||
|
isTriggerActivated = 0;
|
||||||
|
class Arguments {
|
||||||
|
class logLevel {
|
||||||
|
displayName = "Enable Logging at";
|
||||||
|
description = "The maximum level of logging";
|
||||||
|
typeName = "STRING";
|
||||||
|
class values {
|
||||||
|
class NONE {name="None"; value=4; default=1; };
|
||||||
|
class INFO {name="Information"; value=3; };
|
||||||
|
class DEBUG {name="Debug"; value=2; };
|
||||||
|
class WARN {name="Warnings"; value=1; };
|
||||||
|
class ERROR {name="Errors"; value=0; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class logDisplayLevel {
|
||||||
|
displayName = "Show in chat";
|
||||||
|
description = "The maximum level of log messages to be shown in chat";
|
||||||
|
typeName = "STRING";
|
||||||
|
class values {
|
||||||
|
class NONE {name="None"; value=4; default=1; };
|
||||||
|
class INFO {name="Information"; value=3; };
|
||||||
|
class DEBUG {name="Debug"; value=2; };
|
||||||
|
class WARN {name="Warnings"; value=1; };
|
||||||
|
class ERROR {name="Errors"; value=0; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class ModuleDescription {
|
||||||
|
description = "Lets you modify the logging settings within CSE."; // Short description, will be formatted as structured text
|
||||||
|
sync[] = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class cse_traceValuesObject: Module_F {
|
||||||
|
|
||||||
|
scope = 2;
|
||||||
|
displayName = "Trace variables [CSE]";
|
||||||
|
icon = "\cse\cse_main\data\cse_debug_icon.paa";
|
||||||
|
category = "cseDebug";
|
||||||
|
function = "cse_fnc_traceModule";
|
||||||
|
functionPriority = 1;
|
||||||
|
isGlobal = 1;
|
||||||
|
isTriggerActivated = 1;
|
||||||
|
class Arguments {
|
||||||
|
class enableFor {
|
||||||
|
displayName = "Trace player variables";
|
||||||
|
description = "Whatever or not a debug message will be printed when a value for a player changes";
|
||||||
|
typeName = "STRING";
|
||||||
|
class values {
|
||||||
|
class DISABLED {name="Disable"; value=0; default=1; };
|
||||||
|
class ENABLE {name="Enable"; value=1; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class ModuleDescription {
|
||||||
|
description = "Trace variables of given object"; // Short description, will be formatted as structured text
|
||||||
|
sync[] = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class cse_basicRevive: Module_F {
|
||||||
|
scope = 2;
|
||||||
|
displayName = "Basic Revive [CSE]";
|
||||||
|
icon = "\cse\cse_main\data\cse_medical_module.paa";
|
||||||
|
category = "cse_medical";
|
||||||
|
function = "cse_fnc_initalizeModule_F";
|
||||||
|
functionPriority = 1;
|
||||||
|
isGlobal = 1;
|
||||||
|
isTriggerActivated = 0;
|
||||||
|
class Arguments {
|
||||||
|
class enableFor {
|
||||||
|
displayName = "Enable for";
|
||||||
|
description = "Should the basic revive be enabled for players, AI or both?";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
class values {
|
||||||
|
class disable {name="Disable"; value=0; default=1; };
|
||||||
|
class playersOnly {name="Players only"; value=1; };
|
||||||
|
class playersAndAI { name="Players and AI"; value = 2; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class timer {
|
||||||
|
displayName = "Timer";
|
||||||
|
description = "How long can a unit spend in unconscious mode (In seconds)";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
defaultValue = 600;
|
||||||
|
};
|
||||||
|
class amountOf {
|
||||||
|
displayName = "Hits while unconscious";
|
||||||
|
description = "number of times a unit can be hit/killed before being force killed. -1 is disabled.";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
defaultValue = -1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class ModuleDescription {
|
||||||
|
description = "Enables the basic revive script for all damage done through CSE. <br />Any unit that is killed, will be put in an unconscious state until their timer runs out.";
|
||||||
|
sync[] = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
60
TO_MERGE/cse/main/Combat_Space_Enhancement.h
Normal file
60
TO_MERGE/cse/main/Combat_Space_Enhancement.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#define MENU_KEYBINDING 1
|
||||||
|
#define ACTION_KEYBINDING 2
|
||||||
|
#define CLIENT_SETTING 3
|
||||||
|
|
||||||
|
class Combat_Space_Enhancement
|
||||||
|
{
|
||||||
|
class EventHandlers {
|
||||||
|
class PostInit_EventHandlers {
|
||||||
|
class cse_main {
|
||||||
|
init = " call compile preprocessFile 'cse\cse_main\init.sqf';";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class cfgModules {
|
||||||
|
class cse_main {
|
||||||
|
init = "";
|
||||||
|
name = "Main";
|
||||||
|
class EventHandlers {
|
||||||
|
class CAManBase {
|
||||||
|
respawn = "_this call cse_fnc_resetAllDefaults_F;";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Configurations {
|
||||||
|
class ActionAcceptRequest_f {
|
||||||
|
type = ACTION_KEYBINDING;
|
||||||
|
title = $STR_CSE_ACTION_ACCEPT_REQUEST_KEY_TITLE;
|
||||||
|
description = $STR_CSE_ACTION_ACCEPT_REQUEST_KEY_TOOLTIP;
|
||||||
|
value[] = {0,0,0,0};
|
||||||
|
onPressed = "if (!isnil 'CSE_RECIEVE_REQUEST_ID_KEY_BINDING') then {[player,CSE_RECIEVE_REQUEST_ID_KEY_BINDING, true] call cse_fnc_onAnswerRequest;};";
|
||||||
|
};
|
||||||
|
class ActionDeclineRequest_f {
|
||||||
|
type = ACTION_KEYBINDING;
|
||||||
|
title = $STR_CSE_ACTION_DECLINE_REQUEST_KEY_TITLE;
|
||||||
|
description = $STR_CSE_ACTION_DECLINE_REQUEST_KEY_TOOLTIP;
|
||||||
|
value[] = {0,0,0,0};
|
||||||
|
onPressed = "if (!isnil 'CSE_RECIEVE_REQUEST_ID_KEY_BINDING') then {[player,CSE_RECIEVE_REQUEST_ID_KEY_BINDING, false] call cse_fnc_onAnswerRequest;};";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class cse_basicRevive {
|
||||||
|
init = "_this call cse_fnc_moduleEnableBasicRevive;";
|
||||||
|
name = "Basic Revive";
|
||||||
|
};
|
||||||
|
|
||||||
|
class cse_basic_revive : cse_basicRevive {
|
||||||
|
init = "_this call cse_fnc_moduleEnableBasicRevive; ['Incorrect basic revive classname. Please change cse_basic_revive to cse_basicRevive in your enabledModules_sample.hpp file.'] call BIS_fnc_error; ";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class CustomEventHandlers {
|
||||||
|
class variableDefined {}; // [_name,_value,_defaultGlobal,_catagory,_code, _persistent]
|
||||||
|
class AddedTotaskPool {}; // [_args, _code]
|
||||||
|
class killed {}; // [unit, bool]
|
||||||
|
class setVolume {}; // [bool]
|
||||||
|
class disableKeyInput {}; // [bool]
|
||||||
|
class switchToGroupSide {}; // [unit, bool, id (String), side]
|
||||||
|
class resetToDefaults {}; // [unit]
|
||||||
|
};
|
||||||
|
};
|
21
TO_MERGE/cse/main/anim/functions/fn_broadcastAnim.sqf
Normal file
21
TO_MERGE/cse/main/anim/functions/fn_broadcastAnim.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* fn_broadcastAnim.sqf
|
||||||
|
* @Descr: Broadcast an animation across the network using switchMove
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECt, animation STRING]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_unit","_anim","_persistent"];
|
||||||
|
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_anim = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (count _this >2) then {
|
||||||
|
_persistent = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||||
|
[[_unit,_anim], "cse_fnc_switchAnim", true, _persistent] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
[[_unit,_anim], "cse_fnc_switchAnim", true, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
33
TO_MERGE/cse/main/anim/functions/fn_getDeathAnim.sqf
Normal file
33
TO_MERGE/cse/main/anim/functions/fn_getDeathAnim.sqf
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* fn_getDeathAnim.sqf
|
||||||
|
* @Descr: Get the death animation for the unit at current time
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: STRING animation
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_unit", "_curAnim", "_animation", "_cfg","_unitAnimation", "_animationState"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_animation = "";
|
||||||
|
_animationState = (animationState _unit);
|
||||||
|
_unitAnimation = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
|
||||||
|
if (isText (_unitAnimation >> "actions")) then {
|
||||||
|
if ((vehicle _unit) != _unit) then {
|
||||||
|
_cfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
|
||||||
|
if (isArray (_cfg >> "interpolateTo")) then {
|
||||||
|
_animation = getArray (_cfg >> "interpolateTo") select 0;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_cfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimation >> "actions")) >> "die");
|
||||||
|
if (isText _cfg) then {
|
||||||
|
_animation = getText _cfg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isnil "_animation") then {
|
||||||
|
_animation = "";
|
||||||
|
};
|
||||||
|
_animation
|
24
TO_MERGE/cse/main/anim/functions/fn_localAnim.sqf
Normal file
24
TO_MERGE/cse/main/anim/functions/fn_localAnim.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* fn_localAnim.sqf
|
||||||
|
* @Descr: Play an animation on a local machine using playMoveNow
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, animation STRING]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_anim","_persistent"];
|
||||||
|
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_anim = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (!local _unit) then {
|
||||||
|
if (count _this >2) then {
|
||||||
|
_persistent = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||||
|
[[_unit,_anim], "cse_fnc_playMoveNow", _unit, _persistent] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
[[_unit,_anim], "cse_fnc_playMoveNow", _unit, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
[_unit,_anim] call cse_fnc_playMoveNow;
|
||||||
|
};
|
14
TO_MERGE/cse/main/anim/functions/fn_playMoveNow.sqf
Normal file
14
TO_MERGE/cse/main/anim/functions/fn_playMoveNow.sqf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_playMoveNow.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit", "_anim"];
|
||||||
|
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_Param;
|
||||||
|
_anim = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
_unit playMoveNow _anim;
|
15
TO_MERGE/cse/main/anim/functions/fn_switchAnim.sqf
Normal file
15
TO_MERGE/cse/main/anim/functions/fn_switchAnim.sqf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* fn_switchAnim.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit", "_anim"];
|
||||||
|
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_Param;
|
||||||
|
_anim = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
_unit switchMove _anim;
|
||||||
|
_unit playMove _anim;
|
22
TO_MERGE/cse/main/arrays/functions/fn_findAll.sqf
Normal file
22
TO_MERGE/cse/main/arrays/functions/fn_findAll.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_findAll.sqf
|
||||||
|
* @Descr: Find all elements for which the code returns true
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY, if CODE (Code called for each element. Should return a bool)]
|
||||||
|
* @Return: ARRAY Array with elements for which the if code returned true.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_if", "_return"];
|
||||||
|
_array = _this select 0;
|
||||||
|
_if = _this select 1;
|
||||||
|
|
||||||
|
_return = [];
|
||||||
|
{
|
||||||
|
if (_x call _if) then {
|
||||||
|
_return pushback _x;
|
||||||
|
};
|
||||||
|
}foreach _array;
|
||||||
|
|
||||||
|
_return;
|
22
TO_MERGE/cse/main/arrays/functions/fn_findIf.sqf
Normal file
22
TO_MERGE/cse/main/arrays/functions/fn_findIf.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_findIf.sqf
|
||||||
|
* @Descr: Get the first element that returns true.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY, if CODE (Code called for each element. Should return a bool)]
|
||||||
|
* @Return: ANY. Any element. Default return is an empty array ([])
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_if"];
|
||||||
|
_array = _this select 0;
|
||||||
|
_if = _this select 1;
|
||||||
|
|
||||||
|
_return = [];
|
||||||
|
{
|
||||||
|
if (_x call _if) exitwith {
|
||||||
|
_return = _array select _foreachIndex;
|
||||||
|
};
|
||||||
|
}foreach _array;
|
||||||
|
|
||||||
|
_return;
|
22
TO_MERGE/cse/main/arrays/functions/fn_findIn.sqf
Normal file
22
TO_MERGE/cse/main/arrays/functions/fn_findIn.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_findIn.sqf
|
||||||
|
* @Descr: Get the index of the first element that is equal to compare value
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY, value ANY (The compared value)]
|
||||||
|
* @Return: NUMBER (-1 is not found. Else index of element in array)
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_value", "_return"];
|
||||||
|
_array = _this select 0;
|
||||||
|
_value = _this select 1;
|
||||||
|
|
||||||
|
_return = -1;
|
||||||
|
{
|
||||||
|
if (_x isEqualTo _value) exitwith {
|
||||||
|
_return = _foreachIndex;
|
||||||
|
};
|
||||||
|
}foreach _array;
|
||||||
|
|
||||||
|
_return;
|
21
TO_MERGE/cse/main/arrays/functions/fn_foreachDo.sqf
Normal file
21
TO_MERGE/cse/main/arrays/functions/fn_foreachDo.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* fn_foreachDo.sqf
|
||||||
|
* @Descr: Execute code for each element in an array and collect the return values.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY, do CODE (Code executed for each element)]
|
||||||
|
* @Return: ARRAY Array with return values.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_do", "_return"];
|
||||||
|
_array = _this select 0;
|
||||||
|
_do = _this select 1;
|
||||||
|
|
||||||
|
_return = [];
|
||||||
|
{
|
||||||
|
_return pushback(_x call _do);
|
||||||
|
false;
|
||||||
|
}count _array;
|
||||||
|
|
||||||
|
_return;
|
32
TO_MERGE/cse/main/arrays/functions/fn_insertionSort.sqf
Normal file
32
TO_MERGE/cse/main/arrays/functions/fn_insertionSort.sqf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* fn_insertionSort.sqf
|
||||||
|
* @Descr: Sorts an array of numbers
|
||||||
|
* @Author: Ruthberg
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY, (optional) ascending BOOL]
|
||||||
|
* @Return: sortedArray ARRAY
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_list", "_ascending", "_tmp", "_i", "_j"];
|
||||||
|
_list = +(_this select 0);
|
||||||
|
_ascending = true;
|
||||||
|
if (count _this > 1) then {
|
||||||
|
_ascending = _this select 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
for "_i" from 1 to (count _list) - 1 do {
|
||||||
|
_tmp = _list select _i;
|
||||||
|
_j = _i;
|
||||||
|
while {_j >= 1 && {_tmp < _list select (_j - 1)}} do {
|
||||||
|
_list set [_j, _list select (_j - 1)];
|
||||||
|
_j = _j - 1;
|
||||||
|
};
|
||||||
|
_list set[_j, _tmp];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_ascending) then {
|
||||||
|
reverse _list;
|
||||||
|
};
|
||||||
|
|
||||||
|
_list
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* fn_sortAlphabeticallyBy.sqf
|
||||||
|
* @Descr:
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_elements", "_elementN", "_indexes", "_theElement", "_tmp", "_tempIndex", "_j", "_i", "_returnArray"];
|
||||||
|
_array = _this select 0;
|
||||||
|
_elementN = _this select 1;
|
||||||
|
|
||||||
|
_indexes = [];
|
||||||
|
_elements = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_theElement = toArray (_x select _elementN);
|
||||||
|
_indexes pushback _foreachIndex;
|
||||||
|
_elements pushback _theElement;
|
||||||
|
}foreach _array;
|
||||||
|
|
||||||
|
for "_i" from 1 to (count _elements) - 1 do {
|
||||||
|
_tmp = _elements select _i;
|
||||||
|
_tempIndex = _indexes select _i;
|
||||||
|
_j = _i;
|
||||||
|
while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do {
|
||||||
|
_elements set [_j, _elements select (_j - 1)];
|
||||||
|
_indexes set [_j, _indexes select (_j - 1)];
|
||||||
|
_j = _j - 1;
|
||||||
|
};
|
||||||
|
_elements set[_j, _tmp];
|
||||||
|
_indexes set [_j, _tempIndex];
|
||||||
|
};
|
||||||
|
|
||||||
|
_returnArray = [];
|
||||||
|
{
|
||||||
|
_returnArray pushback (_array select _x);
|
||||||
|
}foreach _indexes;
|
||||||
|
|
||||||
|
_returnArray;
|
22
TO_MERGE/cse/main/arrays/functions/fn_uniqueElementsOnly.sqf
Normal file
22
TO_MERGE/cse/main/arrays/functions/fn_uniqueElementsOnly.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_uniqueElementsOnly.sqf
|
||||||
|
* @Descr: Make a copy of an array with only the unique elements.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [array ARRAY]
|
||||||
|
* @Return: ARRAY Copy of original array
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_array", "_result", "_value"];
|
||||||
|
_array = _this select 0;
|
||||||
|
|
||||||
|
_result = [];
|
||||||
|
{
|
||||||
|
_value = _x;
|
||||||
|
if ({_x isEqualTo _value} count _result == 0) then {
|
||||||
|
_result pushback _x;
|
||||||
|
};
|
||||||
|
}foreach _array;
|
||||||
|
|
||||||
|
_result;
|
33
TO_MERGE/cse/main/config.cpp
Normal file
33
TO_MERGE/cse/main/config.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
class CfgPatches
|
||||||
|
{
|
||||||
|
class cse_main
|
||||||
|
{
|
||||||
|
units[] = {};
|
||||||
|
weapons[] = {};
|
||||||
|
requiredVersion = 0.1;
|
||||||
|
requiredAddons[] = {"A3_Modules_F", "cse_f_eh"};
|
||||||
|
version = "0.10.0_rc";
|
||||||
|
author[] = {"Combat Space Enhancement"};
|
||||||
|
authorUrl = "http://csemod.com";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class CfgAddons {
|
||||||
|
class PreloadAddons {
|
||||||
|
class cse_main {
|
||||||
|
list[] = {"cse_main"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class CfgUnitInsignia {
|
||||||
|
class CSE {
|
||||||
|
displayName = "Combat Space Enhancement"; // Name displayed in Arsenal
|
||||||
|
author = "Combat Space Enhancement"; // Author displayed in Arsenal
|
||||||
|
texture = "\cse\cse_main\data\cse_insignia.paa"; // Image path
|
||||||
|
textureVehicle = ""; // Does nothing currently, reserved for future use
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "Combat_Space_Enhancement.h"
|
||||||
|
#include "CfgVehicles.h"
|
||||||
|
#include "CfgFunctions.h"
|
||||||
|
#include "CfgHints.h"
|
24
TO_MERGE/cse/main/config/functions/fn_inheritsFrom.sqf
Normal file
24
TO_MERGE/cse/main/config/functions/fn_inheritsFrom.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* fn_inheritsFrom.sqf
|
||||||
|
* @Descr: Checks whether a given configuration name appears in the inheritance tree of a specific configuration entry.
|
||||||
|
* @Author: Ruthberg
|
||||||
|
*
|
||||||
|
* @Arguments: [configEntry CONFIG, configname STRING]
|
||||||
|
* @Return: BOOL
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_configEntry","_configMatch", "_match"];
|
||||||
|
_configEntry = _this select 0;
|
||||||
|
_configMatch = _this select 1;
|
||||||
|
|
||||||
|
if (configName _configEntry == _configMatch) exitWith { true };
|
||||||
|
if (configName _configEntry == ",") exitWith { false };
|
||||||
|
|
||||||
|
_match = false;
|
||||||
|
while {configName _configEntry != ""} do {
|
||||||
|
if (configName _configEntry == _configMatch) exitWith { _match = true };
|
||||||
|
_configEntry = inheritsFrom(_configEntry);
|
||||||
|
};
|
||||||
|
|
||||||
|
_match
|
BIN
TO_MERGE/cse/main/data/cse_aim_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_aim_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_backblast_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_backblast_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_ballistics_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_ballistics_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_basic_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_basic_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_cc_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_cc_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_debug_icon.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_debug_icon.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_earmuffs_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_earmuffs_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_explosive_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_explosive_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_groups_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_groups_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_logging_icon.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_logging_icon.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_medical_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_medical_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_nvg_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_nvg_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_rifle_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_rifle_module.paa
Normal file
Binary file not shown.
BIN
TO_MERGE/cse/main/data/cse_tags_module.paa
Normal file
BIN
TO_MERGE/cse/main/data/cse_tags_module.paa
Normal file
Binary file not shown.
9
TO_MERGE/cse/main/debug/Debug.h
Normal file
9
TO_MERGE/cse/main/debug/Debug.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// debug constants
|
||||||
|
|
||||||
|
#define ERROR 0
|
||||||
|
#define WARN 1
|
||||||
|
#define DEBUG 2
|
||||||
|
#define INFO 3
|
||||||
|
#define NONE 4
|
||||||
|
|
||||||
|
#define DEFAULTLOGLEVEL INFO
|
66
TO_MERGE/cse/main/debug/functions/fn_debug.sqf
Normal file
66
TO_MERGE/cse/main/debug/functions/fn_debug.sqf
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* fn_debug.sqf
|
||||||
|
* @Descr: Print logging messages through the CSE framework.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [message ANY, level NUMBER (Optional)]
|
||||||
|
* @Return: BOOL True if message has been printed
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ERROR 0
|
||||||
|
#define WARN 1
|
||||||
|
#define DEBUG 2
|
||||||
|
#define INFO 3
|
||||||
|
#define NONE 4
|
||||||
|
|
||||||
|
#define DEFAULTLOGLEVEL NONE
|
||||||
|
#define DEFAULTTEXTDISPLAY WARN
|
||||||
|
|
||||||
|
private ["_msg", "_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLevel", "_message", "_from"];
|
||||||
|
_msg = _this select 0;
|
||||||
|
_level = _this select 1;
|
||||||
|
|
||||||
|
if (isNil "CSE_LOGLEVEL") then {
|
||||||
|
_defaultLoglevel = DEFAULTLOGLEVEL;
|
||||||
|
} else {
|
||||||
|
_defaultLoglevel = CSE_LOGLEVEL;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isnil "CSE_LOGDISPLAY_LEVEL") then {
|
||||||
|
_defaultLogDisplayLevel = DEFAULTTEXTDISPLAY;
|
||||||
|
} else {
|
||||||
|
_defaultLogDisplayLevel = CSE_LOGDISPLAY_LEVEL;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil "_level") then {
|
||||||
|
_level = DEBUG;
|
||||||
|
};
|
||||||
|
if (_defaultLoglevel == 4) exitwith {false};
|
||||||
|
if (_level <= _defaultLoglevel) then {
|
||||||
|
switch (_level) do {
|
||||||
|
case ERROR: { _prefix = "CSE Error" };
|
||||||
|
case WARN: { _prefix = "CSE Warn" };
|
||||||
|
case DEBUG: { _prefix = "CSE Debug" };
|
||||||
|
case INFO: { _prefix = "CSE Info" };
|
||||||
|
default { _prefix = "CSE Unknown" };
|
||||||
|
};
|
||||||
|
_message = format["[%1] %2",_prefix,_msg];
|
||||||
|
|
||||||
|
if (isnil "CSE_LOGIC_OBJECT") then {
|
||||||
|
_group = createGroup sideLogic;
|
||||||
|
CSE_LOGIC_OBJECT = _group createUnit ["logic", [1,1,1], [], 0, "FORM"];
|
||||||
|
};
|
||||||
|
if (isNull CSE_LOGIC_OBJECT) then {
|
||||||
|
_group = createGroup sideLogic;
|
||||||
|
CSE_LOGIC_OBJECT = _group createUnit ["logic", [1,1,1], [], 0, "FORM"];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (_level <= _defaultLogDisplayLevel) then {
|
||||||
|
showChat true;
|
||||||
|
CSE_LOGIC_OBJECT globalChat _message;
|
||||||
|
};
|
||||||
|
diag_log _message;
|
||||||
|
};
|
||||||
|
true
|
15
TO_MERGE/cse/main/debug/functions/fn_debugModule.sqf
Normal file
15
TO_MERGE/cse/main/debug/functions/fn_debugModule.sqf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* fn_debugModule.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_entity"];
|
||||||
|
_entity = _this select 0;
|
||||||
|
|
||||||
|
CSE_LOGDISPLAY_LEVEL = call compile (_entity getvariable ["logDisplayLevel","4"]);
|
||||||
|
CSE_LOGLEVEL = call compile (_entity getvariable ["logLevel","4"]);
|
23
TO_MERGE/cse/main/debug/functions/fn_traceModule.sqf
Normal file
23
TO_MERGE/cse/main/debug/functions/fn_traceModule.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_traceModule.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_entity"];
|
||||||
|
_entity = _this select 0;
|
||||||
|
|
||||||
|
_enableForPlayer = call compile (_entity getvariable ["logDisplayLevel","0"]);
|
||||||
|
if (isnil "CSE_OBJECTS_TRACING") then {
|
||||||
|
CSE_OBJECTS_TRACING = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isDedicated) then {
|
||||||
|
if (_enableForPlayer==1) then {
|
||||||
|
CSE_OBJECTS_TRACING set [count CSE_OBJECTS_TRACING, PLAYER];
|
||||||
|
};
|
||||||
|
};
|
25
TO_MERGE/cse/main/equipment/functions/fn_findItem.sqf
Normal file
25
TO_MERGE/cse/main/equipment/functions/fn_findItem.sqf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* fn_findItem.sqf
|
||||||
|
* @Descr:
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_magazine","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_item = _this select 1;
|
||||||
|
|
||||||
|
if (_item in (uniformItems _unit)) exitwith {1};
|
||||||
|
if (_item in (vestItems _unit)) exitwith {2};
|
||||||
|
if (_item in (backpackItems _unit)) exitwith {3};
|
||||||
|
if (_item in (assignedItems _unit)) exitwith {4};
|
||||||
|
if (_item in (primaryWeaponItems _unit)) exitwith {5};
|
||||||
|
if (_item in (secondaryWeaponItems _unit)) exitwith {6};
|
||||||
|
if (_item in (handgunItems _unit)) exitwith {7};
|
||||||
|
if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this)
|
||||||
|
|
||||||
|
// If we cannot find the item, return 0.
|
||||||
|
0;
|
21
TO_MERGE/cse/main/equipment/functions/fn_findMagazine.sqf
Normal file
21
TO_MERGE/cse/main/equipment/functions/fn_findMagazine.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* fn_findMagazine.sqf
|
||||||
|
* @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)]
|
||||||
|
* @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_magazine"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_magazine = _this select 1;
|
||||||
|
|
||||||
|
if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1};
|
||||||
|
if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2};
|
||||||
|
if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3};
|
||||||
|
if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon.
|
||||||
|
|
||||||
|
// If we cannot find the item, return 0.
|
||||||
|
0;
|
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* fn_getNumberMagazinesIn.sqf
|
||||||
|
* @Descr:
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_magazine"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_magazine = _this select 1;
|
||||||
|
|
||||||
|
_return = 0;
|
||||||
|
if (_unit isKindOf "CAManBase") then {
|
||||||
|
_return = {_x == _magazine} count magazines _unit;
|
||||||
|
} else {
|
||||||
|
{
|
||||||
|
_return = _return + {_x == _magazine} count magazines _x;
|
||||||
|
}foreach (crew _unit);
|
||||||
|
|
||||||
|
_return = _return + ({_x == _magazine} count getMagazineCargo _unit);
|
||||||
|
};
|
||||||
|
|
||||||
|
_return
|
11
TO_MERGE/cse/main/equipment/functions/fn_hasItem.sqf
Normal file
11
TO_MERGE/cse/main/equipment/functions/fn_hasItem.sqf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* fn_hasItem.sqf
|
||||||
|
* @Descr: Check if unit has item
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
|
||||||
|
* @Return: BOOL
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
// item classname in items unit
|
||||||
|
((_this select 1) in items (_this select 0));
|
21
TO_MERGE/cse/main/equipment/functions/fn_hasMagazine.sqf
Normal file
21
TO_MERGE/cse/main/equipment/functions/fn_hasMagazine.sqf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* fn_hasMagazine.sqf
|
||||||
|
* @Descr: Check if given unit has a magazine of given classname
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, magazine STRING]
|
||||||
|
* @Return: BOOL True if unith as given magazine
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_magazine","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_magazine = _this select 1;
|
||||||
|
|
||||||
|
if (_magazine != "") then {
|
||||||
|
_return = (_magazine in magazines _unit);
|
||||||
|
} else {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
//[format["fnc_hasMagazine: %1 | %2",_this,_return]] call cse_fnc_debug;
|
||||||
|
_return
|
36
TO_MERGE/cse/main/equipment/functions/fn_useItem.sqf
Normal file
36
TO_MERGE/cse/main/equipment/functions/fn_useItem.sqf
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* fn_useItem.sqf
|
||||||
|
* @Descr:
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_item","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_item = _this select 1;
|
||||||
|
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (!_vehicleUsage) then {
|
||||||
|
if (_item != "") then {
|
||||||
|
if (_item in (items _unit)) then {
|
||||||
|
_unit removeItem _item;
|
||||||
|
_return = true;
|
||||||
|
} else {
|
||||||
|
if (_item in (assignedItems _unit)) then {
|
||||||
|
_unit unassignItem _item;
|
||||||
|
_unit removeItem _item;
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
[format["fnc_useItem: %1 | %2",_this,_return]] call cse_fnc_debug;
|
||||||
|
_return
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// TODO implement shared item functionality
|
||||||
|
};
|
28
TO_MERGE/cse/main/equipment/functions/fn_useMagazine.sqf
Normal file
28
TO_MERGE/cse/main/equipment/functions/fn_useMagazine.sqf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* fn_useMagazine.sqf
|
||||||
|
* @Descr: Use magazine
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECt, magazine STRING]
|
||||||
|
* @Return: BOOL True if magazine has been used.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_magazine","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_magazine = _this select 1;
|
||||||
|
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (!_vehicleUsage) then {
|
||||||
|
if (_magazine != "") then {
|
||||||
|
_unit removeMagazine _magazine;
|
||||||
|
_return = true;
|
||||||
|
} else {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
[format["fnc_useMagazine: %1 | %2",_this,_return]] call cse_fnc_debug;
|
||||||
|
_return
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// TODO implement shared magazine functionality
|
||||||
|
};
|
22
TO_MERGE/cse/main/hc/functions/fn_isHC.sqf
Normal file
22
TO_MERGE/cse/main/hc/functions/fn_isHC.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_isHC.sqf
|
||||||
|
* @Descr: Check if current locality is a headless client
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return: BOOL True if locality is headless client OR is not in multiplayer
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_return"];
|
||||||
|
|
||||||
|
if (!isMultiplayer) then {
|
||||||
|
_return = true;
|
||||||
|
} else {
|
||||||
|
if (isServer && !isDedicated) then {
|
||||||
|
_return = true;
|
||||||
|
} else {
|
||||||
|
_return = !(hasInterface || isDedicated);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_return
|
81
TO_MERGE/cse/main/init.sqf
Normal file
81
TO_MERGE/cse/main/init.sqf
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
CSE_AI_COLLECTION_LOOP = [[]];
|
||||||
|
if (isnil "CSE_OBJECTS_TRACING") then {
|
||||||
|
CSE_OBJECTS_TRACING = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
["cse_interactionRegister",[],true,"cse_framework"] call cse_fnc_defineVariable;
|
||||||
|
["cse_interactionTarget",objNull,true,"cse_framework"] call cse_fnc_defineVariable;
|
||||||
|
["cse_variableMonitor",[],false,"cse_framework"] call cse_fnc_defineVariable;
|
||||||
|
["CSE_ENABLE_REVIVE_COUNTER",0,false,"cse_framework"] call cse_fnc_defineVariable;
|
||||||
|
["cse_inReviveState", false, true, "cse_framework"] call cse_fnc_defineVariable;
|
||||||
|
|
||||||
|
cse_main = true;
|
||||||
|
|
||||||
|
if (isnil "CSE_F_MODULE_OBJ_EH") then {
|
||||||
|
CSE_F_MODULE_OBJ_EH = [];
|
||||||
|
};
|
||||||
|
CSE_F_MODULE_OBJ_EH pushback "cse_main";
|
||||||
|
if (isnil "CSE_TASK_POOL_COLLECTION_F") then {
|
||||||
|
CSE_TASK_POOL_COLLECTION_F = [];
|
||||||
|
};
|
||||||
|
if (isNil "CSE_ENABLE_REVIVE_F") then {
|
||||||
|
CSE_ENABLE_REVIVE_F = 0;
|
||||||
|
};
|
||||||
|
if (hasInterface) then{
|
||||||
|
[] spawn {
|
||||||
|
|
||||||
|
sleep 1;
|
||||||
|
waitUntil {!isNull player && !(isNull (findDisplay 46))};
|
||||||
|
player setvariable ["cse_name", name player, true];
|
||||||
|
player addEventHandler ["respawn", {_this call cse_fnc_resetAllDefaults_F;}];
|
||||||
|
11401 cutRsc ["cse_gui_iconsDisplay","PLAIN"];
|
||||||
|
|
||||||
|
if (["cse_sys_vehicles"] call cse_fnc_isModLoaded_F) then {
|
||||||
|
call compile preprocessFile "cse\cse_sys_vehicles\init.sqf";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
["Task Loop is starting"] call cse_fnc_debug;
|
||||||
|
["cse_main_taskPool_f", "oneachframe", cse_fnc_loopThroughPool_f] call BIS_fnc_addStackedEventHandler;
|
||||||
|
|
||||||
|
if (["cse_sys_ieds"] call cse_fnc_isModLoaded_F) then {
|
||||||
|
["cse_sys_ieds", []] call cse_fnc_enableModule_f;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ([] call cse_fnc_isLoaded_ALiVE_Mod) then {
|
||||||
|
// integrate ALiVE menu with CSE Radial Action menu
|
||||||
|
// call compile preprocessFile "cse\cse_main\integration\alive\alive_gui_integration.sqf";
|
||||||
|
// call compile preprocessFile "cse\cse_main\integration\alive\alive_flexiMenu_integration.sqf";
|
||||||
|
};
|
||||||
|
|
||||||
|
// version checks
|
||||||
|
if !(isServer) exitwith {};
|
||||||
|
if (isnil "cse_fnc_getVersion") exitwith {};
|
||||||
|
|
||||||
|
_versionCheckCode = compile format['
|
||||||
|
if (isServer) exitwith {};
|
||||||
|
sleep 5;
|
||||||
|
_serverVersion = "%1";
|
||||||
|
CSE_SERVER_VERSION = _serverVersion;
|
||||||
|
if (!isnil "cse_fnc_getVersion") then {
|
||||||
|
_clientVersion = [] call cse_fnc_getVersion;
|
||||||
|
if (_serverVersion != _clientVersion) then {
|
||||||
|
// incorrect version
|
||||||
|
_warningMessage = format["WARNING: CSE Version mismatch. Server version: %1 Client version: %2", _serverVersion, _clientVersion];
|
||||||
|
diag_log _warningMessage;
|
||||||
|
systemChat _warningMessage;
|
||||||
|
|
||||||
|
[[{sysemChat format["%1" has an incorrect version of CSE", _this];}, player], "BIS_fnc_spawn", true, true] call BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
["Passed version check - same as server"] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// incorrect version
|
||||||
|
_warningMessage = format["WARNING: CSE Version mismatch: Server version: %1 Client version: unknown"];
|
||||||
|
diag_log _warningMessage;
|
||||||
|
systemChat _warningMessage;
|
||||||
|
};
|
||||||
|
', call cse_fnc_getVersion];
|
||||||
|
|
||||||
|
[_versionCheckCode, "BIS_fnc_spawn", true, true] call BIS_fnc_MP;
|
@ -0,0 +1,182 @@
|
|||||||
|
|
||||||
|
#include "\x\alive\addons\ui\script_component.hpp"
|
||||||
|
#define ALiVE_ICON "cse\cse_gui\radialmenu\data\icons\icon_alive_mod.paa"
|
||||||
|
|
||||||
|
/*
|
||||||
|
[
|
||||||
|
"player",
|
||||||
|
[SELF_INTERACTION_KEY],
|
||||||
|
-9500,
|
||||||
|
[
|
||||||
|
"call ALIVE_fnc_adminActionsMenuDef",
|
||||||
|
"main"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
["player",[[221,[false,false,false]]],-9500,["call ALIVE_fnc_newsFeedMenuDef","main"],true],
|
||||||
|
["player",[[221,[false,false,false]]],-9500,["call ALIVE_fnc_adminActionsMenuDef","main"],true]
|
||||||
|
];
|
||||||
|
|
||||||
|
/*
|
||||||
|
4 [
|
||||||
|
5 "caption",
|
||||||
|
6 "action",
|
||||||
|
7 "icon",
|
||||||
|
8 "tooltip",
|
||||||
|
9 {"submenu"|["menuName", "", {0|1} (optional - use embedded list menu)]},
|
||||||
|
10 -1 (shortcut DIK code),
|
||||||
|
11 {0|1/"0"|"1"/false|true} (enabled),
|
||||||
|
12 {-1|0|1/"-1"|"0"|"1"/false|true} (visible)
|
||||||
|
13 ]
|
||||||
|
*/
|
||||||
|
|
||||||
|
[format["ALIVE FlexiMenu integration started"]] call cse_fnc_debug;
|
||||||
|
_menusources = GVAR(typeMenuSources);
|
||||||
|
{
|
||||||
|
|
||||||
|
// This is a string. defines classnames ?
|
||||||
|
_type = _x select 0;
|
||||||
|
|
||||||
|
// not relevant for us
|
||||||
|
_keybindings = _x select 1;
|
||||||
|
|
||||||
|
// not relevant for us
|
||||||
|
_priority = _x select 2;
|
||||||
|
|
||||||
|
// array format: [code STRING, name STRING]
|
||||||
|
_details = _x select 3;
|
||||||
|
_code = _details select 0;
|
||||||
|
_menuName = _details select 1;
|
||||||
|
|
||||||
|
// condition. BOOL or CODE ?
|
||||||
|
_condition = _x select 4;
|
||||||
|
|
||||||
|
// TODO figure out parsing
|
||||||
|
[format["ALiVE FlexiMenu entry: %1", _x]] call cse_fnc_debug;
|
||||||
|
|
||||||
|
if (_type == "player") then {
|
||||||
|
|
||||||
|
if (typeName _condition == typeName true) then {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// calling condition
|
||||||
|
};
|
||||||
|
|
||||||
|
_target = player;
|
||||||
|
_params = [_menuName, "popup"];
|
||||||
|
|
||||||
|
if (typeName _code == typeName "") then {
|
||||||
|
|
||||||
|
// this has to be called upon menu open.
|
||||||
|
_res = [_target, _params] call compile _code;
|
||||||
|
[format["ALIVE FlexiMenu call res: %1", _res]] call cse_fnc_debug;
|
||||||
|
// [["main","ALiVE","popup"],[["Player Combat Support",{["radio"] call ALIVE_fnc_radioAction},"","ALiVE Combat Support System (CAS/Artillery/Transport)","",-1,1,false]]
|
||||||
|
if (_res isEqualTo []) exitwith {};
|
||||||
|
_entryDetails = _res select 1 select 0;
|
||||||
|
|
||||||
|
|
||||||
|
// [["main","ALiVE","popup"],[["Admin Actions >","","","Server admin functions",["call ALiVE_fnc_adminActionsMenuDef","adminActions",1],-1,1,true]]]
|
||||||
|
//_menuName = _entryDetails select 4 select 1;
|
||||||
|
_compiledCode = compile format['[_this, "%1"] call cse_fnc_aliveFlexiMenuDisplayOptions', _menuName];
|
||||||
|
[format["compiled code: %1", _compiledCode]] call cse_fnc_debug;
|
||||||
|
_entries = [
|
||||||
|
[_entryDetails select 0, {true /* Condition should check for activation of ALiVE menu entries */}, ALiVE_ICON, _compiledCode, _entryDetails select 3]
|
||||||
|
];
|
||||||
|
["ActionMenu","alive_actions", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F;
|
||||||
|
|
||||||
|
/*{
|
||||||
|
if (_foreachIndex > 0) then {
|
||||||
|
[format["BUTTON FORMAT: %1",_x]] call cse_fnc_debug;
|
||||||
|
_info = _x select 0;
|
||||||
|
_title = _info select 0;
|
||||||
|
_code = _info select 1;
|
||||||
|
_toolTip = _info select 2;
|
||||||
|
_allow = _info select 7;
|
||||||
|
[format["Showing button: %1", _info]] call cse_fnc_debug
|
||||||
|
};
|
||||||
|
}foreach _res;*/
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}foreach _menusources;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cse_fnc_aliveFlexiMenuDisplayOptions = {
|
||||||
|
_args = _this select 0;
|
||||||
|
_checkMenuName = _this select 1;
|
||||||
|
[format["cse_fnc_aliveFlexiMenuDisplayOptions %1",_this]] call cse_fnc_debug;
|
||||||
|
_menusources = GVAR(typeMenuSources);
|
||||||
|
{
|
||||||
|
// This is a string. defines classnames ?
|
||||||
|
_type = _x select 0;
|
||||||
|
|
||||||
|
// not relevant for us
|
||||||
|
_keybindings = _x select 1;
|
||||||
|
|
||||||
|
// not relevant for us
|
||||||
|
_priority = _x select 2;
|
||||||
|
|
||||||
|
// array format: [code STRING, name STRING]
|
||||||
|
_details = _x select 3;
|
||||||
|
_code = _details select 0;
|
||||||
|
_menuName = _details select 1;
|
||||||
|
|
||||||
|
// condition. BOOL or CODE ?
|
||||||
|
_condition = _x select 4;
|
||||||
|
|
||||||
|
if (_menuName == _checkMenuName) exitwith {
|
||||||
|
[format["ALiVE FlexiMenu entry: %1", _x]] call cse_fnc_debug;
|
||||||
|
if (_type == "player") then {
|
||||||
|
_continue = false;
|
||||||
|
if (typeName _condition == typeName true) then {
|
||||||
|
_continue = _condition;
|
||||||
|
};
|
||||||
|
if (!_continue) exitwith {};
|
||||||
|
|
||||||
|
_target = player;
|
||||||
|
_params = [_menuName, "popup"];
|
||||||
|
|
||||||
|
if (typeName _code == typeName "") then {
|
||||||
|
// this has to be called upon menu open.
|
||||||
|
_res = [_target, _params] call compile _code;
|
||||||
|
// [["main","ALiVE","popup"],[["Player Combat Support",{["radio"] call ALIVE_fnc_radioAction},"","ALiVE Combat Support System (CAS/Artillery/Transport)","",-1,1,false]]
|
||||||
|
|
||||||
|
if (_res isEqualTo []) exitwith {};
|
||||||
|
_entryDetails = _res select 1;
|
||||||
|
|
||||||
|
_cse_menu_entries = [];
|
||||||
|
{
|
||||||
|
_info = _x select 0;
|
||||||
|
if (_foreachIndex > 0) then {
|
||||||
|
_title = _info select 0;
|
||||||
|
_code = _info select 1;
|
||||||
|
_toolTip = _info select 2;
|
||||||
|
_allow = _info select 7;
|
||||||
|
|
||||||
|
if (_allow) then {
|
||||||
|
_cse_menu_entries pushback [_title, ALiVE_ICON, _code, true, _toolTip];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}foreach _res;
|
||||||
|
[format["Showing entries: %1 - %2", _cse_menu_entries, _res]] call cse_fnc_debug;
|
||||||
|
|
||||||
|
if !(_cse_menu_entries isEqualTo []) then {
|
||||||
|
hintSilent "displaying alive entries";
|
||||||
|
[ _args select 3,
|
||||||
|
_cse_menu_entries,
|
||||||
|
_args select 1, CSE_SELECTED_RADIAL_OPTION_N_GUI, true
|
||||||
|
] call cse_fnc_openRadialSecondRing_GUI;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}foreach _menusources;
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* alive_gui_integration.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <\x\alive\addons\sys_adminactions\script_component.hpp>
|
||||||
|
#include <\x\cba\addons\ui_helper\script_dikCodes.hpp>
|
||||||
|
|
||||||
|
#define ALiVE_ICON "cse\cse_gui\radialmenu\data\icons\icon_alive_mod.paa"
|
||||||
|
|
||||||
|
private ["_entries", "_openAdminActions"];
|
||||||
|
|
||||||
|
waitUntil{!isnil "cse_gui"};
|
||||||
|
|
||||||
|
// ALiVE Admin Actions
|
||||||
|
|
||||||
|
_alive_openAdminActions = {
|
||||||
|
private ["_entries"];
|
||||||
|
_entries = [];
|
||||||
|
if ((MOD(adminActions) getVariable ["ghost", 0]) == "1") then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_GHOST_ENABLE", ALiVE_ICON, {player setCaptive true; _this call cse_alive_openAdminActions; }, (!captive player), localize "STR_ALIVE_ADMINACTIONS_GHOST_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_GHOST_DISABLE", ALiVE_ICON, {player setCaptive false; _this call cse_alive_openAdminActions; }, (captive player), localize "STR_ALIVE_ADMINACTIONS_GHOST_COMMENT"]];
|
||||||
|
};
|
||||||
|
if ((MOD(adminActions) getVariable ["teleport", 0]) == "1") then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_TELEPORT_ENABLE", ALiVE_ICON, { MOD(adminActions) setVariable ["teleport_enabled", true]; onMapSingleClick {vehicle player setPos _pos;}; _this call cse_alive_openAdminActions; }, !(MOD(adminActions) getVariable ["teleport_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_TELEPORT_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_TELEPORT_DISABLE",ALiVE_ICON, { MOD(adminActions) setVariable ["teleport_enabled", false]; onMapSingleClick DEFAULT_MAPCLICK; _this call cse_alive_openAdminActions; }, (MOD(adminActions) getVariable ["teleport_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_TELEPORT_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_TELEPORTUNITS", ALiVE_ICON, { ["CAManBase"] spawn ALiVE_fnc_AdminActionsTeleportUnits; _this call cse_alive_openAdminActions; }, true, localize "STR_ALIVE_ADMINACTIONS_TELEPORTUNITS_COMMENT"]];
|
||||||
|
};
|
||||||
|
if ((MOD(adminActions) getVariable ["mark_units", 0]) == "1") then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_MARK_UNITS_ENABLE", ALiVE_ICON, { [] call ALIVE_fnc_markUnits; _this call cse_alive_openAdminActions; }, true, localize "STR_ALIVE_ADMINACTIONS_MARK_UNITS_COMMENT"]];
|
||||||
|
};
|
||||||
|
if (["ALiVE_mil_CQB"] call ALiVE_fnc_isModuleAvailable) then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_CQB_ENABLE", ALiVE_ICON, { {MOD(adminActions) setVariable ["CQB_enabled", true]; [_x,"debug",true] call ALiVE_fnc_CQB} foreach (MOD(CQB) getVariable ["instances",[]]); _this call cse_alive_openAdminActions; }, !(MOD(adminActions) getVariable ["CQB_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_CQB_ENABLE_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_CQB_DISABLE", ALiVE_ICON,{ MOD(adminActions) setVariable ["CQB_enabled", false]; {[_x,"debug",false] call ALiVE_fnc_CQB} foreach (MOD(CQB) getVariable ["instances",[]]); _this call cse_alive_openAdminActions; }, (MOD(adminActions) getVariable ["CQB_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_CQB_DISABLE_COMMENT"]];
|
||||||
|
};
|
||||||
|
if (["ALiVE_sys_profile"] call ALiVE_fnc_isModuleAvailable) then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_PROFILES_DEBUG_ENABLE", ALiVE_ICON,{ MOD(adminActions) setVariable ["PROFILES_enabled", true]; [] call ALIVE_fnc_profileSystemDebug;_this call cse_alive_openAdminActions; }, !(MOD(adminActions) getVariable ["PROFILES_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_PROFILES_DEBUG_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_PROFILES_DEBUG_DISABLE", ALiVE_ICON,{ MOD(adminActions) setVariable ["PROFILES_enabled", false]; [] call ALIVE_fnc_profileSystemDebug; _this call cse_alive_openAdminActions; }, (MOD(adminActions) getVariable ["PROFILES_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_PROFILES_DEBUG_COMMENT"]];
|
||||||
|
};
|
||||||
|
if ((MOD(adminActions) getVariable ["profiles_create", 0]) == "1") then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_CREATE_PROFILES_ENABLE", ALiVE_ICON,{ [] call ALIVE_fnc_adminCreateProfiles; _this call cse_alive_openAdminActions; }, true, localize "STR_ALIVE_ADMINACTIONS_CREATE_PROFILES_COMMENT"]];
|
||||||
|
};
|
||||||
|
if (["ALiVE_amb_civ_population"] call ALiVE_fnc_isModuleAvailable) then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_AGENTS_DEBUG_ENABLE", ALiVE_ICON,{MOD(adminActions) setVariable ["AGENTS_enabled", true]; [] call ALIVE_fnc_agentSystemDebug; _this call cse_alive_openAdminActions; }, !(MOD(adminActions) getVariable ["AGENTS_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_AGENTS_DEBUG_COMMENT"]];
|
||||||
|
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_AGENTS_DEBUG_DISABLE", ALiVE_ICON,{ MOD(adminActions) setVariable ["AGENTS_enabled", false]; [] call ALIVE_fnc_agentSystemDebug;_this call cse_alive_openAdminActions; }, (MOD(adminActions) getVariable ["AGENTS_enabled", false]), localize "STR_ALIVE_ADMINACTIONS_PROFILES_DEBUG_COMMENT"]];
|
||||||
|
};
|
||||||
|
if ((MOD(adminActions) getVariable ["console", 0]) == "1") then {
|
||||||
|
_entries set [ count _entries, [localize "STR_ALIVE_ADMINACTIONS_CONSOLE_ENABLE", ALiVE_ICON,{ closeDialog 0; createDialog "RscDisplayDebugPublic"; }, true, localize "STR_ALIVE_ADMINACTIONS_CONSOLE_COMMENT"]];
|
||||||
|
};
|
||||||
|
|
||||||
|
[ _this select 3,
|
||||||
|
_entries,
|
||||||
|
_this select 1, CSE_SELECTED_RADIAL_OPTION_N_GUI, true
|
||||||
|
] call cse_fnc_openRadialSecondRing_GUI;
|
||||||
|
};
|
||||||
|
|
||||||
|
_entries = [
|
||||||
|
[localize "STR_ALIVE_ADMINACTIONS", {true /* Condition should check for activation of ALiVE Admin */}, ALiVE_ICON, _alive_openAdminActions, localize "STR_ALIVE_ADMINACTIONS"]
|
||||||
|
];
|
||||||
|
["ActionMenu","alive_actions", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F;
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_broadcastMonitoredVariable.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_variable","_owners"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variable = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (_variable == "cse_variableMonitor" || _variable == "cse_interactionRegister") exitwith{};
|
||||||
|
|
||||||
|
if (!local _target) exitwith {
|
||||||
|
[_this, "cse_fnc_broadcastMonitoredVariable",owner _target, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
||||||
|
_owners = ([_target,_variable] call cse_fnc_getRegisteredMonitorVariablesOwners);
|
||||||
|
{
|
||||||
|
[_this, "cse_fnc_setMonitoredVariableValue",owner _x, false] spawn BIS_fnc_MP;
|
||||||
|
}foreach _owners;
|
13
TO_MERGE/cse/main/interaction/functions/fn_canInteract.sqf
Normal file
13
TO_MERGE/cse/main/interaction/functions/fn_canInteract.sqf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* fn_canInteract.sqf
|
||||||
|
* @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: BOOL True if unit can interact with enviroment.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
(((_unit getvariable ["cse_canInteract",0]) < 1) && ([_unit] call cse_fnc_isAwake) && !([_unit] call cse_fnc_isArrested))
|
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_getAllMonitoredVariables.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (isnil "CSE_REGISTERED_MONITORED_VARIABLES") then {
|
||||||
|
CSE_REGISTERED_MONITORED_VARIABLES = [];
|
||||||
|
};
|
||||||
|
CSE_REGISTERED_MONITORED_VARIABLES
|
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* fn_getCanInteract.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_return"];
|
||||||
|
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||||
|
(_unit getvariable ["cse_canInteract",0])
|
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_getInteractionTarget.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_prevTarget"];
|
||||||
|
_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_prevTarget = [_unit,"cse_interactionTarget"] call cse_fnc_getVariable;
|
||||||
|
_prevTarget
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* fn_getMonitoredVariableName.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_stagingName","_name","_variableName"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variableName = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
//_name = "";
|
||||||
|
//{
|
||||||
|
// _name = _name + _x;
|
||||||
|
//}foreach ([format["%",_target], " "] call BIS_fnc_splitString);
|
||||||
|
|
||||||
|
_stagingName = format["CSE_MONITORED_VARIABLE_%1", _variableName];
|
||||||
|
_stagingName
|
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* fn_getMonitoredVariableValue.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_returnValue","_stagingName","_variable"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variable = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
_returnValue = "";
|
||||||
|
_stagingName = [_target,_variable] call cse_fnc_getMonitoredVariableName;
|
||||||
|
_unknown = false;
|
||||||
|
if (isnil _stagingName) then {
|
||||||
|
// default value for variable, else ""
|
||||||
|
_returnValue = [_variable] call cse_fnc_getVariableDefault;
|
||||||
|
[_target,_variable,_returnValue] call cse_fnc_setMonitoredVariableValue;
|
||||||
|
_unknown = true;
|
||||||
|
} else {
|
||||||
|
_returnValue = call compile _stagingName;
|
||||||
|
if (isnil "_returnValue") then {
|
||||||
|
_returnValue = [_variable] call cse_fnc_getVariableDefault;
|
||||||
|
_unknown = true;
|
||||||
|
} else {
|
||||||
|
if (typeName _returnValue == typeName "") then {
|
||||||
|
if (_returnValue == "") then {
|
||||||
|
call compile format["%1 = '';",_stagingName];
|
||||||
|
player sidechat format["Return didnt function propery"];
|
||||||
|
};
|
||||||
|
_returnValue = [_variable] call cse_fnc_getVariableDefault;
|
||||||
|
_unknown = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_returnValue
|
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_getOnUpdateVariableEH.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_target","_variable","_name","_return","_variableName"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variableName = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
_name = [_target,_variableName] call cse_fnc_getMonitoredVariableName;
|
||||||
|
_name = _name + "_UPDATE_EH";
|
||||||
|
_return = "";
|
||||||
|
if (isnil _name) then {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_return = call compile _name;
|
||||||
|
//[format["cse_fnc_getOnUpdateVariableEH %1 | %2",_return, _name]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
_return
|
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* fn_getRegisteredMonitorVariablesOwners.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_returnOwners","_register","_variableName","_registerMonitorCol"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variableName = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
_returnOwners = [];
|
||||||
|
|
||||||
|
_registerMonitorCol = + ([_target,"cse_variableMonitor",[]] call cse_fnc_getVariable);
|
||||||
|
|
||||||
|
//if (count _registerMonitor > 0) then {
|
||||||
|
{
|
||||||
|
if ((_x select 1) == _variableName) then {
|
||||||
|
_returnOwners pushback (_x select 0);
|
||||||
|
};
|
||||||
|
}foreach _registerMonitorCol;
|
||||||
|
//};
|
||||||
|
_returnOwners
|
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_isRegisteredInteractingWith.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_register"];
|
||||||
|
_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_target = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_register = [_target,"cse_interactionRegister",[]] call cse_fnc_getVariable;
|
||||||
|
_return = false;
|
||||||
|
{
|
||||||
|
if (_x == _unit) exitwith {
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
}foreach _register;
|
||||||
|
|
||||||
|
_return
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* fn_registerInteractingWith.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_prevTarget","_register"];
|
||||||
|
_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_target = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (local _unit) then {
|
||||||
|
_prevTarget = [_unit,"cse_interactionTarget"] call cse_fnc_getVariable;
|
||||||
|
if (!isNull _prevTarget) then {
|
||||||
|
[_unit,_prevTarget] call cse_fnc_unregisterInteractingWith;
|
||||||
|
//waituntil {sleep 0.1; !([_unit,_prevTarget] call cse_fnc_isRegisteredInteractingWith)};
|
||||||
|
};
|
||||||
|
[_unit,"cse_interactionTarget",_target] call cse_fnc_setVariable;
|
||||||
|
};
|
||||||
|
if (!local _target) exitwith {
|
||||||
|
[_this, "cse_fnc_registerInteractingWith",owner _target, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
||||||
|
|
||||||
|
// local on target !
|
||||||
|
_register = [_target,"cse_interactionRegister",[]] call cse_fnc_getVariable;
|
||||||
|
_register pushback _unit;
|
||||||
|
[_target,"cse_interactionRegister",_register] call cse_fnc_setVariable;
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* fn_registerVariableMonitor.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_varName","_register","_onUpdate","_registerMonitor"];
|
||||||
|
_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_target = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_varName = _this select 2;
|
||||||
|
_onUpdate = "";
|
||||||
|
if (count _this >3) then {
|
||||||
|
_onUpdate = _this select 3;
|
||||||
|
[_target,_varName,_onUpdate] call cse_fnc_setOnUpdateVariableEH;
|
||||||
|
};
|
||||||
|
if (local _unit) then {
|
||||||
|
if (isnil "CSE_REGISTERED_MONITORED_VARIABLES") then {
|
||||||
|
CSE_REGISTERED_MONITORED_VARIABLES = [];
|
||||||
|
};
|
||||||
|
CSE_REGISTERED_MONITORED_VARIABLES pushback _varName;
|
||||||
|
[_target,_varName] call cse_fnc_getMonitoredVariableValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!local _target) exitwith {
|
||||||
|
[_this, "cse_fnc_registerVariableMonitor",owner _target, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
||||||
|
_registerMonitor = [_target,"cse_variableMonitor",[]] call cse_fnc_getVariable;
|
||||||
|
_registerMonitor pushback [_unit,_varName];
|
||||||
|
[_target,"cse_variableMonitor",_registerMonitor] call cse_fnc_setVariable;
|
||||||
|
// [[_target,_varName,([_target,_varName] call cse_fnc_getVariable)], "cse_fnc_setMonitoredVariableValue", _unit, false] spawn BIS_fnc_MP;
|
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* fn_setCanInteract.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_to","_return"];
|
||||||
|
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||||
|
_to = _this select 1;
|
||||||
|
_return = false;
|
||||||
|
if (((typeName _to) == "SCALAR")) then {
|
||||||
|
if (_to <-1) then {
|
||||||
|
_to = -1;
|
||||||
|
} else {
|
||||||
|
if (_to > 1) then {
|
||||||
|
_to = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_unit setvariable ["cse_canInteract", ([_unit] call cse_fnc_getCanInteract) + _to,false];
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
_return
|
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* fn_setMonitoredVariableValue.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
_this spawn {
|
||||||
|
private ["_unit","_target","_variable","_eh"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variable = [_this,1,"",[""]] call BIS_fnc_Param; 1;
|
||||||
|
|
||||||
|
_stagingName = [_target,_variable] call cse_fnc_getMonitoredVariableName;
|
||||||
|
if (count _this >2) then {
|
||||||
|
call compile format["%1 = %2;",_stagingName,_this select 2];
|
||||||
|
} else {
|
||||||
|
call compile format["%1 = nil;",_stagingName];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
_eh = [_target,_variable] call cse_fnc_getOnUpdateVariableEH;
|
||||||
|
if (!isnil _eh) then {
|
||||||
|
if (typeName _eh == typeName "") then {
|
||||||
|
[_target,_variable,_this select 2] spawn compile _eh;
|
||||||
|
} else {
|
||||||
|
if (typeName _eh == typeName {}) then {
|
||||||
|
[_target,_variable,_this select 2] spawn _eh;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* fn_setOnUpdateVariableEH.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_target","_name","_eh","_variableName"];
|
||||||
|
_target = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_variableName = [_this,1,"",[""]] call BIS_fnc_Param;
|
||||||
|
_eh = _this select 2; // what data type?
|
||||||
|
_name = [_target,_variableName] call cse_fnc_getMonitoredVariableName;
|
||||||
|
_name = _name + "_UPDATE_EH";
|
||||||
|
[_eh] call compile format["%1 = (_this select 0);",_name,_eh];
|
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* fn_unregisterInteractingWith.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_target","_register","_toRemove","_newRegister","_registerMonitor"];
|
||||||
|
_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_target = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (local _unit) then {
|
||||||
|
[_unit,"cse_interactionTarget"] call cse_fnc_setVariable;
|
||||||
|
{
|
||||||
|
_name = [_target, _x] call cse_fnc_getMonitoredVariableName;
|
||||||
|
call compile format["%1 = nil;",_name];
|
||||||
|
}foreach (call cse_fnc_getAllMonitoredVariables);
|
||||||
|
};
|
||||||
|
if (!local _target) exitwith {
|
||||||
|
[_this, "cse_fnc_unregisterInteractingWith",owner _target, false] spawn BIS_fnc_MP;
|
||||||
|
};
|
||||||
|
_register = [_target,"cse_interactionRegister",[]] call cse_fnc_getVariable;
|
||||||
|
_register = _register - [_unit];
|
||||||
|
[_target,"cse_interactionRegister",_register] call cse_fnc_setVariable;
|
||||||
|
|
||||||
|
_registerMonitor = [_target,"cse_variableMonitor",[]] call cse_fnc_getVariable;
|
||||||
|
_newRegister = [];
|
||||||
|
{
|
||||||
|
if ((_x select 0) == _unit) then {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_newRegister pushback _x;
|
||||||
|
};
|
||||||
|
}foreach _registerMonitor;
|
||||||
|
[_target,"cse_variableMonitor",_newRegister] call cse_fnc_setVariable;
|
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* fn_sendDisplayInformationTo.sqf
|
||||||
|
* @Descr: Sends a display information hint to a receiver
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [receiver OBJECT, title STRING, content ARRAY (An array with strings), type NUMBER (Optional)]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
|
||||||
|
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||||
|
_content = [_this, 2, [""],[[""]]] call BIS_fnc_Param;
|
||||||
|
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
|
||||||
|
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (isPlayer _reciever) then {
|
||||||
|
if (!local _reciever) then {
|
||||||
|
[_this, "cse_fnc_sendDisplayInformationTo", _reciever, false] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (isLocalized _title) then {
|
||||||
|
_title = localize _title;
|
||||||
|
};
|
||||||
|
_localizationArray = [_title];
|
||||||
|
{
|
||||||
|
_localizationArray pushback _x;
|
||||||
|
}foreach _parameters;
|
||||||
|
_title = format _localizationArray;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (isLocalized _x) then {
|
||||||
|
_localizationArray = [localize _x];
|
||||||
|
{
|
||||||
|
_localizationArray pushback _x;
|
||||||
|
}foreach _parameters;
|
||||||
|
|
||||||
|
_content set [_foreachIndex, format _localizationArray];
|
||||||
|
};
|
||||||
|
|
||||||
|
}foreach _content;
|
||||||
|
|
||||||
|
[_title,_content,_type] call cse_fnc_gui_displayInformation;
|
||||||
|
};
|
||||||
|
};
|
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* fn_sendDisplayMessageTo.sqf
|
||||||
|
* @Descr: Displays a message on locality of receiver
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [receiver OBJECT, title STRING, content STRING, type NUMBER (Optional)]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_reciever","_title","_content","_type", "_parameters", "_localizationArray"];
|
||||||
|
_reciever = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_title = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||||
|
_content = [_this, 2, "",[""]] call BIS_fnc_Param;
|
||||||
|
_type = [_this, 3, 0,[0]] call BIS_fnc_Param;
|
||||||
|
_parameters = [_this, 4, [], [[]]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
[_this] call cse_fnc_debug;
|
||||||
|
|
||||||
|
if (isPlayer _reciever) then {
|
||||||
|
if (!local _reciever) then {
|
||||||
|
[_this, "cse_fnc_sendDisplayMessageTo", _reciever, false] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (isLocalized _title) then {
|
||||||
|
_title = localize _title;
|
||||||
|
};
|
||||||
|
if (isLocalized _content) then {
|
||||||
|
_content = localize _content;
|
||||||
|
};
|
||||||
|
|
||||||
|
_localizationArray = [_title];
|
||||||
|
{
|
||||||
|
_localizationArray pushback _x;
|
||||||
|
}foreach _parameters;
|
||||||
|
_title = format _localizationArray;
|
||||||
|
|
||||||
|
_localizationArray = [_content];
|
||||||
|
{
|
||||||
|
_localizationArray pushback _x;
|
||||||
|
}foreach _parameters;
|
||||||
|
_content = format _localizationArray;
|
||||||
|
|
||||||
|
[_title,_content,_type] call cse_fnc_gui_displayMessage;
|
||||||
|
};
|
||||||
|
};
|
23
TO_MERGE/cse/main/messages/functions/fn_sendHintTo.sqf
Normal file
23
TO_MERGE/cse/main/messages/functions/fn_sendHintTo.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_sendHintTo.sqf
|
||||||
|
* @Descr: Sends a hint to player unit across network
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [reciever OBJECT, message STRING]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_reciever","_message"];
|
||||||
|
_reciever = _this select 0;
|
||||||
|
_message = _this select 1;
|
||||||
|
//[_reciever,_message] call cms_fnc_sendChatMessageTo;
|
||||||
|
|
||||||
|
if (isPlayer _reciever) then {
|
||||||
|
if (!local _reciever) then {
|
||||||
|
[_this, "cse_fnc_sendHintTo", _reciever, false] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
hintsilent format ["%1",_message];
|
||||||
|
};
|
||||||
|
};
|
22
TO_MERGE/cse/main/messages/functions/fn_sendMessageTo.sqf
Normal file
22
TO_MERGE/cse/main/messages/functions/fn_sendMessageTo.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* fn_sendMessageTo.sqf
|
||||||
|
* @Descr: Sends a chat message to player unit across the network
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [reciever OBJECT, message STRING]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_reciever","_message"];
|
||||||
|
_reciever = _this select 0;
|
||||||
|
_message = _this select 1;
|
||||||
|
|
||||||
|
|
||||||
|
if (isPlayer _reciever) then {
|
||||||
|
if (!local _reciever) then {
|
||||||
|
[_this, "cse_fnc_sendMessageTo", _reciever, false] spawn BIS_fnc_MP;
|
||||||
|
} else {
|
||||||
|
CSE_LOGIC_OBJECT globalChat format ["%1",_message];
|
||||||
|
};
|
||||||
|
};
|
16
TO_MERGE/cse/main/misc/functions/fn_broadcastSound3D_f.sqf
Normal file
16
TO_MERGE/cse/main/misc/functions/fn_broadcastSound3D_f.sqf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* fn_broadcastSound3D_f.sqf
|
||||||
|
* @Descr: Plays a sound in 3D
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, sound STRING]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isDedicated) exitwith{};
|
||||||
|
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_sound = [_this, 1, "",[""]] call BIS_fnc_Param;
|
||||||
|
_unit say3D _sound;
|
14
TO_MERGE/cse/main/misc/functions/fn_closeAllDialogs_f.sqf
Normal file
14
TO_MERGE/cse/main/misc/functions/fn_closeAllDialogs_f.sqf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_closeAllDialogs_f.sqf
|
||||||
|
* @Descr: Close all dialogs
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
while {dialog} do {
|
||||||
|
closeDialog 0;
|
||||||
|
};
|
23
TO_MERGE/cse/main/misc/functions/fn_disableAI_f.sqf
Normal file
23
TO_MERGE/cse/main/misc/functions/fn_disableAI_f.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_disableAI_f.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_disable"];
|
||||||
|
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_disable = [_this, 1,false,[false]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (local _unit && !(IsPlayer _unit)) then {
|
||||||
|
if (_disable) then {
|
||||||
|
_unit disableAI "Move";
|
||||||
|
_unit disableAI "TARGET";
|
||||||
|
} else {
|
||||||
|
_unit enableAI "Move";
|
||||||
|
_unit enableAI "TARGET";
|
||||||
|
};
|
||||||
|
};
|
77
TO_MERGE/cse/main/misc/functions/fn_disableKeyInput_f.sqf
Normal file
77
TO_MERGE/cse/main/misc/functions/fn_disableKeyInput_f.sqf
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* fn_disableKeyInput_f.sqf
|
||||||
|
* @Descr: Disable the keyinput
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [disable BOOL]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private["_disable"];
|
||||||
|
_disable = [_this, 0, false, [false]] call BIS_fnc_Param;
|
||||||
|
if (!hasInterface) exitwith {};
|
||||||
|
CSE_DISABLE_KEY_INPUT_F = _disable;
|
||||||
|
|
||||||
|
[format["Disable Key input: %1",_disable]] call cse_fnc_debug;
|
||||||
|
if (_disable) then {
|
||||||
|
if (isNil "CSE_DISABLE_KEY_UP_INPUT_DISPLAY_EH_F") then {
|
||||||
|
[format["Keyinput has not yet been disabled, now disabling",_disable]] call cse_fnc_debug;
|
||||||
|
|
||||||
|
CSE_DISABLE_USER_INPUT_SCREEN = true;
|
||||||
|
createDialog 'cse_empty_screen';
|
||||||
|
disableSerialization;
|
||||||
|
_display = uiNamespace getvariable "cse_empty_screen";
|
||||||
|
CSE_DISABLE_KEY_UP_INPUT_DISPLAY_EH_F = _display displayAddEventHandler ["KeyDown", {
|
||||||
|
_return = true;
|
||||||
|
if ((_this select 1) == 1) then {
|
||||||
|
if (isNull finddisplay 49) then {
|
||||||
|
[format["Assigning ctrlEventhandlers to buttons"]] call cse_fnc_debug;
|
||||||
|
if (isMultiplayer) then {
|
||||||
|
createDialog "RscDisplayMPInterrupt";
|
||||||
|
_ctrl = (finddisplay 49) displayctrl 103;
|
||||||
|
_ctrl ctrlSetEventHandler ["buttonClick", "closeDialog 0; [false] call cse_fnc_disableKeyInput_f; failMission 'LOSER';"];
|
||||||
|
|
||||||
|
_ctrl = (finddisplay 49) displayctrl 104;
|
||||||
|
_ctrl ctrlSetEventHandler ["buttonClick", "closeDialog 0; [false] call cse_fnc_disableKeyInput_f; player setDamage 1;"];
|
||||||
|
} else {
|
||||||
|
createDialog "RscDisplayInterrupt";
|
||||||
|
_ctrl = (finddisplay 49) displayctrl 104;
|
||||||
|
_ctrl ctrlSetEventHandler ["buttonClick", "closeDialog 0; [false] call cse_fnc_disableKeyInput_f; failMission 'LOSER';"];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
closeDialog 49;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_this select 1) in actionKeys "CuratorInterface" && {player in allCurators}) then {
|
||||||
|
openCuratorInterface
|
||||||
|
};
|
||||||
|
if (serverCommandAvailable "#missions") then {
|
||||||
|
};
|
||||||
|
[format["Returning %1 for disable key input keyDown handler", _return]] call cse_fnc_debug;
|
||||||
|
_return;
|
||||||
|
}];
|
||||||
|
CSE_DISABLE_KEY_DOWN_INPUT_DISPLAY_EH_F = _display displayAddEventHandler ["KeyUp", {true;}];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (!isNil "CSE_DISABLE_KEY_UP_INPUT_DISPLAY_EH_F") then {
|
||||||
|
[format["Keyinput has been disabled, now enabling",_disable]] call cse_fnc_debug;
|
||||||
|
CSE_DISABLE_USER_INPUT_SCREEN = false;
|
||||||
|
disableSerialization;
|
||||||
|
_display = uiNamespace getvariable "cse_empty_screen";
|
||||||
|
if (isnil "_display") then {
|
||||||
|
_display = displayNull;
|
||||||
|
};
|
||||||
|
closeDialog 679123;
|
||||||
|
_display closeDisplay 1;
|
||||||
|
_display displayRemoveEventHandler ["KeyDown", CSE_DISABLE_KEY_UP_INPUT_DISPLAY_EH_F];
|
||||||
|
_display displayRemoveEventHandler ["KeyUp", CSE_DISABLE_KEY_DOWN_INPUT_DISPLAY_EH_F];
|
||||||
|
CSE_DISABLE_KEY_DOWN_INPUT_DISPLAY_EH_F = nil;
|
||||||
|
CSE_DISABLE_KEY_UP_INPUT_DISPLAY_EH_F = nil;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
[[_disable], "disableKeyInput"] call cse_fnc_customEventHandler_F;
|
28
TO_MERGE/cse/main/misc/functions/fn_disableUserInput_f.sqf
Normal file
28
TO_MERGE/cse/main/misc/functions/fn_disableUserInput_f.sqf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* fn_disableUserInput_f.sqf
|
||||||
|
* @Descr: Disables the user input. Works stacked.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [id STRING, disable BOOL]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_id","_disable"];
|
||||||
|
_id = _this select 0;
|
||||||
|
_disable = _this select 1;
|
||||||
|
|
||||||
|
|
||||||
|
if (isnil "CSE_DISABLE_USER_INPUT_COLLECTION_F") then {
|
||||||
|
CSE_DISABLE_USER_INPUT_COLLECTION_F = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_disable) then {
|
||||||
|
CSE_DISABLE_USER_INPUT_COLLECTION_F pushback _id;
|
||||||
|
[true] call cse_fnc_disableKeyInput_f;
|
||||||
|
} else {
|
||||||
|
CSE_DISABLE_USER_INPUT_COLLECTION_F = CSE_DISABLE_USER_INPUT_COLLECTION_F - [_id];
|
||||||
|
if (CSE_DISABLE_USER_INPUT_COLLECTION_F isEqualTo []) then {
|
||||||
|
[false] call cse_fnc_disableKeyInput_f;
|
||||||
|
};
|
||||||
|
};
|
39
TO_MERGE/cse/main/misc/functions/fn_dropWeapon_f.sqf
Normal file
39
TO_MERGE/cse/main/misc/functions/fn_dropWeapon_f.sqf
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* fn_dropWeapon_f.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"];
|
||||||
|
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
_currentWeapon = currentWeapon _unit;
|
||||||
|
_currentAnimation = animationState _unit;
|
||||||
|
_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit;
|
||||||
|
|
||||||
|
_unit removeWeapon _currentWeapon;
|
||||||
|
_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1];
|
||||||
|
//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ];
|
||||||
|
_WeaponHolder setPos (getPos _unit);
|
||||||
|
//_unit switchMove _currentAnimation;
|
||||||
|
|
||||||
|
_primairyWeapon = primaryWeapon _unit;
|
||||||
|
_secondairyWeapon = secondaryWeapon _unit;
|
||||||
|
_handGunWeapon = handgunWeapon _unit;
|
||||||
|
|
||||||
|
switch (_currentWeapon) do {
|
||||||
|
case _primairyWeapon: {
|
||||||
|
|
||||||
|
};
|
||||||
|
case _secondairyWeapon: {
|
||||||
|
|
||||||
|
};
|
||||||
|
case _handGunWeapon: {
|
||||||
|
|
||||||
|
};
|
||||||
|
default {};
|
||||||
|
};
|
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* fn_endRadioTransmission_f.sqf
|
||||||
|
* @Descr: force end all radio transmissions by TFAR or ACRE
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return: nil
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (["acre_api"] call cse_fnc_isModLoaded_F) then {
|
||||||
|
[-1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||||
|
[0] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||||
|
[1] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||||
|
[2] call acre_sys_core_fnc_handleMultiPttKeyPressUp;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (["task_force_radio"] call cse_fnc_isModLoaded_F) then {
|
||||||
|
call TFAR_fnc_onSwTangentReleased;
|
||||||
|
call TFAR_fnc_onAdditionalSwTangentReleased;
|
||||||
|
|
||||||
|
call TFAR_fnc_onLRTangentReleased;
|
||||||
|
call TFAR_fnc_onAdditionalLRTangentReleased;
|
||||||
|
|
||||||
|
call TFAR_fnc_onDDTangentReleased;
|
||||||
|
};
|
||||||
|
|
||||||
|
nil;
|
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* fn_getFirstIntersection.sqf
|
||||||
|
* @Descr: Returns the the first intersection with an object between two positions
|
||||||
|
* @Author: Ruthberg
|
||||||
|
*
|
||||||
|
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
|
||||||
|
* @Return: [intersects BOOL, intersection PositionASL]
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersections", "_result"];
|
||||||
|
_source = _this select 0;
|
||||||
|
_destination = _this select 1;
|
||||||
|
_accuracy = _this select 2;
|
||||||
|
|
||||||
|
_result = [false, [0, 0, 0]];
|
||||||
|
|
||||||
|
_distance = _source vectorDistance _destination;
|
||||||
|
|
||||||
|
if (count (lineIntersectsWith [_source, _destination]) > 0) then {
|
||||||
|
_lower = 0;
|
||||||
|
_upper = 1;
|
||||||
|
_mid = 0.5;
|
||||||
|
|
||||||
|
_dir = _source vectorFromTo _destination;
|
||||||
|
|
||||||
|
while {(_upper - _lower) * _distance > _accuracy} do {
|
||||||
|
_mid = _lower + (_upper - _lower) / 2;
|
||||||
|
|
||||||
|
_intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]);
|
||||||
|
|
||||||
|
if (_intersections > 0) then {
|
||||||
|
_upper = _mid;
|
||||||
|
} else {
|
||||||
|
_lower = _mid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_mid = _lower + (_upper - _lower) / 2;
|
||||||
|
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||||
|
};
|
||||||
|
|
||||||
|
_result
|
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* fn_getFirstIntersection.sqf
|
||||||
|
* @Descr: Returns the the first intersection with an object between two positions
|
||||||
|
* @Author: Ruthberg
|
||||||
|
*
|
||||||
|
* @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
|
||||||
|
* @Return: [intersects BOOL, intersection PositionASL]
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_source", "_destination", "_accuracy", "_distance", "_lower", "_upper", "_mid", "_intersection", "_result"];
|
||||||
|
_source = _this select 0;
|
||||||
|
_destination = _this select 1;
|
||||||
|
_accuracy = _this select 2;
|
||||||
|
|
||||||
|
_result = [false, [0, 0, 0]];
|
||||||
|
|
||||||
|
_distance = _source vectorDistance _destination;
|
||||||
|
|
||||||
|
if (terrainIntersectASL [_source, _destination]) then {
|
||||||
|
_lower = 0;
|
||||||
|
_upper = 1;
|
||||||
|
_mid = 0.5;
|
||||||
|
|
||||||
|
_dir = _source vectorFromTo _destination;
|
||||||
|
|
||||||
|
while {(_upper - _lower) * _distance > _accuracy} do {
|
||||||
|
_mid = _lower + (_upper - _lower) / 2;
|
||||||
|
|
||||||
|
_intersection = terrainIntersectASL [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||||
|
|
||||||
|
if (_intersection) then {
|
||||||
|
_upper = _mid;
|
||||||
|
} else {
|
||||||
|
_lower = _mid;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_mid = _lower + (_upper - _lower) / 2;
|
||||||
|
_result = [true, _source vectorAdd (_dir vectorMultiply (_mid * _distance))];
|
||||||
|
};
|
||||||
|
|
||||||
|
_result
|
26
TO_MERGE/cse/main/misc/functions/fn_getName.sqf
Normal file
26
TO_MERGE/cse/main/misc/functions/fn_getName.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* fn_getName.sqf
|
||||||
|
* @Descr: Get the name of unit
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: STRING Name of object
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private["_unit","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_return = "Unknown";
|
||||||
|
|
||||||
|
if (alive _unit) then {
|
||||||
|
if (_unit iskindof "CAManBase") then {
|
||||||
|
if (_unit getvariable ["cse_isDead",false]) then {
|
||||||
|
_return = _unit getvariable ["cse_name","Unknown"];
|
||||||
|
} else {
|
||||||
|
_return = name _unit;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_return = _unit getvariable ["cse_name","Unknown"];
|
||||||
|
};
|
||||||
|
_return
|
14
TO_MERGE/cse/main/misc/functions/fn_getWeaponItems_f.sqf
Normal file
14
TO_MERGE/cse/main/misc/functions/fn_getWeaponItems_f.sqf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_getWeaponItems_f.sqf
|
||||||
|
* @Descr: Get the weapon items from the unit.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private "_unit";
|
||||||
|
_unit = _this select 0;
|
||||||
|
|
||||||
|
[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit];
|
16
TO_MERGE/cse/main/misc/functions/fn_hasItem_f.sqf
Normal file
16
TO_MERGE/cse/main/misc/functions/fn_hasItem_f.sqf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* fn_hasItem_f.sqf
|
||||||
|
* @Descr: Check if a unit has item
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, item STRING (Classname of item)]
|
||||||
|
* @Return: BOOL True if unit has the item in it's inventory
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_unit","_item"];
|
||||||
|
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param;
|
||||||
|
_item = [_this, 1, "", [""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
(_item in items _unit);
|
20
TO_MERGE/cse/main/misc/functions/fn_inWater_f.sqf
Normal file
20
TO_MERGE/cse/main/misc/functions/fn_inWater_f.sqf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* fn_inWater_f.sqf
|
||||||
|
* @Descr: Check if unit is underwater
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: BOOL True if unit is in the water
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_return","_aslPos"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_return = false;
|
||||||
|
if ((surfaceIsWater getPos _unit)) then {
|
||||||
|
_aslPos = _unit modelToWorld (_unit selectionPosition "head");
|
||||||
|
if ((_aslPos select 2) <= 0) then {
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_return;
|
13
TO_MERGE/cse/main/misc/functions/fn_isAwake.sqf
Normal file
13
TO_MERGE/cse/main/misc/functions/fn_isAwake.sqf
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* fn_isAwake.sqf
|
||||||
|
* @Descr: Check if unit is awake. Will be false when death or unit is unconscious.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: BOOL True if unit is awake
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_return"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
(!([_unit] call cse_fnc_isUnconscious)) && alive _unit && !(_unit getvariable ["cse_isDead",false]);
|
23
TO_MERGE/cse/main/misc/functions/fn_isInBuilding.sqf
Normal file
23
TO_MERGE/cse/main/misc/functions/fn_isInBuilding.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* fn_isInBuilding.sqf
|
||||||
|
* @Descr: Check is unit is within a building
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: BOOL True if unit is under a roof
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_eyePos","_obj","_isInBuilding"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
|
||||||
|
_eyePos = eyePos _unit;
|
||||||
|
_isInBuilding = false;
|
||||||
|
_obj = (lineIntersectsWith [_unit modelToWorld [0, 0, (_eyePos select 2)], _unit modelToWorld [0, 0, (_eyePos select 2) +10], _unit]);
|
||||||
|
{
|
||||||
|
if (_x isKindOf "Building") exitwith {
|
||||||
|
_isInBuilding = true;
|
||||||
|
};
|
||||||
|
}foreach _obj;
|
||||||
|
|
||||||
|
_isInBuilding
|
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* fn_lockVehicleOfUnitUntil.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_vehicleOfUnit","_lockSwitch"];
|
||||||
|
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_vehicleOfUnit = vehicle _unit;
|
||||||
|
_lockSwitch = false;
|
||||||
|
waituntil{
|
||||||
|
if (!_lockSwitch) then {
|
||||||
|
if (_vehicleOfUnit != _unit) then {
|
||||||
|
if (locked _vehicleOfUnit != 0) then {
|
||||||
|
_lockSwitch = true;
|
||||||
|
_vehicleOfUnit lock true;
|
||||||
|
[format["VEHICLE LOCKED %1", _vehicleOfUnit]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (vehicle _unit == _unit) then {
|
||||||
|
_vehicleOfUnit lock false;
|
||||||
|
_lockSwitch = false;
|
||||||
|
[format["VEHICLE UNLOCKED %1", _vehicleOfUnit]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
(!(_unit getvariable ["cse_state_unconscious", false]) || !alive _unit)};
|
||||||
|
|
||||||
|
if (_lockSwitch) then {
|
||||||
|
_vehicleOfUnit lock false;
|
||||||
|
[format["VEHICLE UNLOCKED %1", _vehicleOfUnit]] call cse_fnc_debug;
|
||||||
|
} else {
|
||||||
|
[format["NO VEHICLE TO UNLOCKED %1", _unit]] call cse_fnc_debug;
|
||||||
|
};
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* fn_moduleEnableBasicRevive.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_args", "_units", "_activated"];
|
||||||
|
_args = _this;
|
||||||
|
|
||||||
|
CSE_ENABLE_REVIVE_F = 0;
|
||||||
|
CSE_REVIVE_TIMER_F = 600;
|
||||||
|
CSE_REVIVE_NUMBER_MAX_F = -1;
|
||||||
|
{
|
||||||
|
_value = _x select 1;
|
||||||
|
if (!isnil "_value") then {
|
||||||
|
if (_x select 0 == "enableFor") then {
|
||||||
|
CSE_ENABLE_REVIVE_F = _x select 1;
|
||||||
|
};
|
||||||
|
if (_x select 0 == "timer") then {
|
||||||
|
CSE_REVIVE_TIMER_F = _x select 1;
|
||||||
|
};
|
||||||
|
if (_x select 0 == "amountOf") then {
|
||||||
|
CSE_REVIVE_NUMBER_MAX_F = _x select 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}foreach _args;
|
||||||
|
|
||||||
|
[
|
||||||
|
{(((_this select 0) getvariable["CSE_ENABLE_REVIVE_SETDEAD_F",0]) > 0)}
|
||||||
|
] call cse_fnc_registerUnconsciousCondition;
|
||||||
|
|
||||||
|
[format["Enabled Basic Revive Module - ENABLED FOR: %1. TIMER: %2. NUMBER: %3", CSE_ENABLE_REVIVE_F, CSE_REVIVE_TIMER_F, CSE_REVIVE_NUMBER_MAX_F]] call cse_fnc_debug;
|
51
TO_MERGE/cse/main/misc/functions/fn_resetAllDefaults_f.sqf
Normal file
51
TO_MERGE/cse/main/misc/functions/fn_resetAllDefaults_f.sqf
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* fn_resetAllDefaults_f.sqf
|
||||||
|
* @Descr: reset all variables that have been defined
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit","_oldUnit","_sets","_CSEFadingBlackUI","_ctrlFadingBlackUI"];
|
||||||
|
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
|
||||||
|
_oldUnit = [_this, 1, objNull, [objNull]] call BIS_fnc_param;
|
||||||
|
|
||||||
|
//_unit setvariable["cse_unconscious_non_captive_f",nil];
|
||||||
|
if (missionNamespace getvariable ["cse_unconscious_non_captive_f",false]) then {
|
||||||
|
_unit setCaptive false;
|
||||||
|
missionNamespace setvariable["cse_unconscious_non_captive_f",nil];
|
||||||
|
[format["Detected unit as a non captive but in captive state. RESETTING"]] call cse_fnc_debug;
|
||||||
|
} else {
|
||||||
|
[format["didn't trigger but unit is: %1 - %2", captive _unit, (missionNamespace getvariable ["cse_unconscious_non_captive_f",false])]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
|
||||||
|
_unit setvariable ["cse_isDead",nil,true];
|
||||||
|
_unit setvariable ["cse_state_unconscious", nil, true];
|
||||||
|
|
||||||
|
if (isPlayer _unit) then {
|
||||||
|
[true] call cse_fnc_setVolume_f;
|
||||||
|
[false] call cse_fnc_disableKeyInput_f;
|
||||||
|
[false] call cse_fnc_effectBlackOut;
|
||||||
|
[player, -1] call cse_fnc_limitSpeed;
|
||||||
|
if (isnil "CSE_DISABLE_USER_INPUT_COLLECTION_F") then {
|
||||||
|
CSE_DISABLE_USER_INPUT_COLLECTION_F = [];
|
||||||
|
};
|
||||||
|
{
|
||||||
|
[_X, false] call cse_fnc_disableUserInput_f;
|
||||||
|
}foreach CSE_DISABLE_USER_INPUT_COLLECTION_F;
|
||||||
|
};
|
||||||
|
_sets = [_unit] call cse_fnc_getAllSetVariables;
|
||||||
|
[format["defaults for %1 : %2",_unit,_sets]] call cse_fnc_debug;
|
||||||
|
if ((count _sets) > 0) then {
|
||||||
|
{
|
||||||
|
if (!(_x select 4)) then {
|
||||||
|
_unit setvariable [(_x select 0),nil,_x select 3];
|
||||||
|
[format["RESETTING: %1",[(_x select 0),_unit, _x select 1, (_unit getvariable (_x select 0))]]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
}foreach _sets;
|
||||||
|
} else {
|
||||||
|
["No defaults have been set"] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
[[_unit],"resetToDefaults"] call cse_fnc_customEventHandler_F;
|
4
TO_MERGE/cse/main/misc/functions/fn_revealObject_f.sqf
Normal file
4
TO_MERGE/cse/main/misc/functions/fn_revealObject_f.sqf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
if (hasInterface) then {
|
||||||
|
player reveal (_this select 0);
|
||||||
|
};
|
101
TO_MERGE/cse/main/misc/functions/fn_setDead.sqf
Normal file
101
TO_MERGE/cse/main/misc/functions/fn_setDead.sqf
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* fn_setDead.sqf
|
||||||
|
* @Descr: Kills a unit
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit"];
|
||||||
|
_unit = _this select 0;
|
||||||
|
_force = false;
|
||||||
|
if (count _this >= 2) then {
|
||||||
|
_force = _this select 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!alive _unit) exitwith{};
|
||||||
|
if (!local _unit) exitwith {
|
||||||
|
[[_unit, _force], "cse_fnc_setDead", _unit, false] spawn BIS_fnc_MP;
|
||||||
|
diag_log format["WARNING: cse_fnc_setDead triggered on non local unit %1", _unit];
|
||||||
|
};
|
||||||
|
if (isnil "CSE_ENABLE_REVIVE_F") then {
|
||||||
|
CSE_ENABLE_REVIVE_F = 0;
|
||||||
|
};
|
||||||
|
_name = _unit getvariable "cse_name";
|
||||||
|
if (isnil "_name") then {
|
||||||
|
_unit setvariable ["cse_name", name _unit, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (((CSE_ENABLE_REVIVE_F == 1 && isPlayer _unit) || (CSE_ENABLE_REVIVE_F == 2)) && !_force) then {
|
||||||
|
[format["CSE_ENABLE_REVIVE_F %1",_unit]] call cse_fnc_debug;
|
||||||
|
_unit spawn {
|
||||||
|
private ["_unit","_counter"];
|
||||||
|
_unit = _this;
|
||||||
|
_playerDead = isPlayer _unit;
|
||||||
|
|
||||||
|
if ((_unit getvariable["CSE_ENABLE_REVIVE_SETDEAD_F",0]) > 0) exitwith {
|
||||||
|
_unit setvariable["CSE_ENABLE_REVIVE_SETDEAD_F",(_unit getvariable["CSE_ENABLE_REVIVE_SETDEAD_F",0]) + 1];
|
||||||
|
};
|
||||||
|
_unit setvariable["CSE_ENABLE_REVIVE_SETDEAD_F",1];
|
||||||
|
[_unit] call cse_fnc_setUnconsciousState;
|
||||||
|
if (isnil "CSE_REVIVE_TIMER_F") then {
|
||||||
|
CSE_REVIVE_TIMER_F = 10;
|
||||||
|
};
|
||||||
|
if (isnil "CSE_REVIVE_NUMBER_MAX_F") then {
|
||||||
|
CSE_REVIVE_NUMBER_MAX_F = -1;
|
||||||
|
};
|
||||||
|
waituntil {([_unit] call cse_fnc_isUnconscious)};
|
||||||
|
_counter = 0;
|
||||||
|
if (alive (vehicle _unit)) then {
|
||||||
|
_unit setvariable ["cse_inReviveState", true, true];
|
||||||
|
while {([_unit] call cse_fnc_isUnconscious)} do {
|
||||||
|
_counter = _unit getvariable ["CSE_ENABLE_REVIVE_COUNTER",_counter];
|
||||||
|
if (_counter > CSE_REVIVE_TIMER_F || (((_unit getvariable["CSE_ENABLE_REVIVE_SETDEAD_F",0]) > CSE_REVIVE_NUMBER_MAX_F) && (CSE_REVIVE_NUMBER_MAX_F > 0))) exitwith{
|
||||||
|
if (_counter > CSE_REVIVE_TIMER_F) then {
|
||||||
|
[format["Timer ran out for %1",_unit]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
if (((_unit getvariable["CSE_ENABLE_REVIVE_SETDEAD_F",0]) > CSE_REVIVE_NUMBER_MAX_F) && (CSE_REVIVE_NUMBER_MAX_F > 0)) then {
|
||||||
|
[format["amount of calls for setDead ran out for %1",_unit]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
if (isPlayer _unit) then {
|
||||||
|
titleText ["You died..","PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
[format["cse_isDead %1",_unit]] call cse_fnc_debug;
|
||||||
|
[_unit,"cse_isDead",true,true] call cse_fnc_setVariable;
|
||||||
|
if (_playerDead) then {
|
||||||
|
[_unit,"cse_isDeadPlayer",true,true] call cse_fnc_setVariable;
|
||||||
|
};
|
||||||
|
_unit setdamage 1;
|
||||||
|
[[_unit, true],"killed"] call cse_fnc_customEventHandler_F;
|
||||||
|
};
|
||||||
|
sleep 1;
|
||||||
|
_unit setvariable ["CSE_ENABLE_REVIVE_COUNTER",_counter + 1];
|
||||||
|
_counter = _counter + 1;
|
||||||
|
};
|
||||||
|
_unit setvariable ["cse_inReviveState", nil, true];
|
||||||
|
[format["no longer unconscious %1",_unit]] call cse_fnc_debug;
|
||||||
|
} else {
|
||||||
|
if (isPlayer _unit) then {
|
||||||
|
titleText ["You died..","PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
[_unit,"cse_isDead",true,true] call cse_fnc_setVariable;
|
||||||
|
_unit setdamage 1;
|
||||||
|
[[_unit, false],"killed"] call cse_fnc_customEventHandler_F;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
[format["INSTANT KILL %1",_unit]] call cse_fnc_debug;
|
||||||
|
_unit setvariable ["cse_isUnconscious", true, true];
|
||||||
|
if (isPlayer _unit) then {
|
||||||
|
titleText ["You died..","PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
if (isPLayer _unit) then {
|
||||||
|
[_unit,"cse_isDeadPlayer",true,true] call cse_fnc_setVariable;
|
||||||
|
};
|
||||||
|
_unit setdamage 1;
|
||||||
|
[_unit,"cse_isDead",true,true] call cse_fnc_setVariable;
|
||||||
|
|
||||||
|
[[_unit, false],"killed"] call cse_fnc_customEventHandler_F;
|
||||||
|
};
|
53
TO_MERGE/cse/main/misc/functions/fn_setHearingCapability.sqf
Normal file
53
TO_MERGE/cse/main/misc/functions/fn_setHearingCapability.sqf
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* fn_setHearingCapability.sqf
|
||||||
|
* @Descr: Handle set volume calls. Will use the lowest available volume setting.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)]
|
||||||
|
* @Return: nil
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_id", "_settings", "_add", "_exists", "_map", "_lowestVolume"];
|
||||||
|
_id = _this select 0;
|
||||||
|
_settings = _this select 1;
|
||||||
|
_add = true;
|
||||||
|
if (count _this > 2) then {
|
||||||
|
_add = _this select 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
_map = missionNamespace getVariable ["cse_setHearingCapabilityMap",[]];
|
||||||
|
|
||||||
|
_exists = false;
|
||||||
|
{
|
||||||
|
if (_id == _x select 0) exitWith {
|
||||||
|
_exists = true;
|
||||||
|
if (_add) then {
|
||||||
|
_x set [1, _settings];
|
||||||
|
} else {
|
||||||
|
_map set [_forEachIndex, 0];
|
||||||
|
_map = _map - [0];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _map;
|
||||||
|
|
||||||
|
if (!_exists && _add) then {
|
||||||
|
_map pushBack [_id, _settings];
|
||||||
|
};
|
||||||
|
|
||||||
|
missionNamespace setVariable ["cse_setHearingCapabilityMap", _map];
|
||||||
|
|
||||||
|
// find lowest volume
|
||||||
|
_lowestVolume = 1;
|
||||||
|
{
|
||||||
|
_lowestVolume = (_x select 1) min _lowestVolume;
|
||||||
|
} forEach _map;
|
||||||
|
|
||||||
|
// in game sounds
|
||||||
|
0 fadeSound _lowestVolume;
|
||||||
|
0 fadeRadio _lowestVolume;
|
||||||
|
0 fadeMusic _lowestVolume;
|
||||||
|
|
||||||
|
// Set Radio mod variables.
|
||||||
|
player setVariable ["tf_globalVolume", _lowestVolume];
|
||||||
|
player setVariable ["acre_sys_core_globalVolume", _lowestVolume];
|
26
TO_MERGE/cse/main/misc/functions/fn_setProne.sqf
Normal file
26
TO_MERGE/cse/main/misc/functions/fn_setProne.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* fn_setProne.sqf
|
||||||
|
* @Descr: Force a unit to go prone
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_unit"];
|
||||||
|
_unit = [_this,0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
switch (currentWeapon _unit) do {
|
||||||
|
case (primaryWeapon _unit): {
|
||||||
|
[_unit,"amovppnemstpsraswrfldnon"] call cse_fnc_localAnim;
|
||||||
|
};
|
||||||
|
case (secondaryWeapon _unit): {
|
||||||
|
[_unit,"amovppnemstpsraswlnrdnon"] call cse_fnc_localAnim;
|
||||||
|
};
|
||||||
|
case (handgunWeapon _unit): {
|
||||||
|
[_unit,"AmovPpneMstpSrasWpstDnon"] call cse_fnc_localAnim;
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
[_unit,"amovppnemstpsnonwnondnon"] call cse_fnc_localAnim;
|
||||||
|
};
|
||||||
|
};
|
45
TO_MERGE/cse/main/misc/functions/fn_setVolume_f.sqf
Normal file
45
TO_MERGE/cse/main/misc/functions/fn_setVolume_f.sqf
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* fn_setVolume_f.sqf
|
||||||
|
* @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [setVolume BOOL]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
#define MUTED_LEVEL 0.2
|
||||||
|
#define NORMAL_LEVEL 1
|
||||||
|
#define NO_SOUND 0
|
||||||
|
|
||||||
|
private ["_setVolume"];
|
||||||
|
_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
if (_setVolume) then {
|
||||||
|
// Vanilla Game
|
||||||
|
2 fadeSound NORMAL_LEVEL;
|
||||||
|
|
||||||
|
// TFAR
|
||||||
|
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
|
||||||
|
player setVariable ["tf_globalVolume", NORMAL_LEVEL];
|
||||||
|
player setVariable ["tf_unable_to_use_radio", false];
|
||||||
|
|
||||||
|
// ACRE2
|
||||||
|
player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL];
|
||||||
|
player setVariable ["acre_sys_core_isDisabled", false, true];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Vanilla Game
|
||||||
|
2 fadeSound MUTED_LEVEL;
|
||||||
|
|
||||||
|
// TFAR
|
||||||
|
player setVariable ["tf_voiceVolume", NO_SOUND, true];
|
||||||
|
player setVariable ["tf_globalVolume", MUTED_LEVEL];
|
||||||
|
player setVariable ["tf_unable_to_use_radio", true];
|
||||||
|
|
||||||
|
// ACRE2
|
||||||
|
player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL];
|
||||||
|
player setVariable ["acre_sys_core_isDisabled", true, true];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
[[_setVolume],"setVolume"] call cse_fnc_customEventHandler_F;
|
65
TO_MERGE/cse/main/misc/functions/fn_switchToGroupSide_f.sqf
Normal file
65
TO_MERGE/cse/main/misc/functions/fn_switchToGroupSide_f.sqf
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* fn_switchToGroupSide_f.sqf
|
||||||
|
* @Descr: Stack group switches. Will always trace back to original group.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [unit OBJECT, switch BOOL, id STRING, side SIDE]
|
||||||
|
* @Return: void
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_unit","_side","_previousGroup","_newGroup", "_currentGroup", "_switch", "_originalSide", "_previousGroupsList", "_id"];
|
||||||
|
_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||||
|
_switch = [_this, 1, false,[false]] call BIS_fnc_Param;
|
||||||
|
_id = [_this, 2, "", [""]] call BIS_fnc_Param;
|
||||||
|
_side = [_this, 3, side _unit,[west]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
_previousGroupsList = _unit getvariable ["cse_previous_group_switchTo_f",[]];
|
||||||
|
if (_switch) then {
|
||||||
|
// go forward
|
||||||
|
_previousGroup = group _unit;
|
||||||
|
_originalSide = side group _unit;
|
||||||
|
|
||||||
|
if (count units _previousGroup == 1 && _originalSide == _side) exitwith {
|
||||||
|
[format["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
|
||||||
|
_newGroup = createGroup _side;
|
||||||
|
[_unit] joinSilent _newGroup;
|
||||||
|
|
||||||
|
_previousGroupsList pushback [_previousGroup, _originalSide, _id, true];
|
||||||
|
_unit setvariable ["cse_previous_group_switchTo_f", _previousGroupsList, true];
|
||||||
|
} else {
|
||||||
|
// go one back
|
||||||
|
{
|
||||||
|
if (_id == (_x select 2)) exitwith {
|
||||||
|
_x set [ 3, false];
|
||||||
|
_previousGroupsList set [_foreachIndex, _x];
|
||||||
|
[format["found group with ID: %1", _id]] call cse_fnc_debug;
|
||||||
|
};
|
||||||
|
}foreach _previousGroupsList;
|
||||||
|
reverse _previousGroupsList;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_x select 3) exitwith {}; // stop at first id set to true
|
||||||
|
if !(_x select 3) then {
|
||||||
|
_currentGroup = group _unit;
|
||||||
|
if (!isNull (_x select 0)) then {
|
||||||
|
[_unit] joinSilent (_x select 0);
|
||||||
|
} else {
|
||||||
|
_newGroup = createGroup (_x select 1);
|
||||||
|
[_unit] joinSilent _newGroup;
|
||||||
|
};
|
||||||
|
if (count units _currentGroup == 0) then {
|
||||||
|
deleteGroup _currentGroup;
|
||||||
|
};
|
||||||
|
_previousGroupsList set [_foreachIndex, ObjNull];
|
||||||
|
};
|
||||||
|
}foreach _previousGroupsList;
|
||||||
|
_previousGroupsList = _previousGroupsList - [objNull];
|
||||||
|
reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order.
|
||||||
|
_unit setvariable ["cse_previous_group_switchTo_f", _previousGroupsList, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
[[_unit, _switch, _id, _side],"switchToGroupSide"] call cse_fnc_customEventHandler_F;
|
16
TO_MERGE/cse/main/mods/functions/fn_ALiVE_BUS_Mod.sqf
Normal file
16
TO_MERGE/cse/main/mods/functions/fn_ALiVE_BUS_Mod.sqf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* fn_ALiVE_BUS_Mod.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_busArguments","_return"];
|
||||||
|
_busArguments = [_this, 0, [], [[]]] call BIS_fnc_Param;
|
||||||
|
if ([] call cse_fnc_isLoaded_ALiVE_Mod) then {
|
||||||
|
_return = _busArguments call ALiVE_fnc_BUS;
|
||||||
|
};
|
||||||
|
_return
|
12
TO_MERGE/cse/main/mods/functions/fn_isLoaded_ALiVE_Mod.sqf
Normal file
12
TO_MERGE/cse/main/mods/functions/fn_isLoaded_ALiVE_Mod.sqf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* fn_isLoaded_ALiVE_Mod.sqf
|
||||||
|
* Descr: Check if the ALiVE Modification is loaded
|
||||||
|
* Author: Glowbal
|
||||||
|
*
|
||||||
|
* Arguments: []
|
||||||
|
* Return: BOOL true if ALiVE is loaded
|
||||||
|
* PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
(["ALIVE_main"] call cse_fnc_isModLoaded_f)
|
14
TO_MERGE/cse/main/mods/functions/fn_isModLoaded_f.sqf
Normal file
14
TO_MERGE/cse/main/mods/functions/fn_isModLoaded_f.sqf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* fn_isModLoaded_f.sqf
|
||||||
|
* Descr: Check in cfgPatches if modification is loaded
|
||||||
|
* Author: Glowbal
|
||||||
|
*
|
||||||
|
* Arguments: [modName STRING (Classname of the mod in cfgPatches)]
|
||||||
|
* Return: BOOL true if modification is loaded
|
||||||
|
* PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_modName"];
|
||||||
|
_modName = [_this, 0, "",[""]] call BIS_fnc_Param;
|
||||||
|
|
||||||
|
(isClass (configFile >> "cfgPatches" >> _modName))
|
24
TO_MERGE/cse/main/mutex/functions/fn_createMutex.sqf
Normal file
24
TO_MERGE/cse/main/mutex/functions/fn_createMutex.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* fn_createMutex.sqf
|
||||||
|
* @Descr: Create a Mutex
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [mutexName STRING, intialStatus BOOL (True if initial status is locked)]
|
||||||
|
* @Return: BOOL True if mutex has been created.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_mutexName","_initalStatus","_return"];
|
||||||
|
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
||||||
|
_initalStatus = [_this, 1, false, [false]] call BIS_fnc_param;
|
||||||
|
_return = false;
|
||||||
|
if (_mutexName != "") then {
|
||||||
|
private["_mutexCombinedName"];
|
||||||
|
_mutexCombinedName = format["CSE_FRAMEWORK_MUTEX_%1",_mutexName];
|
||||||
|
if (isnil _mutexCombinedName) then {
|
||||||
|
missionNamespace setvariable [_mutexCombinedName, _initalStatus];
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_return
|
24
TO_MERGE/cse/main/mutex/functions/fn_lockMutex.sqf
Normal file
24
TO_MERGE/cse/main/mutex/functions/fn_lockMutex.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* fn_lockMutex.sqf
|
||||||
|
* @Descr: Lock a mutex. If mutex exists and is locked, will wait until mutex becomes free, before locking it again.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [mutexName STRING]
|
||||||
|
* @Return: BOOL True if succesfullly locked.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_mutexName","_initalStatus","_return"];
|
||||||
|
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
||||||
|
|
||||||
|
_return = false;
|
||||||
|
if (_mutexName != "")then {
|
||||||
|
private["_mutexCombinedName"];
|
||||||
|
_mutexCombinedName = format["CSE_FRAMEWORK_MUTEX_%1",_mutexName];
|
||||||
|
if !(isnil _mutexCombinedName) then {
|
||||||
|
[_mutexName] call cse_fnc_waitForSingleMutex;
|
||||||
|
missionNamespace setvariable [_mutexCombinedName, 1];
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_return
|
24
TO_MERGE/cse/main/mutex/functions/fn_releaseMutex.sqf
Normal file
24
TO_MERGE/cse/main/mutex/functions/fn_releaseMutex.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* fn_releaseMutex.sqf
|
||||||
|
* @Descr: Releases or unlocks a mutex.
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: [mutexName STRING]
|
||||||
|
* @Return: True if succesfully unlocked or mutex was never locked.
|
||||||
|
* @PublicAPI: true
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_mutexName","_initalStatus","_return"];
|
||||||
|
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
||||||
|
|
||||||
|
_return = false;
|
||||||
|
if (_mutexName != "")then {
|
||||||
|
private["_mutexCombinedName"];
|
||||||
|
_mutexCombinedName = format["CSE_FRAMEWORK_MUTEX_%1",_mutexName];
|
||||||
|
if !(isnil _mutexCombinedName) then {
|
||||||
|
missionNamespace setvariable [_mutexCombinedName, 0];
|
||||||
|
_return = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_return
|
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* fn_waitForMultipleMutex.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_mutexes"];
|
||||||
|
_mutexes = _this;
|
||||||
|
{
|
||||||
|
if (typeName _x == typeName "") then {
|
||||||
|
[_x, -1] call cse_fnc_waitForSingleMutex;
|
||||||
|
};
|
||||||
|
}foreach _mutexes;
|
28
TO_MERGE/cse/main/mutex/functions/fn_waitForSingleMutex.sqf
Normal file
28
TO_MERGE/cse/main/mutex/functions/fn_waitForSingleMutex.sqf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* fn_waitForSingleMutex.sqf
|
||||||
|
* @Descr: N/A
|
||||||
|
* @Author: Glowbal
|
||||||
|
*
|
||||||
|
* @Arguments: []
|
||||||
|
* @Return:
|
||||||
|
* @PublicAPI: false
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_mutexName","_timeout","_return"];
|
||||||
|
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
||||||
|
if (count _this > 1) then {
|
||||||
|
_timeout = [_this, 1, -1, [-1]] call BIS_fnc_param;
|
||||||
|
};
|
||||||
|
|
||||||
|
_return = false;
|
||||||
|
if (_mutexName != "") then {
|
||||||
|
private["_mutexCombinedName"];
|
||||||
|
_mutexCombinedName = format["CSE_FRAMEWORK_MUTEX_%1",_mutexName];
|
||||||
|
if !(isnil _mutexCombinedName) then {
|
||||||
|
_startTime = time;
|
||||||
|
waituntil {((missionNamespace getvariable [_mutexCombinedName, 0]) == 0) || ((time - _startTime > (_timeout*accTime)) && _timeout > 0)};
|
||||||
|
_return = (missionNamespace getvariable [_mutexCombinedName, 0]) == 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_return
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user