1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
--[[
<?xml version='1.0' encoding='utf8'?>
<event name="FLF/DV Derelicts">
<trigger>enter</trigger>
<chance>40</chance>
<cond>faction.get("Dvaered"):playerStanding() >= 0 and faction.get("Pirate"):playerStanding() < 0 and system.cur() == system.get("Surano") and not (player.misnDone("Take the Dvaered crew home") or player.misnDone("Deal with the FLF agent")) and not (player.misnActive("Deal with the FLF agent") or player.misnActive("Take the Dvaered crew home")) </cond>
</event>
--]]
--[[
-- Derelict Event, spawning either the FLF prelude mission string or the Dvaered anti-FLF string.
--]]
-- Text
text = {}
title = {}
broadcastmsgDV = _("SOS. This is %s. Primary systems down. Requesting assistance.")
broadcastmsgFLF = _("Calling all ships. This is %s. Engines down, ship damaged. Please help.")
shipnameDV = _("Dvaered Patrol")
shipnameFLF = _("Frontier Patrol")
function create()
if not evt.claim(system.cur()) then
evt.finish(false)
end
-- Create the derelicts One Dvaered, one FLF.
pilot.toggleSpawn(false)
pilot.clear()
posDV = vec2.new(7400, 3000)
posFLF = vec2.new(-10500, -8500)
fleetDV = pilot.add("Dvaered Vendetta", "dummy", posDV)
shipDV = fleetDV[1]
fleetFLF = pilot.add("FLF Vendetta", "dummy", posFLF)
shipFLF = fleetFLF[1]
shipDV:disable()
shipFLF:disable()
shipDV:setHilight(true)
shipFLF:setHilight(true)
shipDV:setVisplayer()
shipFLF:setVisplayer()
shipDV:rename(shipnameDV)
shipFLF:rename(shipnameFLF)
timerDV = hook.timer(3000, "broadcastDV")
timerFLF = hook.timer(12000, "broadcastFLF")
boarded = false
destroyed = false
-- Set a bunch of vars, for no real reason
var.push("flfbase_sysname", "Sigur") -- Caution: if you change this, change the location for base Sindbad in unidiff.xml as well!
hook.pilot(shipDV, "board", "boardDV")
hook.pilot(shipDV, "death", "deathDV")
hook.pilot(shipFLF, "board", "boardFLF")
hook.pilot(shipFLF, "death", "deathFLF")
hook.enter("enter")
end
function broadcastDV()
-- Ship broadcasts an SOS every 10 seconds, until boarded or destroyed.
shipDV:broadcast(string.format(broadcastmsgDV, shipnameDV), true)
timerDV = hook.timer(20000, "broadcastDV")
end
function broadcastFLF()
-- Ship broadcasts an SOS every 10 seconds, until boarded or destroyed.
shipFLF:broadcast(string.format(broadcastmsgFLF, shipnameFLF), true)
timerFLF = hook.timer(20000, "broadcastFLF")
end
function boardFLF()
if shipDV:exists() then
shipDV:setHilight(false)
shipDV:setNoboard(true)
end
shipFLF:setHilight(false)
hook.rm(timerFLF)
hook.rm(timerDV)
player.unboard()
naev.missionStart("Deal with the FLF agent")
boarded = true
end
function deathDV()
hook.rm(timerDV)
destroyed = true
if not shipFLF:exists() then
evt.finish(true)
end
end
function boardDV()
if shipFLF:exists() then
shipFLF:setHilight(false)
shipFLF:setNoboard(true)
end
shipDV:setHilight(false)
hook.rm(timerDV)
hook.rm(timerFLF)
player.unboard()
naev.missionStart("Take the Dvaered crew home")
boarded = true
end
function deathFLF()
hook.rm(timerFLF)
destroyed = true
var.push("flfbase_flfshipkilled", true)
if not shipDV:exists() then
evt.finish(true)
end
end
function enter()
if boarded == true then
evt.finish(true)
else
evt.finish(false)
end
end
|