Add an "advice" module, giving useful information on the BBS.

For now, the advice/rumour/tale is specific to the station. Thinking is: on
that particular station someone lives, or some meme/information/rumour has
taken hold, and in the spirit of sharing this is freely posted on the BBS.

The advice is some "lore" or information that adds useful information
on how to play the game, or things to discover, or make use of in game play.

Ideally, this information would "leak" from some other more relaxed social
setting, like a bar, from more experienced pilots / bartender.
master
Karl F 2017-04-19 10:53:29 +02:00
parent c5ec92764d
commit b4b1b3ad11
3 changed files with 245 additions and 0 deletions

View File

@ -21,6 +21,11 @@ file_filter = data/lang/quitconfirmation-core/<lang>.json
source_file = data/lang/quitconfirmation-core/en.json
source_lang = en
[pioneer.module-advice]
file_filter = data/lang/module-advice/<lang>.json
source_file = data/lang/module-advice/en.json
source_lang = en
[pioneer.module-aiwarning]
file_filter = data/lang/module-aiwarning/<lang>.json
source_file = data/lang/module-aiwarning/en.json

View File

@ -0,0 +1,102 @@
{
"ADVICE_1_HEADLINE" : {
"description" : "",
"message" : "Tame the Black Market"
},
"ADVICE_1_BODYTEXT" : {
"description" : "",
"message" : "Take note of which local business to trust or not, upon completing a transaction outside the confines of the law."
},
"ADVICE_2_HEADLINE" : {
"description" : "(A reference to the famous poem The Road Not Taken, by Robert Frost)",
"message" : "The Road Faster Taken"
},
"ADVICE_2_BODYTEXT" : {
"description" : "",
"message" : "Many small distances are faster travelled than their sum."
},
"ADVICE_3_HEADLINE" : {
"description" : "",
"message" : "Avoid getting stranded: plan your jump sequence ahead"
},
"ADVICE_3_BODYTEXT" : {
"description" : "(it simply says, to have enough fuel to leave a place where there is no possibility to refuel)",
"message" : "Avoid jumping into uninhabited systems without the means to leave."
},
"ADVICE_4_HEADLINE" : {
"description" : "",
"message" : "It's all relative"
},
"ADVICE_4_BODYTEXT" : {
"description" : "",
"message" : "Choose your frame of reference. Especially when wanting to match speed and course of a moving target."
},
"ADVICE_5_HEADLINE" : {
"description" : "",
"message" : "Never loose money"
},
"ADVICE_5_BODYTEXT" : {
"description" : "",
"message" : "Buy low and sell high."
},
"ADVICE_6_HEADLINE" : {
"description" : "",
"message" : "Keep your ear to the ground"
},
"ADVICE_6_BODYTEXT" : {
"description" : "",
"message" : "Pay close attention to any news reported, as information can affect market prices."
},
"ADVICE_7_HEADLINE" : {
"description" : "",
"message" : "Be generous"
},
"ADVICE_7_BODYTEXT" : {
"description" : "",
"message" : "Donations can earn you a good standing in society, but not all charities will earn you a reputation."
},
"ADVICE_8_HEADLINE" : {
"description" : "",
"message" : "Stay out of double trouble"
},
"ADVICE_8_BODYTEXT" : {
"description" : "",
"message" : "When journeying to binary systems, make sure to target the right star."
},
"ADVICE_9_HEADLINE" : {
"description" : "",
"message" : "Treat your ship well"
},
"ADVICE_9_BODYTEXT" : {
"description" : "",
"message" : "Regularly maintain your engines, but remember: you get what you pay for."
},
"ADVICE_10_HEADLINE" : {
"description" : "",
"message" : "Know when to leave town"
},
"ADVICE_10_BODYTEXT" : {
"description" : "",
"message" : "Relocating to another faction might be a good idea when in trouble with local authorities."
},
"TALE_1_HEADLINE" : {
"description" : "Blade runner?",
"message" : "\"I've seen things you people wouldn't believe\""
},
"TALE_1_BODYTEXT" : {
"description" : "",
"message" : "Don't miss the beautiful eclipse on New Hope as Hades blocks out the light from Epsilon Eridani."
},
"TRAVELLERS_ADVICE" : {
"description" : "Headline starts with this pre-headline",
"message" : "TRAVELLER'S ADVICE"
},
"TRAVELLERS_TALE" : {
"description" : "Headline starts with this pre-headline",
"message" : "TRAVELLER'S TALE"
},
"RUMOUR" : {
"description" : "Headline starts with this pre-headline",
"message" : "RUMOUR"
}
}

