Skip to content

Commit

Permalink
Add Gremlin Waves!
Browse files Browse the repository at this point in the history
  • Loading branch information
danhunsaker committed Apr 2, 2024
1 parent a34d1e9 commit d434e54
Show file tree
Hide file tree
Showing 12 changed files with 917 additions and 72 deletions.
6 changes: 6 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
- [Setup](./urgency/setup.md)
- [Usage](./urgency/usage.md)

# Gremlin Waves

- [About](./waves.md)
- [Setup](./waves/setup.md)
- [Usage](./waves/usage.md)

# Book-Keeping

- [Contributors](./contributors.md)
18 changes: 11 additions & 7 deletions docs/evac/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Evac:setup({
},
idStart = 5,
loadUnloadPerIndividual = 2,
lossFlags = { 'GremlinEvacRedLoss', 'GremlinEvacBlueLoss' }
lossThresholds = { 25, 25 },
lossFlags = { 1, 2 }
lossThresholds = { 0, 25 },
maxExtractable = {
{
Generic = 12,
['Downed Pilot'] = 12,
Infantry = 12,
M249 = 12,
RPG = 12,
Expand All @@ -25,7 +25,7 @@ Evac:setup({
JTAC = 3,
},
{
Generic = 12,
['Downed Pilot'] = 12,
Infantry = 12,
M249 = 12,
RPG = 12,
Expand All @@ -45,13 +45,14 @@ Evac:setup({
},
},
},
startingUnits = { 'helicargo1', 'helicargo2', 'MedEvac1', 'MedEvac2', 'MedEvac3' },
startingZones = {
{ mode = Evac.modes.EVAC, name = "Test 1", smoke = trigger.smokeColor.Green, side = coalition.side.BLUE, active = true },
{ mode = Evac.modes.RELAY, name = "Test 2", smoke = trigger.smokeColor.Orange, side = coalition.side.BLUE, active = true },
{ mode = Evac.modes.SAFE, name = "Test 3", smoke = trigger.smokeColor.White, side = coalition.side.BLUE },
},
winFlags = { 'GremlinEvacRedWin', 'GremlinEvacBlueWin' }
winThresholds = { 75, 75 },
winFlags = { 3, 4 }
winThresholds = { 0, 75 },
})
```

Expand All @@ -65,7 +66,7 @@ Evac:setup({
- Default: `{ ["C-130"] = 90, ["CH-47D"] = 44, ["CH-43E"] = 55, ["Mi-8MT"] = 24, ["Mi-24P"] = 5, ["Mi-24V"] = 5, ["Mi-26"] = 70, ["SH60B"] = 5, ["UH-1H"] = 8, ["UH-60L"] = 11 }`

- `idStart`: The lowest ID number that Gremlin Evac will use to create units and groups
- Default: `500`
- Default: `50000`

- `loadUnloadPerIndividual`: The amount of time it takes to load/unload a single evacuee onto/from an aircraft, in seconds
- Default: `30`
Expand Down Expand Up @@ -96,6 +97,9 @@ Evac:setup({
- `> 0`: Every `per` periods, until `maxExtractable` is reached
- `period`: One of the `Gremlin.Periods` constants indicating how long a single period lasts

- `startingUnits`: Registers units for evacuation purposes during setup
- Default: `{}`

- `startingZones`: Registers zones for evacuation purposes during setup
- Default: `{}`
- Spec
Expand Down
5 changes: 3 additions & 2 deletions docs/evac/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Evac:setup({
lossThresholds = { 0, 25 },
maxExtractable = {
{
Generic = 12,
['Downed Pilot'] = 12,
Infantry = 12,
M249 = 12,
RPG = 12,
Expand All @@ -46,7 +46,7 @@ Evac:setup({
JTAC = 3,
},
{
Generic = 12,
['Downed Pilot'] = 12,
Infantry = 12,
M249 = 12,
RPG = 12,
Expand All @@ -66,6 +66,7 @@ Evac:setup({
},
},
},
startingUnits = { 'helicargo1', 'helicargo2', 'MedEvac1', 'MedEvac2', 'MedEvac3' },
startingZones = {
{ mode = Evac.modes.EVAC, name = "Test 1", smoke = trigger.smokeColor.Green, side = coalition.side.BLUE, active = true },
{ mode = Evac.modes.RELAY, name = "Test 2", smoke = trigger.smokeColor.Orange, side = coalition.side.BLUE, active = true },
Expand Down
4 changes: 2 additions & 2 deletions docs/urgency/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ Urgency:setup({
- countdown
- `reuse` whether to put this countdown back in the queue to be triggered again
- `startTrigger` table
- `type` one of `time`, `event`, or `menu`
- `type` one of `time`, `flag`, `event`, or `menu`
- `value` the time, event id and handler, or menu text to trigger on
- `startFlag` the flag to set true when the countdown starts
- `endTrigger` table
- `type` one of `time`, `event`, or `menu`
- `type` one of `time`, `flag`, `event`, or `menu`
- `value` the time, event id and handler, or menu text to trigger on
- `endFlag` the flag to set true when the countdown ends
- `messages` a list of messages to display, keyed by the countdown's seconds since start (or seconds until end, if negative)
Expand Down
4 changes: 4 additions & 0 deletions docs/waves.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable MD041 -->
## About

Gremlin Waves is a reinforcements script for your missions. Running low on RedFor, but not ready for the fun to end? Call in reinforcements with Gremlin Waves!
77 changes: 77 additions & 0 deletions docs/waves/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!-- markdownlint-disable MD041 -->
### Setup

#### Configuration

```lua,editable
Waves:setup({
adminPilotNames = {
'Steve Jobs',
'Linus Torvalds',
'Bill Gates',
},
waves = {
['Wave 2'] = {
trigger = {
type = 'time',
value = 12600, -- 3.5 hours
},
groups = {
['F-14B'] = {
category = Group.Category.AIRPLANE,
country = country.USA,
zone = 'Reinforcement Staging',
scatter = 15,
orders = {},
units = {
['F-14B'] = 3,
},
},
['Ground A'] = {
category = Group.Category.GROUND,
country = country.USA,
zone = 'Reinforcement Staging',
scatter = 5,
orders = {},
units = {
['Infantry'] = 4,
}
},
['Ground B'] = {
category = Group.Category.GROUND,
country = country.USA,
zone = 'Reinforcement Staging',
scatter = 5,
orders = {},
units = {
['RPG'] = 1,
['Infantry'] = 3,
['JTAC'] = 1,
}
},
},
},
},
})
```

- `adminPilotNames` table
- list of pilots who should see the menu
- `waves` table
- collection of reinforcement waves for this mission
- wave
- `trigger` table
- `type` one of `time`, `flag`, `event`, or `menu`
- `value` a time, flag name / number, event id / filter, or menu item text
- `groups` table
- list of groups to spawn
- group
- `category` a member of `Groups.Category` indicating the group's category
- `country` a `country` id
- `zone` where to spawn the group
- `scatter` how far apart, in meters, to scatter units at spawn
- `orders` table
- a list of [DCS AI tasks](https://www.digitalcombatsimulator.com/en/support/faq/1267/#3307680) for the group to perform
- `units` table
- key: the unit type to spawn
- value: how many to spawn in the group
4 changes: 4 additions & 0 deletions docs/waves/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable MD041 -->
### Usage

Gremlin Waves is really simple to use. Configure it once (see [the Setup page](./setup.md)), and it handles the rest!
21 changes: 15 additions & 6 deletions src/evac.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ Evac:setup({
},
idStart = 500,
loadUnloadPerIndividual = 30,
lossFlags = { 'GremlinEvacRedLoss', 'GremlinEvacBlueLoss' }
lossFlags = { 'GremlinEvacRedLoss', 'GremlinEvacBlueLoss' },
lossThresholds = { 25, 25 },
maxExtractable = {
{
Expand Down Expand Up @@ -1742,7 +1742,10 @@ Evac:setup({
},
},
spawnWeight = 100,
startingUnits = {},
startingZones = {},
winFlags = { 'GremlinEvacRedWin', 'GremlinEvacBlueWin' },
winThresholds = { 75, 75 },
})
```
Expand All @@ -1765,6 +1768,10 @@ zone(s) themselves. Four keys are required: `mode` (one of the constants in
attached to).
]]
function Evac:setup(config)
if config == nil then
config = {}
end

