This repository has been archived by the owner on May 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
WIP: Add initial port of the cse ied modules #3
Open
thojkooi
wants to merge
2
commits into
master
Choose a base branch
from
cse-ied-port
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z\acex\addons\ieds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class ACE_Settings { | ||
class GVAR(Enabled) { | ||
value = 1; | ||
typeName = "BOOL"; | ||
displayName = ECSTRING(common,Enabled); | ||
description = CSTRING(EnabledDesc); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_preInit)); | ||
}; | ||
}; | ||
|
||
class Extended_PostInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_postInit)); | ||
}; | ||
}; | ||
|
||
class Extended_InitPost_EventHandlers { | ||
class AllVehicles { | ||
class ADDON { | ||
serverInit = QUOTE(_this call FUNC(handleInitPost)); | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
class CfgVehicles { | ||
class ACE_Module; | ||
class GVAR(createIed): ACE_Module { | ||
author = ACECSTRING(common,ACETeam); | ||
category = "ACE_missionModules"; | ||
displayName = CSTRING(Module); | ||
function = QFUNC(moduleInit); | ||
scope = 2; | ||
isGlobal = 1; // Global | ||
isTriggerActivated = 0; | ||
isDisposable = 0; | ||
// icon = ""; // TODO add module icon | ||
class Arguments { | ||
class typeOfIED { | ||
displayName = CSTRING(Type); | ||
description = CSTRING(Type_Description); | ||
typeName = "NUMBER"; | ||
class values { | ||
class land { | ||
name = CSTRING(Type_Normal); | ||
value = 0; default = 1; | ||
}; | ||
class urban { | ||
name = CSTRING(Type_Urban); | ||
value = 1; | ||
}; | ||
}; | ||
}; | ||
class sizeOfIED { | ||
displayName = CSTRING(Size); | ||
description = CSTRING(Size_Description); | ||
typeName = "NUMBER"; | ||
class values { | ||
class small { | ||
name = CSTRING(Size_Normal); | ||
value = 0; default = 1; | ||
}; | ||
class large { | ||
name = CSTRING(Size_Urban); | ||
value = 1; | ||
}; | ||
}; | ||
}; | ||
|
||
class heightOfIED { | ||
displayName = CSTRING(Height); | ||
description = CSTRING(Height_Description); | ||
typeName = "NUMBER"; | ||
class values { | ||
class Above { | ||
name = CSTRING(Height_AboveGround); | ||
value = 0; | ||
default = 1; | ||
}; | ||
class slightly { | ||
name = CSTRING(Height_SlightlyBurried); | ||
value = 1; | ||
}; | ||
class medium { | ||
name = CSTRING(Height_MediumBurried); | ||
value = 2; | ||
}; | ||
class almost { | ||
name = CSTRING(Height_AlmostBurried); | ||
value = 3; | ||
}; | ||
class fully { | ||
name = CSTRING(Height_FullyBurried); | ||
value = 4; | ||
}; | ||
}; | ||
}; | ||
|
||
class iedActivationType { | ||
displayName = "Activation Type"; | ||
description = "How is the IED activated"; | ||
typeName = "NUMBER"; | ||
class values { | ||
class None {name="None"; value=-1; }; | ||
class PressurePlate {name="Pressure Plate"; value=0; default=1;}; | ||
class Radio {name="Radio"; value=1; }; | ||
}; | ||
}; | ||
|
||
class activatedForTargets { | ||
displayName = "Activated for"; | ||
description = "What types is the IED activated for"; | ||
typeName = "NUMBER"; | ||
class values { | ||
class None {name="None"; value=-1; }; | ||
class All {name="Any type"; value=0; default=1;}; | ||
class Vehicles {name="Any Vehicle"; value=1; }; | ||
class Land {name="Ground Vehicles"; value=2; }; | ||
class Air {name="Airial Vehicles"; value=3; }; | ||
class Man {name="Man"; value=4; }; | ||
}; | ||
}; | ||
|
||
class activatedForSides { | ||
displayName = "What sides activate this IED"; | ||
description = "What types is the IED activated for"; | ||
typeName = "NUMBER"; | ||
class values { | ||
class None {name="None"; value=-1; }; | ||
class All {name="Any side"; value=0; default=1; }; | ||
class West {name="BLUFOR"; value=1; }; | ||
class East {name="OpFOR"; value=2; }; | ||
class Ind {name="Independant"; value=3; }; | ||
class Civ {name="Civilian"; value=4; }; | ||
}; | ||
}; | ||
}; | ||
|
||
class ModuleDescription { | ||
description = CSTRING(ModuleDesc); | ||
}; | ||
}; | ||
|
||
class ace_zeus_moduleBase; | ||
class GVAR(moduleCreateIedZeus): ace_zeus_moduleBase { | ||
curatorCanAttach = 1; | ||
displayName = CSTRING(Module); | ||
function = QFUNC(moduleZeus); | ||
// icon = ""; // TODO icon | ||
class ModuleDescription { | ||
description = "Creates an IED on position"; | ||
sync[] = {}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PREP(createIEDObject); | ||
PREP(moduleInit); | ||
PREP(onIEDActivated); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
acex_ieds | ||
============ | ||
|
||
Adds IED mission module framework | ||
|
||
|
||
## Maintainers | ||
|
||
The people responsible for merging changes to this component or answering potential questions. | ||
|
||
- [Glowbal](http://github.com/glowbal) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "script_component.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "script_component.hpp" | ||
|
||
ADDON = false; | ||
|
||
#include "PREP.hpp" | ||
|
||
GVAR(IED_COLLECTION) = []; | ||
|
||
ADDON = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
name = COMPONENT_NAME; | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"acex_main", "ace_explosives"}; | ||
author = ACECSTRING(common,ACETeam); | ||
authors[]= {"Glowbal"}; | ||
authorUrl = "https://github.com/glowbal"; | ||
VERSION_CONFIG; | ||
}; | ||
}; | ||
|
||
#include "ACE_Settings.hpp" | ||
#include "CfgEventHandlers.hpp" | ||
#include "CfgVehicles.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
#include "script_component.hpp" | ||
|
||
#define LAND_IEDS ["ACE_IEDLandBig_Range", "ACE_IEDLandSmall_Range"] | ||
#define URBAN_IEDS ["ACE_IEDUrbanBig_Range", "ACE_IEDUrbanSmall_Range"] | ||
|
||
params ["_logic"]; | ||
|
||
if (isNull _logic) exitwith {}; | ||
|
||
private _typeOfIED = _logic getvariable ["typeOfIED", 0]; | ||
private _sizeOfIED = _logic getvariable ["sizeOfIED", 0]; | ||
private _heightOfIED = _logic getvariable ["heightOfIED", 0]; | ||
|
||
_heightOfIED = switch (_heightOfIED) do { | ||
case 1: {-0.01}; | ||
case 2: {-0.05}; | ||
case 3: {-0.075}; | ||
case 4: {-0.25}; | ||
default {_heightOfIED}; | ||
}; | ||
|
||
private _iedClass = switch (_typeOfIED) do { | ||
case 0: { LAND_IEDS select _sizeOfIED }; | ||
case 1: { URBAN_IEDS select _sizeOfIED }; | ||
}; | ||
|
||
private _iedCreated = _iedClass createVehicle [0,0,0]; | ||
_iedCreated setPos [getPos _Logic select 0, getPos _Logic select 1, (getPos _Logic select 2) + _heightOfIED]; | ||
|
||
if (_logic getvariable ["iedActivationType", 0] == 0) then { | ||
private _mine = createMine [_iedClass, getPos _iedCreated, [], 0]; | ||
_mine setDir ((getDir _iedCreated) + 90); | ||
_mine setPos _iedCreated; | ||
_iedCreated setvariable [QGVAR(pressurePlate), _mine]; | ||
hideObjectGlobal _mine; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only works on the server |
||
}; | ||
|
||
_logic setvariable [QGVAR(linkedIED), _iedCreated, true]; // TODO do we need a global flag here? | ||
_iedCreated setvariable [QGVAR(linkedIED), _logic, true]; // TODO do we need a global flag here? | ||
|
||
_iedCreated addEventHandler ["Killed", { | ||
params ["_ied", "_killer"]; | ||
|
||
private _logic = _ied getvariable [QGVAR(linkedIED), objNull]; | ||
private _activationType = _logic getvariable ["iedActivationType", 0]; | ||
[_logic] call FUNC(onIEDActivated); | ||
|
||
private _pressurePlate = _ied getvariable [QGVAR(pressurePlate), objNull]; | ||
if (!isNull _pressurePlate) then { | ||
deleteVehicle _pressurePlate; | ||
}; | ||
|
||
if (_activationType == -1) then { | ||
private _iedClass = typeOf _ied; | ||
private _iedPos = getPos _ied; | ||
private _ammoClass = getText(configFile >> "CfgVehicles" >> _iedClass >> "ammo"); | ||
private _dummyIed = _ammoClass createVehicle _iedPos; | ||
_dummyIed setPos _iedPos; | ||
|
||
if (!isNil "ace_frag_fnc_addPfhRound") then { | ||
[objNull, _ammoClass, _dummyIed, true] call ace_frag_fnc_addPfhRound; | ||
}; | ||
_dummyIed setDamage 1; | ||
}; | ||
deleteVehicle _ied; | ||
}]; | ||
|
||
["acex_iedCreated", [_iedCreated, _typeOfIED, _sizeOfIED, _heightOfIED]] call CBA_fnc_localEvent; | ||
|
||
_iedCreated; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Author: Glowbal | ||
* | ||
* Arguments: | ||
* 0: <BOOL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Public: No | ||
*/ | ||
#include "script_component.hpp" | ||
|
||
params ["_logic", "_units", "_activated"]; | ||
|
||
if (!local _logic) exitwith {}; | ||
|
||
private _collectObjects = { | ||
params ["_logic"]; | ||
|
||
private _collection = synchronizedObjects _logic; | ||
{ | ||
if !(_x in _totalCollection) then { | ||
if (typeOf _x == QGVAR(createIed)) then { | ||
if !(_x getvariable [QGVAR(masterIED), false]) then { | ||
_x setvariable [QGVAR(subIED), true]; | ||
_x setvariable [QGVAR(controlledByIED), _logic]; | ||
_totalCollection pushback _x; | ||
[_x] call _collectObjects; | ||
}; | ||
} else { | ||
if (typeOf _x == "cseModule_triggerManLinkIEDS") then { | ||
_list = _x getvariable ["EnableList",""]; | ||
_list = "[" + _list + "]"; | ||
_parsedList = [] call compile _list; | ||
_triggerManList = (_logic getvariable [QGVAR(triggerManUnits), []]) + _parsedList; | ||
_logic setvariable [QGVAR(triggerManUnits), _triggerManList]; | ||
}; | ||
}; | ||
}; | ||
}foreach _collection; | ||
}; | ||
|
||
if !(_logic getvariable [QGVAR(subIED),false]) then { | ||
_logic setvariable [QGVAR(masterIED), true]; | ||
private _totalCollection = [_logic]; | ||
[_logic] call _collectObjects; | ||
_logic setvariable [QGVAR(collection), _totalCollection]; | ||
}; | ||
|
||
[_logic] call FUNC(createIEDObject); | ||
|
||
private _activatedTargets = switch (_logic getvariable ["activatedForTargets", -1]) do { | ||
case 0: {["CaManBase", "Air", "Car", "Motorcycle", "Tank"]}; | ||
case 1: {["Air", "Car", "Motorcycle", "Tank"]}; | ||
case 2: {["Car", "Motorcycle", "Tank"]}; | ||
case 3: {["Air"]}; | ||
case 4: {["CaManBase"]}; | ||
default {[]}; | ||
}; | ||
_logic setvariable ["activatedForTargets", _activatedTargets]; | ||
|
||
private _activatedSides = switch (_logic getvariable ["activatedForSides", -1]) do { | ||
case 0: {[west, east, independent, civilian, sideEnemy, sideFriendly]}; | ||
case 1: {[west, sideEnemy]}; | ||
case 2: {[east, sideEnemy]}; | ||
case 3: {[independent, sideEnemy]}; | ||
case 4: {[civilian, sideEnemy]}; | ||
default {[]}; | ||
}; | ||
|
||
_logic setvariable ["activatedForSides", _activatedSides, true]; | ||
_logic setvariable ["iedActivationType", _logic getvariable ["iedActivationType", 0], true]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Author: Glowbal | ||
* | ||
* Arguments: | ||
* 0: <BOOL> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Public: No | ||
*/ | ||
#include "script_component.hpp" | ||
|
||
params ["_logic", "_units", "_activated"]; | ||
|
||
if (!local _logic) exitwith {}; | ||
|
||
[_logic] call FUNC(createIEDObject); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ See above. I don't know on what machine this will be executed. Every machine? The Server? The Zeus-Client?