View File

@ -0,0 +1,138 @@
-- Copyright © 2008-2017 Pioneer Developers. See AUTHORS.txt for details
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
-- This module is a substitute for not having a propper "bar" /
-- "bartender" where a player could go and get latest rumours or
-- advice from more experienced pilots. Instead, we just put them on
-- the BBS for now.
local Lang = import("Lang")
local Event = import("Event")
local Rand = import("Rand")
local Serializer = import("Serializer")
local l = Lang.GetResource("module-advice")
-- probability to have one advice/rumour (per BBS):
local advice_probability = .2
-- There are three different versions of flavours "Rumours",
-- "Traveller's tale", and "Traveller's advice", which have fake /
-- arbitrary indices, for inflated feeling of rich universe and lore.
local rumours_num = 0
local travellers_tale_num = 1
local travellers_advice_indices = {481, -- tame black market
16, -- road faster taken
173, -- don't get stranded
13, -- it's all relative
5, -- never loose money
121, -- read the news
81, -- donate
23, -- double trouble
52, -- service ship
248, -- change faction
}
-- Hold all different types of advice/rumours available:
local flavours = {}
-- Hold the ones published on the BBS:
local ads = {}
-- add Traveller strings to flavours-table:
for i = 1,#travellers_advice_indices do
local num = travellers_advice_indices[i]
table.insert(flavours, {
ID = l['TRAVELLERS_ADVICE'] .. " #" .. num,
headline = l["ADVICE_" .. i .. "_HEADLINE"],
bodytext = l["ADVICE_" .. i .. "_BODYTEXT"],
})
end
-- add Traveller tale strings to flavours-table:
for i = 1,travellers_tale_num do
table.insert(flavours, {
ID = l['TRAVELLERS_TALE'],
headline = l["TALE_" .. i .. "_HEADLINE"],
bodytext = l["TALE_" .. i .. "_BODYTEXT"],
})
end
-- add rumours to flavours-table:
for i = 1,rumours_num do
table.insert(flavours, {
ID = l['RUMOUR'],
headline = l["RUMOUR_" .. i .. "_HEADLINE"],
bodytext = l["RUMOUR_" .. i .. "_BODYTEXT"],
})
end
-- print ad to BBS
local onChat = function (form, ref, option)
local ad = ads[ref]
form:Clear()
form:SetTitle(ad.id)
form:SetMessage(ad.bodytext)
end
local onDelete = function (ref)
ads[ref] = nil
end
-- when we enter a system the BBS is created and this function is called
local onCreateBB = function (station)
local rand = Rand.New(station.seed)
local n = rand:Integer(1, #flavours)
local ad = {
id = flavours[n].ID,
headline = flavours[n].ID .. ": " .. flavours[n].headline,
bodytext = flavours[n].bodytext,
station = station
}
-- only create one per BBS, with advice_probability
local ref
if rand:Number() < advice_probability then
ref = station:AddAdvert({
description = ad.headline,
icon = "advice",
onChat = onChat,
onDelete = onDelete})
ads[ref] = ad
end
end
local loaded_data
local onGameStart = function ()
ads = {}
if not loaded_data then return end
for k,ad in pairs(loaded_data.ads) do
local ref = ad.station:AddAdvert({
description = ad.headline,
icon = "advice",
onChat = onChat,
onDelete = onDelete})
ads[ref] = ad
end
loaded_data = nil
end
local serialize = function ()
return { ads = ads }
end
local unserialize = function (data)
loaded_data = data
end
Event.Register("onCreateBB", onCreateBB)
Event.Register("onGameStart", onGameStart)
Serializer:Register("Advice", serialize, unserialize)