assert(Gremlin ~= nil,
'\n\n** HEY MISSION-DESIGNER! **\n\nGremlin Script Tools has not been loaded!\n\nMake sure Gremlin Script Tools is loaded *before* running this script!\n')

Expand All @@ -1781,11 +1788,7 @@ function Evac:setup(config)
Gremlin.log.info(Evac.Id, string.format('Starting setup of %s version %s!', Evac.Id, Evac.Version))

-- start configuration
if not Evac._state.alreadyInitialized or (config ~= nil and config.forceReload) then
if config == nil then
config = {}
end

if not Evac._state.alreadyInitialized or config.forceReload then
Evac.beaconBatteryLife = config.beaconBatteryLife or 30
Evac.beaconSound = config.beaconSound or 'beacon.ogg'
Evac.carryLimits = config.carryLimits or {
Expand Down Expand Up @@ -1833,6 +1836,12 @@ function Evac:setup(config)
}}
}

if config.startingUnits ~= nil then
for _, _unit in pairs(config.startingUnits) do
Evac.units.register(_unit)
end
end

if config.startingZones ~= nil then
for _, _zone in pairs(config.startingZones) do
local _mode = _zone.mode or Evac.modes.EVAC
Expand Down
Loading

0 comments on commit d434e54

Please sign in to comment.