landing.lua 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. -- First combat slice. Wave composition and in-game sequencing still require a live playtest.
  2. local Encounter = require("mission_ember.encounter")
  3. local NAMES = {
  4. "LANDING_MERCURY_ANCHOR_SQUAD",
  5. "LANDING_MERCURY_SUPPORT_A_SQUAD",
  6. "LANDING_MERCURY_SUPPORT_B_SQUAD",
  7. "LANDING_MERCURY_SUPPORT_C_SQUAD",
  8. "LANDING_MERCURY_RANGED_A_SQUAD",
  9. "LANDING_MERCURY_RANGED_B_SQUAD",
  10. "LANDING_MERCURY_BONUS_SUPPORT_A_SQUAD",
  11. "LANDING_MERCURY_BONUS_SUPPORT_B_SQUAD",
  12. "LANDING_MERCURY_BONUS_SUPPORT_C_SQUAD",
  13. "LANDING_MERCURY_BONUS_SUPPORT_D_SQUAD",
  14. }
  15. local BRIDGE_DEVICES = {
  16. "POWERHOUSE_BRIDGE_ARM_MERCURY_DEVICE",
  17. "POWERHOUSE_BRIDGE_GEAR_MERCURY_BOTTOM_DEVICE",
  18. "POWERHOUSE_BRIDGE_GEAR_MERCURY_TOP_DEVICE",
  19. "POWERHOUSE_BRIDGE_ARM_SUN_DEVICE",
  20. "POWERHOUSE_BRIDGE_GEAR_SUN_BOTTOM_DEVICE",
  21. "POWERHOUSE_BRIDGE_GEAR_SUN_TOP_DEVICE",
  22. }
  23. local function required(value, name)
  24. assert(value ~= nil, "mission_ember: missing SDK binding " .. name
  25. .. "; regenerate the SDK with the scenario-scoped squad linker")
  26. return value
  27. end
  28. return function(mission)
  29. local squads = {}
  30. for index, name in ipairs(NAMES) do
  31. squads[index] = {
  32. name = name,
  33. id = required(mission.Squad[name], "Squad." .. name),
  34. sensor = required(mission.Slot[name], "Slot." .. name),
  35. }
  36. end
  37. local entry = required(mission.states.STATE_80B3C09E_0008_0000_80B3C09C, "powerhouse state")
  38. local bridge = {}
  39. for index, name in ipairs(BRIDGE_DEVICES) do
  40. bridge[index] = required(mission.Slot[name], "Slot." .. name)
  41. end
  42. local bridge_objective = required(mission.Slot.EMBER_POWERHOUSE_BRIDGE_OBJECTIVE,
  43. "bridge objective")
  44. local directive = required(mission.Slot.M_DIRECTIVE_SENSOR_80B3C90A, "directive sensor")
  45. local clear = required(mission.Directive.FIND_AND_DISABLE_THE_ALMIGHTY_S_WEAPONS_A70DA4A6,
  46. "landing clear directive")
  47. local controls = required(mission.Directive.FIND_AND_DISABLE_THE_ALMIGHTY_S_WEAPONS_2700C0C5,
  48. "bridge controls directive")
  49. local encounter = Encounter.new("ember.landing", squads, function(context)
  50. context:slot(directive):set_directive{directive = controls}
  51. -- The bridge must wait for its authored interaction. Combat clear does not open it.
  52. end)
  53. return {
  54. initial_state = entry,
  55. region = entry.region_index,
  56. initialize = function(context)
  57. -- on_start runs after the initial-state roster has reached the transport.
  58. -- Do not repeat this on region transit or on_load: those are not mission resets.
  59. for _, device in ipairs(bridge) do
  60. context:slot(device):transition{
  61. transition = context.sdk.device_transitions.close, snap = true,
  62. }
  63. end
  64. context:slot(bridge_objective):reset_objectives{}
  65. end,
  66. enter = function(context, state)
  67. if encounter:phase(state) ~= 0 then
  68. return
  69. end
  70. encounter:enter(context, state)
  71. context:slot(directive):set_directive{directive = clear}
  72. end,
  73. on_squad_state = function(context, state, event)
  74. encounter:on_squad_state(context, state, event)
  75. end,
  76. }
  77. end