still testing

This commit is contained in:
2024-02-09 21:37:59 -08:00
parent e0e06eff5e
commit 032377d7f6
24 changed files with 685 additions and 390 deletions

View File

@@ -1,195 +1,196 @@
#include "script_mod.hpp"
class CfgFunctions {
class DOUBLES(PREFIX,init) {
class functions {
file = "framework\init\functions";
class initServer { postInit = 1;};
class initClient { postInit = 1;};
class setDefaults { postInit = 1; };
class addAARChatHandler { postInit = 1; };
class addRespawnChatHandler { postInit = 1; };
};
class DOUBLES(PREFIX,init) {
class functions {
file = "framework\init\functions";
class initServer { postInit = 1;};
class initClient { postInit = 1;};
class setDefaults { postInit = 1; };
class addAARChatHandler { postInit = 1; };
class addRespawnChatHandler { postInit = 1; };
};
class PREFIX {
class ambience {
file = "framework\ambience";
class flakInitVehicle {};
class flakEH {};
};
};
class PREFIX {
class ambience {
file = "framework\ambience";
class flakInitVehicle {};
class flakEH {};
};
};
class DOUBLES(PREFIX,client) {
class functions {
file = "framework\client\functions";
class bindEmptyGroupGarbageCleanup { postInit = 1; };
class bindEventHandlers { postInit = 1; };
class bindVehicleActions { postInit = 1; };
class addZenModules {postInit = 1;};
};
class DOUBLES(PREFIX,client) {
class functions {
file = "framework\client\functions";
class bindEmptyGroupGarbageCleanup { postInit = 1; };
class bindEventHandlers { postInit = 1; };
class bindVehicleActions { postInit = 1; };
class addZenModules {postInit = 1;};
};
};
class DOUBLES(PREFIX,common) {
class functions {
file = "framework\common\functions";
class addCBASettings { preInit = 1; };
class logMissionInfo {};
class addPlayerInfoToArray {};
class createOrUpdateDiaryRecord {};
class getApprovedAssetsCfg {};
class getBattalionCfg {};
class getNameOfBase {};
class getNearestBase {};
class log {};
class checkPlayerInventory {};
class logSettingChanged {};
class padString {};
class recurseSubclasses {};
};
class DOUBLES(PREFIX,common) {
class functions {
file = "framework\common\functions";
class addCBASettings { preInit = 1; };
class logMissionInfo {};
class addPlayerInfoToArray {};
class createOrUpdateDiaryRecord {};
class getApprovedAssetsCfg {};
class getBattalionCfg {};
class getNameOfBase {};
class getNearestBase {};
class log {};
class checkPlayerInventory {};
class logSettingChanged {};
class padString {};
class recurseSubclasses {};
};
};
class DOUBLES(PREFIX,emp) {
class functions {
file = "framework\emp\functions";
// class addCBASettings {preInit=1;};
class initClient {};
class addACEActions {};
class getObjectsToAffect {};
class applyLocalUnitEffects {};
class applyLocalGroupEffects {};
class deploy {};
class playZapServer {};
class flickerLights {};
};
class DOUBLES(PREFIX,emp) {
class functions {
file = "framework\emp\functions";
// class addCBASettings {preInit=1;};
class init {};
class addACEActions {};
class applyLocalObjectEffects {};
class applyLocalGroupEffects {};
class applyGlobalObjectEffects {};
class applyServerObjectEffects {};
class deploy {};
class getObjectsToAffect {};
class playLocalEffects {};
class playLocalEffectsForObject {};
};
};
class DOUBLES(PREFIX,fbcb2_assets) {
class functions {
file = "framework\fbcb2_assets\functions";
class addCBASettings {preInit=1;};
class initServer {};
class initClient {};
class getCallsignFromClassname {};
class getCurrentAssetsByBase {};
class getInventory {};
class getMagsForWeapon {};
class getStartingAndCurrentAssets {};
class getStartingAssetsByBase {};
class getVehicleData {};
class getWeaponry {};
class hintAllApprovedAssets {};
class isAssetInRangeOfBase {};
class removeAssetDiaryRecords {};
class removeMarkersOnMap {};
class showMarkersOnMap {};
class updateAssetDiary {};
class updateAssetsByBase {};
};
class DOUBLES(PREFIX,fbcb2_assets) {
class functions {
file = "framework\fbcb2_assets\functions";
class addCBASettings {preInit=1;};
class initServer {};
class initClient {};
class getCallsignFromClassname {};
class getCurrentAssetsByBase {};
class getInventory {};
class getMagsForWeapon {};
class getStartingAndCurrentAssets {};
class getStartingAssetsByBase {};
class getVehicleData {};
class getWeaponry {};
class hintAllApprovedAssets {};
class isAssetInRangeOfBase {};
class removeAssetDiaryRecords {};
class removeMarkersOnMap {};
class showMarkersOnMap {};
class updateAssetDiary {};
class updateAssetsByBase {};
};
};
class DOUBLES(PREFIX,fbcb2_main) {
class functions {
file = "framework\fbcb2_main\functions";
class initClient {};
class addEnvironmentRecord {};
class addFrequenciesRecord {};
class addSignalColorsRecord {};
};
class util {
file = "framework\fbcb2_main\util";
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
};
class DOUBLES(PREFIX,fbcb2_main) {
class functions {
file = "framework\fbcb2_main\functions";
class initClient {};
class addEnvironmentRecord {};
class addFrequenciesRecord {};
class addSignalColorsRecord {};
};
class DOUBLES(PREFIX,mapcopy) {
class functions {
file = "framework\mapcopy\functions";
class addCBASettings {preInit=1;};
class initClient {};
class getMapMarkers {};
class loadMapMarkers {};
class mapMarkerToString {};
class stringToMapMarker {};
};
class util {
file = "framework\fbcb2_main\util";
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
};
};
class DOUBLES(PREFIX,performance) {
class functions {
file = "framework\performance\functions";
class addCBASettings {preInit=1;};
class addDNI_PlayerFPS { postInit = 1; };
// PFHs managed in addCBASettings onChange code
class addClientStatsPFH {};
class calculateClientStats {};
class addServerStatsPFH {};
class calculateServerStats {};
};
class DOUBLES(PREFIX,mapcopy) {
class functions {
file = "framework\mapcopy\functions";
class addCBASettings {preInit=1;};
class initClient {};
class getMapMarkers {};
class loadMapMarkers {};
class mapMarkerToString {};
class stringToMapMarker {};
};
};
class DOUBLES(PREFIX,reinsert) {
class functions {
file = "framework\reinsert\functions";
class addCBASettings {preInit=1;};
};
class server {
file = "framework\reinsert\server";
class initServer {};
class addToQueue {};
class globalShowQueue {};
class removeFromQueue {};
class returnReinsertQueueNotification {};
class validateQueue {};
};
class client {
file = "framework\reinsert\client";
class initClient {};
class addAceSelfActions {};
class addCheckQueueSelfAction {};
class requestShowQueue {};
};
class DOUBLES(PREFIX,performance) {
class functions {
file = "framework\performance\functions";
class addCBASettings {preInit=1;};
class addDNI_PlayerFPS { postInit = 1; };
// PFHs managed in addCBASettings onChange code
class addClientStatsPFH {};
class calculateClientStats {};
class addServerStatsPFH {};
class calculateServerStats {};
};
};
class DOUBLES(PREFIX,resupply) {
class functions {
file = "framework\resupply\functions";
class addCBASettings {preInit=1;};
class initClient {};
class createBox {};
class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {};
};
class DOUBLES(PREFIX,reinsert) {
class functions {
file = "framework\reinsert\functions";
class addCBASettings {preInit=1;};
};
class DOUBLES(PREFIX,triageIcons) {
class functions {
file = "framework\triageIcons\functions";
class addCBASettings {preInit=1;};
class initClient {};
class addDrawIconsPFH {};
class addGetEntitiesPFH {};
class updateColors {};
};
class server {
file = "framework\reinsert\server";
class initServer {};
class addToQueue {};
class globalShowQueue {};
class removeFromQueue {};
class returnReinsertQueueNotification {};
class validateQueue {};
};
class DOUBLES(PREFIX,vehicleFlags) {
class functions {
file = "framework\vehicleFlags\functions";
class initClient {};
class getActionsFlagCategories {};
class getVehicleFlagsCfg {};
class isClassExcluded {};
};
class client {
file = "framework\reinsert\client";
class initClient {};
class addAceSelfActions {};
class addCheckQueueSelfAction {};
class requestShowQueue {};
};
};
class DOUBLES(PREFIX,zeus) {
class functions {
file = "framework\zeus\functions";
class initClient {};
class addZenModules {};
};
class DOUBLES(PREFIX,resupply) {
class functions {
file = "framework\resupply\functions";
class addCBASettings {preInit=1;};
class initClient {};
class createBox {};
class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {};
};
};
class DOUBLES(PREFIX,triageIcons) {
class functions {
file = "framework\triageIcons\functions";
class addCBASettings {preInit=1;};
class initClient {};
class addDrawIconsPFH {};
class addGetEntitiesPFH {};
class updateColors {};
};
};
class DOUBLES(PREFIX,vehicleFlags) {
class functions {
file = "framework\vehicleFlags\functions";
class initClient {};
class getActionsFlagCategories {};
class getVehicleFlagsCfg {};
class isClassExcluded {};
};
};
class DOUBLES(PREFIX,zeus) {
class functions {
file = "framework\zeus\functions";
class initClient {};
class addZenModules {};
};
};

View File

@@ -0,0 +1,37 @@
#include "script_component.hpp"
class GVAR(sound_zap1) {
name = QGVAR(sound_zap1);
sound[] = {"sounds\zap1.wss", db+10, 1};
titles[] = {};
};
class GVAR(sound_zap2) {
name = QGVAR(sound_zap2);
sound[] = {"sounds\zap2.wss", db+10, 1};
titles[] = {};
};
class GVAR(sound_zap3) {
name = QGVAR(sound_zap3);
sound[] = {"sounds\zap3.wss", db+10, 1};
titles[] = {};
};
class GVAR(sound_zap4) {
name = QGVAR(sound_zap4);
sound[] = {"sounds\zap4.wss", db+10, 1};
titles[] = {};
};
class GVAR(sound_electric_explsion_impact_large) {
name = QGVAR(sound_electric_explsion_impact_large);
sound[] = {"sounds\electric_explsion_impact_large.wss", db+750, 1};
titles[] = {};
};
class GVAR(sound_echo3) {
name = QGVAR(sound_echo3);
sound[] = {"sounds\echo3.wss", db+500, 1};
titles[] = {1,""};
};
class GVAR(sound_ecou) {
name = QGVAR(sound_ecou);
sound[] = {"sounds\ecou.wss", db+100, 1};
titles[] = {1,""};
};

View File

@@ -1,12 +1,47 @@
params [["_obj", objNull],["_rad", 500]];
#include "..\script_component.hpp"
private _action = [
"KE_bomb_aceActionStart", "Activate EMP bomb", "",
{(_this select 2) call KE_EB_fnc_loading;},{true}, {}, [_obj,_rad], [0,0,0.4], 5] call ace_interact_menu_fnc_createAction;
[_obj, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
private _rootAction = [
QGVAR(action_deploy),
"Deploy EMP Device",
"",
{
params ["_target", "_player", "_params"];
true;
},
{true},
{
params ["_target", "_player", "_params"];
private _childActions = [];
{
private _radius = _x;
private _action = [
format["%1_%2", QGVAR(action_deploy), _radius],
format["Deploy EMP Device (%1m)", _radius],
"",
{
params ["_target", "_player", "_params"];
_params params ["_radius"];
[GVAR(empDevice1), _radius] call FUNC(deploy);
},
{!isNull (missionNamespace getVariable [QGVAR(empDevice1), objNull]);},
nil,
[_radius]
] call ace_interact_menu_fnc_createAction;
[
LEVEL_TRACE,
QUOTE(COMPONENT),
format["parsed child action: %1", _action]
] call EFUNC(common,log);
_childActions pushBack _action;
false
} count [100,500,3000];
[
LEVEL_TRACE,
QUOTE(COMPONENT),
format["parsed child actions: %1", _childActions]
] call EFUNC(common,log);
//for debug
private _action = [
"KE_bomb_aceActionStart_Self", "Activate EMP bomb remote", "",
{(_this select 2) call KE_EB_fnc_loading;},{true}, {}, [d1,_rad], [0,0,0.4], 5] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToObject;
_childActions;
}
] call ace_interact_menu_fnc_createAction;
["CAManBase", 1, ["ACE_SelfActions"], _rootAction, true] call ace_interact_menu_fnc_addActionToClass;

View File

@@ -0,0 +1,35 @@
#include "..\script_component.hpp"
// Executed on all machines - global argument, local effect
// The effects must be applied on all machines
params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {};
_object setHitPointDamage ["hitturret",1];
_object setHitPointDamage ["hitcomturret",1];
_object setHitPointDamage ["hitcomgun",1];
_object setHitPointDamage ["#light_hitpoint",1];
_object setHitPointDamage ["HitBatteries",1];
_object setHitPointDamage ["HitLight",1];
_object setHitPointDamage ["#light_l",1];
_object setHitPointDamage ["#light_r",1];
_object setHitPointDamage ["#light_l_flare",1];
_object setHitPointDamage ["#light_r_flare",1];
_object setHitPointDamage ["light_l",1];
_object setHitPointDamage ["light_r",1];
_object setHitPointDamage ["light_l2",1];
_object setHitPointDamage ["light_r2",1];
_object setHitPointDamage ["hitEngine",1];
_object setHitPointDamage ["hitengine",1];
_object setHitPointDamage ["hitengine1",1];
_object setHitPointDamage ["hitengine2",1];
_object setHitPointDamage ["hitengine3",1];
_object setHitPointDamage ["HitEngine2",1];
_object setHitPointDamage ["HitAvionics",1];
_object setHitPointDamage ["HitHRotor",1];
_object setHitPointDamage ["HitVRotor",1];
_object setHitPointDamage ["HitHydraulics",1];
_object setHitPointDamage ["HitHStabilizerL1",1];
_object setHitPointDamage ["HitHStabilizerR1",1];
_object setHitPointDamage ["HitVStabilizer1",1];

View File

@@ -7,5 +7,3 @@ if !(local _group) exitWith {};
//set gunlight status
_group enableGunLights "forceOff";
_group enableIRLasers true;
true;

View File

@@ -0,0 +1,50 @@
#include "..\script_component.hpp"
// Executed on all clients, only continue if object is local.
// Local argument, global effect (the object owner broadcasts new state)
params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {};
if !(local _object) exitWith {};
_object disableAI "LIGHTS";
_object setPilotLight false;
_object setCollisionLight false;
//for player units
if (isPlayer _object) then {
_object action ["IRLaserOff", _object];
_object action ["nvGogglesOff", _object];
};
private _primaryFlashlightOrPointer = (primaryWeaponItems _object)#1;
if (_primaryFlashlightOrPointer != "") then {
_object removePrimaryWeaponItem _primaryFlashlightOrPointer;
_object removeItem _primaryFlashlightOrPointer;
};
private _secondaryFlashlightOrPointer = (secondaryWeaponItems _object)#1;
if (_secondaryFlashlightOrPointer != "") then {
_object removeSecondaryWeaponItem _secondaryFlashlightOrPointer;
_object removeItem _secondaryFlashlightOrPointer;
};
_nvgs = hmd _object;
_object unassignItem _nvgs;
_object removeItem _nvgs;
_radio = _object getSlotItemName 611;
_gps = _object getSlotItemName 612;
_object unassignItem _radio;
_object removeItem _radio;
_object unassignItem _gps;
_object removeItem _gps;
_object unassignItem "ACE_microDAGR";
_object removeItem "ACE_microDAGR";
_object unassignItem "MineDetector";
_object removeItem "MineDetector";
[{scriptDone (_object getVariable [QGVAR(flickerHandle), scriptNull])}, {
_object setHit ["light_1_hitpoint", 0.97]; //all possible light hitpoints
_object setHit ["light_2_hitpoint", 0.97]; //no lights escape this
_object setHit ["light_3_hitpoint", 0.97];
_object setHit ["light_4_hitpoint", 0.97];
}] call CBA_fnc_waitUntilAndExecute;

View File

@@ -1,45 +0,0 @@
#include "..\script_component.hpp"
params [["_obj", objNull, [objNull]]];
if (isNull _obj) exitWith {};
if !(local _obj) exitWith {};
//handle lights for 'special' objects
{
params ["_lightClassName", "_hitIndexes"];
if ((typeOf _object) isEqualTo _lightClassName) then {
{
_object setHitIndex [_hitIndex, GVAR(lightHitPointDamageToApply)];
} forEach _hitIndexes;
};
} forEach GVAR(specialLightTypes);
//set veh light status
_obj engineOn false;
_obj setCollisionLight false;
_obj setPilotLight false;
//set damage on engines (motor and instruments)
_obj setHitPointDamage ["hitEngine", 0.9];
_obj setHitPointDamage ["HitAvionics", 0.9];
//for player units
if (isPlayer _obj) then {
_obj action ["IRLaserOff", _obj];
_obj action ["nvGogglesOff", _obj];
_nvgs = hmd _obj;
_obj unassignItem _nvgs;
_obj removeItem _nvgs;
_radio = _obj getSlotItemName 611;
_gps = _obj getSlotItemName 612;
_obj unassignItem _radio;
_obj removeItem _radio;
_obj unassignItem _gps;
_obj removeItem _gps;
_obj unassignItem "ACE_microDAGR";
_obj removeItem "ACE_microDAGR";
_obj unassignItem "MineDetector";
_obj removeItem "MineDetector";
};
true;

View File

@@ -0,0 +1,13 @@
#include "..\script_component.hpp"
// Executed on server only, global argument and global effect
// The server makes the change and broadcasts new state to all clients
if (!isServer) exitWith {};
params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {};
_object disableTIEquipment true;
_object disableNVGEquipment true;
_object setVariable ["A3TI_Disable", true, true];

View File

@@ -1,39 +1,35 @@
// this script is used in a trigger and run on all machines.
// it is used to simulate the effects of an EMP bomb on all objects within a certain radius of the trigger
// safeguards have been put in place so that "Local Argument" commands are only processed on the machine that owns the object
// this is important because the results of these commands are not reliable if the object is not local
// the playSound3D command has been modified to only play the sound on this local machine for every non-man object. This way, the many machines running this function are not propagating duplicate sound instances to each other all at once.
#include "..\script_component.hpp"
// This function is used to deploy an EMP device and trigger the EMP effects on all machines
// The EMP effect is triggered by the global event "QGVAR(event_empDeployed)"
// This function should be called on the server
if (!isServer) exitWith {};
//get center and radius
params [["_center",objNull],["_rad",200]];
params [["_origin", objNull, [[], objNull]],["_rad",1500, [300]]];
private _objectsToAffect = [_center, _rad] call FUNC(getAffectedObjects);
if (_origin isEqualType []) then {
if (count _origin != 3) exitWith {
["Invalid origin position provided (%1)", _origin] call BIS_fnc_error;
};
};
{
// sleep to add aesthetic
sleep GVAR(timeBetweenEntities);
if (_origin isEqualType objNull) then {
if (isNull _origin) exitWith {
["No origin object or position provided (%1)", _origin] call BIS_fnc_error;
};
_origin = getPosASL _origin;
};
[{
params ["_obj"];
private _objectsToAffect = [_origin, _rad] call FUNC(getObjectsToAffect);
// local flicker light effect
[_obj] remoteExecCall [QFUNC(flickerLights), 0];
// for groups, deduplicate and get AI groups only
private _groupsToAffect = _objectsToAffect apply {group _x};
_groupsToAffect = _groupsToAffect arrayIntersect _groupsToAffect;
_groupsToAffect = _groupsToAffect select {!isPlayer (leader _x)};
// playSound3D from server (running this code) to all clients
[_obj] call FUNC(playZapServer);
// process these if our machine owns the object, since many of the commands require local arguments
// the results of these commands are not reliable if the object is not local
[_obj] remoteExecCall [QFUNC(applyLocalUnitEffects), _obj];
[QGVAR(event_empDeployed), [_origin, _objectsToAffect, _groupsToAffect]] call CBA_fnc_globalEvent;
// these are group-related commands that should be run where group is local
[group _obj] remoteExecCall [QFUNC(applyLocalGroupEffects), group _obj];
}, [_x]] call CBA_fnc_directCall;
} forEach _objectsToAffect;
true;

View File

@@ -1,40 +0,0 @@
/*
Function: fn_flickerLights
Description:
Handle the flickering of lights on an object.
Author: IndigoFox
*/
#include "..\script_component.hpp"
params ["_object"];
//set light status
[_object] spawn {
params ["_object"];
// if has interface, do fancy flickering
if (hasInterface) then {
// if player is within object view distance of the object, flicker the lights
if (_object distance player < (getObjectViewDistance#0)) then {
for "_i" from 1 to 3 do {
_object switchLight "OFF";
sleep (random 0.5);
_object switchLight "ON";
sleep (random 0.5);
};
};
};
// always finish by shutting off
_object switchLight "OFF";
// always, if object local, damage lights
if (local _object) then {
sleep 0.7;
{
_object setHit [_x, GVAR(lightHitPointDamageToApply), false];
} forEach GVAR(standardLightHitPoints);
};
};

View File

@@ -1,16 +1,61 @@
#include "..\script_component.hpp"
params [["_center",objNull],["_rad",200]];
// This function will gather objects to be affected by the EMP blast
// It will return an array of objects within the radius of the EMP blast
//create array for special objects
private _sA = [];
{
_sA pushBack (_x select 0);
} forEach GVAR(specialLightTypes);
params [["_origin", objNull, [[], objNull]],["_radius",1500]];
if (_origin isEqualType []) then {
if (count _origin != 3) exitWith {
["Invalid origin position provided (%1)", _origin] call BIS_fnc_error;
};
};
if (_origin isEqualType objNull) then {
if (isNull _origin) exitWith {
["No origin object or position provided (%1)", _origin] call BIS_fnc_error;
};
_origin = getPosASL _origin;
};
//search for and return objects
nearestObjects [
_center,
["man","car","tank","air"] + GVAR(streetAndLampClasses) + _sA,
_rad
_origin,
[
"Car",
"Motorcycle",
"UAV",
"Tank",
"Air",
"Ship",
"StreetLamp",
"Lamps_base_F", //These are all the lights' base classes
"PowerLines_base_F",
"PowerLines_Small_base_F",
"Land_TTowerBig_1_F",
"Land_TTowerBig_2_F",
"Land_fs_roof_F",
"Land_NavigLight",
"PowerLines_Wires_base_F",
"Land_PowerPoleWooden_L_F",
"Land_Runway_PAPI",
"Land_fs_sign_F",
"Land_FuelStation_01_roof_malevil_F",
"Land_FuelStation_01_roof_F",
"Lamps",
"Helicopter",
"Plane",
"Autonomous",
"Armored",
"Land_MobileRadar_01_radar_F",
"Land_Camping_Light_F",
"Land_PowLines_WoodL",
"Land_A_GeneralStore_01",
"Land_A_GeneralStore_01a",
"Land_Mil_Guardhouse",
"Land_NAV_Lighthouse",
"Land_Mil_House",
"Land_LightHouse_F"
],
_radius
];

View File

@@ -0,0 +1,68 @@
#include "..\script_component.hpp"
GVAR(maxBrightDelay) = 3.25;
GVAR(zapSounds) = [QGVAR(sound_zap1),QGVAR(sound_zap2),QGVAR(sound_zap3),QGVAR(sound_zap4)];
// call FUNC(addACEActions);
[QGVAR(event_empDeployed), {
params ["_origin", "_affectedObjects", "_affectedGroups"];
if (hasInterface) then {
[_origin] call FUNC(playLocalEffects);
[{
private _countLocalObjectEffectsPlayed = { // play effects on this machine
[_x] call FUNC(playLocalEffectsForObject);
true;
} count _affectedObjects;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"Played EMP effects",
[
["localObjectEffectsPlayed", _countLocalObjectEffectsPlayed]
]
] call EFUNC(common,log);
}, _this, GVAR(maxBrightDelay)] call CBA_fnc_waitAndExecute;
};
// one second after peak brightness
[{
private _countLocalObjectEffectsApplied = { // apply affects to objects owned by this machine, start propagation to other machines
[_x] call FUNC(applyLocalObjectEffects);
true;
} count (_affectedObjects select {local _x});
private _countLocalGroupEffectsApplied = { // apply affects to groups owned by this machine, start propagation to other machines
[_x] call FUNC(applyLocalGroupEffects);
true;
} count (_affectedGroups select {local _x});
if (isServer) then {
private _countServerObjectEffectsApplied = {
[_x] call FUNC(applyServerObjectEffects);
true;
} count _affectedObjects;
};
private _countGlobalObjectEffectsApplied = {
[_x] call FUNC(applyGlobalObjectEffects);
true;
} count _affectedObjects;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"Applied EMP effects",
[
["localObjectEffects", _countLocalObjectEffectsApplied],
["localGroupEffects", _countLocalGroupEffectsApplied],
["serverObjectEffects", _countServerObjectEffectsApplied],
["globalObjectEffects", _countGlobalObjectEffectsApplied]
]
] call EFUNC(common,log);
}, _this, GVAR(maxBrightDelay) + 2] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addEventHandler;

View File

@@ -1,39 +0,0 @@
#include "..\script_component.hpp"
//define vars
GVAR(timeBetweenEntities) = 0.01;
GVAR(chanceToPlayZap) = 5;
GVAR(zapAudibleDistance) = 100;
GVAR(lightHitPointDamageToApply) = 0.97;
GVAR(standardLightHitPoints) = [
"light_1_hitpoint",
"light_2_hitpoint",
"light_3_hitpoint",
"light_4_hitpoint"
];
GVAR(streetAndLampClasses) = [
"Lamps_base_F",
"PowerLines_base_F",
"PowerLines_Small_base_F",
"Land_fs_roof_F",
"Land_NavigLight",
"PowerLines_Wires_base_F",
"Land_PowerPoleWooden_L_F",
"Land_Runway_PAPI",
"Land_fs_sign_F",
"Land_FuelStation_01_roof_malevil_F", "Land_FuelStation_01_roof_F",
"Streetlamp"
];
//light special: ["CLASSNAME",[HITINDEX OF THE LAMPS]]
GVAR(specialLightTypes) = [
["Land_PowLines_WoodL",[0,1]],
["Land_A_GeneralStore_01", [42,43,44,45]],
["Land_A_GeneralStore_01a", [42,43,44,45]],
["Land_Mil_Guardhouse", [8]],
["Land_NAV_Lighthouse", [0]],
["Land_Mil_House", [40,41,42,43,44,45,46,47]],
["Land_LightHouse_F", [0,1,2,3,4]]
];

View File

@@ -0,0 +1,102 @@
#include "..\script_component.hpp"
// Executed on all machines with an interface
// This plays the effects of the EMP itself going off
if (!hasInterface) exitWith {};
params [["_origin", [], [[]]]];
if (count _origin isEqualTo 0) exitWith {};
private _e_static3 = "#particlesource" createVehicleLocal (ASLToAGL _origin);
_e_static3 setParticleCircle [0, [0, 0, 0]];
_e_static3 setParticleRandom [0.2, [0,0,0], [0.175, 0.175, 0.175], 0.25, 0.15, [0, 0, 0, 1], 1, 0];
_e_static3 setParticleParams [["\A3\data_f\blesk1", 1, 0, 1], "", "SpaceObject", 1, 0.75, [0, 0, 1], [0, 0, 0], 0, 10, 7.9,0, [0, 0.2], [[1, 1, 0.1, 1], [1, 1, 1, 1]], [0.01], 1, 0, "", "", objNull,0,false,-1,[[100,100,100,1],[1,1,1,1]]];
_e_static3 setDropInterval 0.15;
private _ripple2 = "#particlesource" createVehicleLocal (ASLToAGL _origin);
_ripple2 setParticleCircle [0,[0,0,0]];
_ripple2 setParticleRandom [0.1,[0,0,0],[0,0,0],25,1,[0,0,0,0.1],0,0];
_ripple2 setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract.p3d",1,0,1], "", "Billboard", 1, 1, [0, 0, 1], [0, 0, 0],0,10,7.9,0, [5,0], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.05], 1, 0, "", "", objNull];
_ripple2 setDropInterval 0.05;
private _light_emp = "#lightpoint" createVehiclelocal (ASLToAGL _origin);
// _light_emp lightAttachObject [objNull, [0,0,0.5]];
_light_emp setLightAmbient [0.1,0.1,1];
_light_emp setLightColor [0.1,0.1,1];
_light_emp setLightBrightness 0;
_light_emp setLightUseFlare true;
_light_emp setLightFlareSize 1;
_light_emp setLightFlareMaxDistance 2500;
_light_emp setLightDayLight true;
_light_emp setLightAttenuation [5,1,1,1,5,1000];
_brit = 0;
// local only, last param
playSound3D [QGVAR(sound_electric_explsion_impact_large), nil, false, _origin, 1, 1, 3500, 0, true];
[_light_emp, _brit, _ripple2] spawn {
params ["_light_emp", "_brit", "_ripple2"];
while {_brit < 6.5} do {
// takes ~1.73 seconds to reach full brightness
_light_emp setLightBrightness _brit;
_brit = _brit+0.02; //timing for next stage
sleep 0.01;
};
deleteVehicle _ripple2;
};
[{
params ["_origin", "_light_emp"];
private _e_static2 = "#particlesource" createVehicleLocal (ASLToAGL _origin);
_e_static2 setParticleCircle [0, [0, 0, 0]];
_e_static2 setParticleRandom [0.2, [0,0,0], [0, 0, 0], 0.25, 1.05, [0, 0, 0, 1], 1, 0];
_e_static2 setParticleParams [["\A3\data_f\blesk1", 1, 0, 1], "", "SpaceObject", 1, 0.75, [0, 0, 0], [0, 0, 1], 0, 10, 7.9,0, [0,0.5], [[1, 1, 0.1, 1], [1, 1, 1, 1]], [0.08], 1, 0, "", "", objNull,0,false,-1,[[100,100,100,1],[0,0,1,0.01]]];
_e_static2 setDropInterval 0.05;
private _wave = "#particlesource" createVehicleLocal (ASLToAGL _origin);
_wave setParticleCircle [0,[0,0,0]];
_wave setParticleRandom [0,[0,0,0],[0,0,0],10,0.25,[0,0,0,0.1],0,0];
_wave setParticleParams [["\A3\data_f\kouleSvetlo",1,0,1], "", "Billboard", 1, 3, [0, 0, 1], [0, 0, 0],0,10,7.9,0, [0,75], [[0,0,1,1],[0,0,0.25,0]], [0.01], 1, 0, "", "", objNull,0,false,-1,[[0,0,3,0.75],[0,0,1,0.01]]];
_wave setDropInterval 30;
private _ripple = "#particlesource" createVehicleLocal (ASLToAGL _origin);
_ripple setParticleCircle [0,[0,0,0]];
_ripple setParticleRandom [0,[0,0,0],[0,0,0],0,0.25,[0,0,0,0.1],0,0];
_ripple setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract.p3d",1,0,1], "", "Billboard", 1, 1.5, [0, 0, 1], [0, 0, 0],0,10,7.9,0, [0,500], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.05], 1, 0, "", "", objNull];
_ripple setDropInterval 10;
[{deleteVehicle _this}, _ripple, GVAR(maxBrightDelay) + 0.65] call CBA_fnc_waitAndExecute;
[{
params [
["_toDelete", [], [[]]],
["_toProcess", [], [[]]]
];
{
deleteVehicle _x;
} forEach _toDelete;
_toProcess spawn {
params ["_brit", "_light_emp", "_wave"];
while {_brit > 0} do {
_light_emp setLightBrightness _brit;
_brit = _brit-2;
sleep 0.01;
};
deleteVehicle _light_emp;
deleteVehicle _wave;
};
}, [[_e_static2, _e_static3], [6.5, _light_emp, _wave]], GVAR(maxBrightDelay) + 0.85] call CBA_fnc_waitAndExecute;
}, [_origin, _light_emp], GVAR(maxBrightDelay)] call CBA_fnc_waitAndExecute;
[{
params ["_origin"];
_echosound = selectRandom [QGVAR(sound_ecou),QGVAR(sound_echo3)];
// local only, last param
playSound3d [_echosound, nil, false, _origin, 1, 1, 4000, 0, true];
}, [_origin], GVAR(maxBrightDelay) + 0.65 + 2] call CBA_fnc_waitAndExecute;

View File

@@ -0,0 +1,71 @@
#include "..\script_component.hpp"
// executed on all clients with an interface
// flickers lights for light props/streetlamps and plays a spark sound
if (!hasInterface) exitWith {};
params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {};
// if player is within object view distance of the object, flicker the lights
private _flickerHandle = [_object] spawn {
params ["_object"];
for "_i" from 1 to 3 do {
_object switchLight "OFF";
sleep (random 0.3);
_object switchLight "ON";
sleep (random 0.3);
};
// always finish by shutting off
_object switchLight "OFF";
};
_object setVariable [QGVAR(flickerHandle), _flickerHandle];
// sound
private _spark_sound = GVAR(zapSounds) call BIS_fnc_selectRandom;
playSound3D [_spark_sound, _object, false, getPosASL _object, 1, 1, 20, 0, true];
// particle effect
private _e_static = "#particlesource" createVehicleLocal (getPosATL _object);
_e_static setParticleCircle [1, [0, 0, 0]];
_e_static setParticleRandom [0.2, [1.5,1.5,0], [0.175, 0.175, 0], 0.15, 0.2, [0, 0, 0, 1], 1, 0];
_e_static setParticleParams [["\A3\data_f\blesk1", 1, 0, 1], "", "SpaceObject", 1, 0.05, [0, 0, 0], [0, 0, 0], 0, 10, 7.9,0, [0.01, 0.02, 0.01], [[1, 1, 0.1, 1], [1, 1, 1, 1]], [0.025], 1, 0, "", "", _object,0,false,-1,[[100,100,100,1],[0,0,1,0.01]]];
_e_static setDropInterval 0.025;
[{deleteVehicle _this;}, _e_static, 1] call CBA_fnc_waitAndExecute;
// play additional spark
_bbr = boundingBoxReal vehicle _object;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_maxHeight = abs ((_p2 select 2) - (_p1 select 2));
//_spark_poz_rel = [getPos _lamp select 0,getPos _lamp select 1,_maxHeight-0.5];
private _spark_poz_rel = (_maxHeight/2)-0.45;
private _spark_type = ["white","orange"] call BIS_fnc_selectRandom;
private _drop = 0.001+(random 0.05);
private _scantei_spark = "#particlesource" createVehicleLocal (getPosATL _object);
if (_spark_type=="orange") then
{
_scantei_spark setParticleCircle [0, [0, 0, 0]];
_scantei_spark setParticleRandom [1, [0.1, 0.1, 0.1], [0, 0, 0], 0, 0.25, [0, 0, 0, 0], 0, 0];
_scantei_spark setParticleParams [["\A3\data_f\proxies\muzzle_flash\muzzle_flash_silencer.p3d", 1, 0, 1], "", "SpaceObject", 1, 1, [0, 0,_spark_poz_rel], [0, 0, 0], 0, 15, 7.9, 0, [0.5,0.5,0.05], [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 0]], [0.08], 1, 0, "", "", _object,0,true,0.3,[[1,1,1,1]]];
_scantei_spark setDropInterval _drop;
} else
{
//hint "alb";
_scantei_spark setParticleCircle [0, [0, 0, 0]];
_scantei_spark setParticleRandom [1, [0.05, 0.05, 0.1], [5, 5, 3], 0, 0.0025, [0, 0, 0, 0], 0, 0];
_scantei_spark setParticleParams [["\A3\data_f\proxies\muzzle_flash\muzzle_flash_silencer.p3d", 1, 0, 1], "", "SpaceObject", 1, 1, [0, 0,_spark_poz_rel], [0, 0, 0], 0, 20, 7.9, 0, [0.5,0.5,0.05], [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 0]], [0.08], 1, 0, "", "", _object,0,true,0.3,[[5,5,3,1]]];
_scantei_spark setDropInterval 0.001;
};
private _spark_sound = GVAR(zapSounds) call BIS_fnc_selectRandom;
playSound3D [_spark_sound, _scantei_spark, false, getPosASL _object, 1, 1, 20, 0, true];
[{deleteVehicle _this;}, _scantei_spark, 0.4 + (random 0.7)] call CBA_fnc_waitAndExecute;

View File

@@ -1,28 +0,0 @@
#include "..\script_component.hpp"
params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {};
if (_object isKindOf "CAManBase") exitWith {};
// we're broadcasting a playSound3D command to all clients,
// so this only be run on the server
if (!isServer) exitWith {};
private _playSound = selectRandomWeighted [true,GVAR(chanceToPlayZap),false,(100-GVAR(chanceToPlayZap))];
if (_playSound) then {
private _sound = selectRandom ["zap1","zap2","zap3","zap4"];
playSound3D [
format [
"%1.wss",
getMissionPath ("framework\emp\sounds\" + _sound)
],
_object,
false,
getPosASL _object,
1, // volume
1, // pitch
GVAR(zapAudibleDistance), // max distance heard
0, // time offset sec
false // NOT local, send to all clients
];
};

6
framework/emp/readme.md Normal file
View File

@@ -0,0 +1,6 @@
# EMP Module
Adapted from:
- KE_EB EMP Mission Script (unknown author, found by Sherman)
- EMP Systems (Murphy, Wenza) on [Steam Workshop](https://steamcommunity.com/sharedfiles/filedetails/?id=2225040619)

Binary file not shown.

Binary file not shown.

View File

@@ -2,13 +2,6 @@
if ( !hasInterface ) exitWith {};
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
// make sure the server has finished init
waitUntil {!isNil QGVARMAIN(complete)};
@@ -23,7 +16,7 @@ EGVAR(common,diaryRecords) = createHashMap;
// initialize other modules
call EFUNC(emp,initClient);
call EFUNC(emp,init);
call EFUNC(mapcopy,initClient);
call EFUNC(reinsert,initClient);
call EFUNC(resupply,initClient);

View File

@@ -9,20 +9,11 @@ publicVariable QGVARMAIN(baseObjects);
// Initializes the Dynamic Groups framework and groups
["Initialize", [true]] call BIS_fnc_dynamicGroups;
if (isDedicated) then {
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
};
// initialize other modules
call EFUNC(common,logMissionInfo);
call EFUNC(fbcb2_assets,initServer);
call EFUNC(reinsert,initServer);
call EFUNC(emp,init);
// declare init complete to other modules
missionNamespace setVariable [QGVARMAIN(complete), true, true];

View File

@@ -6,9 +6,9 @@
#define VERSION_STR MAJOR.MINOR.PATCHLVL
#define VERSION_AR MAJOR,MINOR,PATCHLVL
// #define DEBUG_MODE -1 // TRACE
#define DEBUG_MODE -1 // TRACE
// #define DEBUG_MODE 0 // DEBUG
#define DEBUG_MODE 1 // INFO
// #define DEBUG_MODE 1 // INFO
// #define DEBUG_MODE 2 // WARNING
// #define DEBUG_MODE 3 // ERROR