Add prize for defeating the entire Haber force at Rondel
parent
b221315d47
commit
c4238e5d5f
|
@ -26,5 +26,41 @@
|
||||||
"HABER_DEFENSE_CRAFT": {
|
"HABER_DEFENSE_CRAFT": {
|
||||||
"description": "",
|
"description": "",
|
||||||
"message": "Haber Defense Craft"
|
"message": "Haber Defense Craft"
|
||||||
|
},
|
||||||
|
"SOLFED_INTEL": {
|
||||||
|
"description": "",
|
||||||
|
"message": "Solar Federation Intelligence"
|
||||||
|
},
|
||||||
|
"SOLFED_INTEL_INTRO": {
|
||||||
|
"description": "",
|
||||||
|
"message": "Keep your voice down, pilot. I'm an undercover agent working for Solar Federation Intelligence. Your ship's computer memory has some data we are interested in."
|
||||||
|
},
|
||||||
|
"PERFECT": {
|
||||||
|
"description": "",
|
||||||
|
"message": "Perfect. If anyone asks... Surely no one will ask, but if anyone asks, please remember that we were just haggling over a second hand shield generator."
|
||||||
|
},
|
||||||
|
"YOU_SHALL_HAVE_THE_DATA": {
|
||||||
|
"description": "",
|
||||||
|
"message": "You shall have the data."
|
||||||
|
},
|
||||||
|
"WHAT_IS_THIS_ABOUT": {
|
||||||
|
"description": "",
|
||||||
|
"message": "What data? What is this all about?"
|
||||||
|
},
|
||||||
|
"YOU_VISITED_STAR_SYSTEM": {
|
||||||
|
"description": "",
|
||||||
|
"message": "You may or may not have visited some star system we would like to know more about."
|
||||||
|
},
|
||||||
|
"NOT_INTERESTED": {
|
||||||
|
"description": "",
|
||||||
|
"message": "What if I'm not interested?"
|
||||||
|
},
|
||||||
|
"CREDITS_PROMISE": {
|
||||||
|
"description": "",
|
||||||
|
"message": "250,000 in cash. Right now. I would find that interesting."
|
||||||
|
},
|
||||||
|
"HEY_OVER_HERE": {
|
||||||
|
"description": "",
|
||||||
|
"message": "Hey, over here."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ local Equipment = require 'Equipment'
|
||||||
local ShipDef = require 'ShipDef'
|
local ShipDef = require 'ShipDef'
|
||||||
local Timer = require 'Timer'
|
local Timer = require 'Timer'
|
||||||
|
|
||||||
|
--local Character = require 'Character'
|
||||||
|
|
||||||
local l_rondel = Lang.GetResource("module-rondel")
|
local l_rondel = Lang.GetResource("module-rondel")
|
||||||
local l_ui_core = Lang.GetResource("ui-core")
|
local l_ui_core = Lang.GetResource("ui-core")
|
||||||
|
|
||||||
|
@ -21,6 +23,65 @@ local patrol = {}
|
||||||
local shipFiring = false
|
local shipFiring = false
|
||||||
local jetissionedCargo = false
|
local jetissionedCargo = false
|
||||||
|
|
||||||
|
local rondel_victory = false -- has the player defeated all Rondel guards once in their career?
|
||||||
|
local rondel_prize = false -- whether the player has been rewarded or not
|
||||||
|
|
||||||
|
local ads = {}
|
||||||
|
|
||||||
|
local onChat = function (form, ref, option)
|
||||||
|
local ad = ads[ref]
|
||||||
|
form:Clear()
|
||||||
|
|
||||||
|
form:SetTitle(l_rondel.SOLFED_INTEL)
|
||||||
|
|
||||||
|
if option == -1 then
|
||||||
|
form:Close()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
form:SetMessage(l_rondel.SOLFED_INTEL_INTRO)
|
||||||
|
|
||||||
|
if option == 1 then
|
||||||
|
ads[ref] = nil
|
||||||
|
form:RemoveAdvertOnClose()
|
||||||
|
form:SetMessage(l_rondel.PERFECT)
|
||||||
|
Game.player:AddMoney(250000)
|
||||||
|
rondel_prize = true
|
||||||
|
return
|
||||||
|
elseif option == 2 then
|
||||||
|
form:SetMessage(l_rondel.YOU_VISITED_STAR_SYSTEM)
|
||||||
|
elseif option == 3 then
|
||||||
|
form:SetMessage(l_rondel.CREDITS_PROMISE)
|
||||||
|
end
|
||||||
|
|
||||||
|
form:AddOption(l_rondel.YOU_SHALL_HAVE_THE_DATA, 1)
|
||||||
|
form:AddOption(l_rondel.WHAT_IS_THIS_ABOUT, 2)
|
||||||
|
form:AddOption(l_rondel.NOT_INTERESTED, 3)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local onDelete = function (ref)
|
||||||
|
ads[ref] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local onCreateBB = function (station)
|
||||||
|
if rondel_prize or not rondel_victory then return end
|
||||||
|
|
||||||
|
local ad = {
|
||||||
|
title = l_rondel.HEY_OVER_HERE,
|
||||||
|
--message = "",
|
||||||
|
station = station,
|
||||||
|
--character = Character.New({armour=false}),
|
||||||
|
}
|
||||||
|
|
||||||
|
local ref = station:AddAdvert({
|
||||||
|
description = ad.title,
|
||||||
|
--icon = "",
|
||||||
|
onChat = onChat,
|
||||||
|
onDelete = onDelete})
|
||||||
|
ads[ref] = ad
|
||||||
|
end
|
||||||
|
|
||||||
local attackShip = function (ship)
|
local attackShip = function (ship)
|
||||||
for i = 1, #patrol do
|
for i = 1, #patrol do
|
||||||
patrol[i]:AIKill(ship)
|
patrol[i]:AIKill(ship)
|
||||||
|
@ -35,6 +96,8 @@ local onShipDestroyed = function (ship, attacker)
|
||||||
table.remove(patrol, i)
|
table.remove(patrol, i)
|
||||||
if #patrol > 1 then
|
if #patrol > 1 then
|
||||||
Comms.ImportantMessage(l_rondel.DEFENSE_CRAFT_ELIMINATED, patrol[1].label)
|
Comms.ImportantMessage(l_rondel.DEFENSE_CRAFT_ELIMINATED, patrol[1].label)
|
||||||
|
elseif #patrol == 0 then
|
||||||
|
rondel_victory = true
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
elseif patrol[i] == attacker then
|
elseif patrol[i] == attacker then
|
||||||
|
@ -93,14 +156,14 @@ local onEnterSystem = function (player)
|
||||||
Game.SetTimeAcceleration("1x")
|
Game.SetTimeAcceleration("1x")
|
||||||
Timer:CallAt(Game.time + 2, function ()
|
Timer:CallAt(Game.time + 2, function ()
|
||||||
Comms.ImportantMessage(string.interp(l_rondel.RONDEL_RESTRICTED_ZONE, {seconds = tostring(600*tolerance), playerShipLabel = Game.player:GetLabel()}), ship.label)
|
Comms.ImportantMessage(string.interp(l_rondel.RONDEL_RESTRICTED_ZONE, {seconds = tostring(600*tolerance), playerShipLabel = Game.player:GetLabel()}), ship.label)
|
||||||
|
Timer:CallAt(Game.time + 600*tolerance, function()
|
||||||
|
if #patrol > 1 then
|
||||||
|
attackShip(player)
|
||||||
|
Comms.ImportantMessage(l_rondel.HOSTILE_ACTION_REPORTED, ship.label)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Timer:CallAt(Game.time + 600*tolerance, function()
|
|
||||||
if #patrol > 1 then
|
|
||||||
attackShip(player)
|
|
||||||
Comms.ImportantMessage(l_rondel.HOSTILE_ACTION_REPORTED, ship.label)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local onLeaveSystem = function (ship)
|
local onLeaveSystem = function (ship)
|
||||||
|
@ -118,6 +181,18 @@ local onGameStart = function ()
|
||||||
jetissionedCargo = false
|
jetissionedCargo = false
|
||||||
if loaded_data then
|
if loaded_data then
|
||||||
patrol = loaded_data.patrol
|
patrol = loaded_data.patrol
|
||||||
|
rondel_prize = loaded_data.rondel_prize
|
||||||
|
rondel_victory = loaded_data.rondel_victory
|
||||||
|
if loaded_data.ads then
|
||||||
|
for k,ad in pairs(loaded_data.ads) do
|
||||||
|
local ref = ad.station:AddAdvert({
|
||||||
|
description = ad.title,
|
||||||
|
--icon = "",
|
||||||
|
onChat = onChat,
|
||||||
|
onDelete = onDelete})
|
||||||
|
ads[ref] = ad
|
||||||
|
end
|
||||||
|
end
|
||||||
loaded_data = nil
|
loaded_data = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -125,17 +200,20 @@ end
|
||||||
local onGameEnd = function ()
|
local onGameEnd = function ()
|
||||||
shipFiring = false
|
shipFiring = false
|
||||||
jetissionedCargo = false
|
jetissionedCargo = false
|
||||||
|
rondel_prize = false
|
||||||
|
rondel_victory = false
|
||||||
patrol = {}
|
patrol = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local serialize = function ()
|
local serialize = function ()
|
||||||
return { patrol = patrol }
|
return { patrol = patrol, ads = ads, rondel_prize = rondel_prize, rondel_victory = rondel_victory }
|
||||||
end
|
end
|
||||||
|
|
||||||
local unserialize = function (data)
|
local unserialize = function (data)
|
||||||
loaded_data = data
|
loaded_data = data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Event.Register("onCreateBB", onCreateBB)
|
||||||
Event.Register("onEnterSystem", onEnterSystem)
|
Event.Register("onEnterSystem", onEnterSystem)
|
||||||
Event.Register("onLeaveSystem", onLeaveSystem)
|
Event.Register("onLeaveSystem", onLeaveSystem)
|
||||||
Event.Register("onShipDestroyed", onShipDestroyed)
|
Event.Register("onShipDestroyed", onShipDestroyed)
|
Loading…
Reference in New Issue