Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP lore/worldbuilding/station lobby #5283

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions data/lang/lore/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"" : {
"description" : "",
"message" : ""
},
"SOL_MARS_CYDONIA" : {
"description" : "",
"message" : "Home of the core systems number one gravball team, the Little Green Men."
},
"SOL_EARTH_LONDON" : {
"description" : "",
"message" : "Traditional center of civilization. Has recovered quite well after last centurys flooding disasters, although many of the cultural landmarks will never be restored to their former glory."
},
"SOL_EARTH_MOSCOW" : {
"description" : "",
"message" : "Moscow Spaceflight museum is a must see! See how it all started, including an actual moon lander recovered from the moon!"
},
"SOL_EARTH_OLYMPUS" : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOL_MARS_OLYMPUS
👽

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sol_mars_cydonia you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Cydonia is another station. The text (ski slope...) shows correct on Olympus Mons station but the token name looked a bit off, that's all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just abbreviated it because its unique enough with the sol_mars

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its unique enough with the sol_mars

Yes, it would have been, but you named it SOL_EARTH_OLYMPUS. I don't know if we're talking about the same thing here and I may have misunderstood everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oopsies. carbon copy much? yes. I though you were talking about cydonia because of the alien emoji

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the Little Green Men team! You need to also fix the string in SCC0000000013-OlympusMons.json. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks,, seems im not a my best today.

"description" : "",
"message" : "Dont forget to enjoy the longest ski slope within a hundred lightyears!"
},
"SOL_EARTH_SHANGHAI" : {
"description" : "",
"message" : "Industrial powerhouse of Earth. Dont forget your hazmat suit if you want to venture outside."
}
}
4 changes: 2 additions & 2 deletions data/lang/ui-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,7 @@
},
"STATION_DOCKS": {
"description": "Information shown in the station lobby, for total number of docking pads",
"message": "Our total capacity is {total_docking_pads} docking pads."
"message": "Your ship is docked on pad {shipbay} out of {bays} docking pads."
Copy link
Contributor

@bszlrd bszlrd Sep 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea! Is the "out of bays" part necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know but see the diff, how many bays there are in the station was all there was before, I only added the shipbay

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, then I realized that you replace the line, not adding another about the pads. Sorry

},
"STATION_LOCAL_GRAVITY": {
"description": "",
Expand Down Expand Up @@ -1925,7 +1925,7 @@
},
"TECH_CERTIFIED_MILITARY": {
"description": "Lobby screen shows the tech level of the station",
"message": "This installation holds a military technology clearance."
"message": "This installation holds a military technology certificate."
},
"TEXTURE_COMPRESSION": {
"description": "",
Expand Down
43 changes: 31 additions & 12 deletions data/libs/SpaceStation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,23 @@ function SpaceStation:Constructor()
-- Use a variation of the space station seed itself to ensure consistency
local rand = Rand.New(self.seed .. '-techLevel')
local techLevel = rand:Integer(1, 6) + rand:Integer(0,6)
if Game.system.faction ~= nil and Game.system.faction.hasHomeworld and Game.system.faction.homeworld == self.path:GetSystemBody().parent.path then
local isHomeworld = 0
if Game.system.faction ~= nil and Game.system.faction.hasHomeworld and self.path:IsSameSystem(Game.system.faction.homeworld) then
techLevel = math.max(techLevel, 6) -- bump it upto at least 6 if it's a homeworld like Earth
isHomeworld = 1
end
-- cap the techlevel lower end based on the planets population
techLevel = math.max(techLevel, math.min(math.floor(self.path:GetSystemBody().parent.population * 0.5), 11))
self:setprop("techLevel", techLevel)
self:setprop("isHomeworld", isHomeworld)
local props = self:GetPropertyDefaults()
if props then
for k,v in pairs(props) do
if k and v then
self:setprop(k, v)
end
end
end
end

local equipmentStock = {}
Expand All @@ -49,18 +60,22 @@ local function updateEquipmentStock (station)
if e == hydrogen then
equipmentStock[station][e] = math.floor(rn/2 + Engine.rand:Integer(0,rn)) --always stock hydrogen
else
local pricemod = Game.system:GetCommodityBasePriceAlterations(key)
local stock = (Engine.rand:Integer(0,rn) + Engine.rand:Integer(0,rn)) / 2 -- normal 0-100% stock
if pricemod > 10 then --major import, low stock
stock = stock - (rn*0.10) -- shifting .10 = 2% chance of 0 stock
elseif pricemod > 4 then --minor import
stock = stock - (rn*0.07) -- shifting .07 = 1% chance of 0 stock
elseif pricemod < -10 then --major export
stock = stock + (rn*0.8)
elseif pricemod < -4 then --minor export
stock = stock + (rn*0.3)
if station.noCargoForSale then
equipmentStock[station][e] = 0
else
local pricemod = Game.system:GetCommodityBasePriceAlterations(key)
local stock = (Engine.rand:Integer(0,rn) + Engine.rand:Integer(0,rn)) / 2 -- normal 0-100% stock
if pricemod > 10 then --major import, low stock
stock = stock - (rn*0.10) -- shifting .10 = 2% chance of 0 stock
elseif pricemod > 4 then --minor import
stock = stock - (rn*0.07) -- shifting .07 = 1% chance of 0 stock
elseif pricemod < -10 then --major export
stock = stock + (rn*0.8)
elseif pricemod < -4 then --minor export
stock = stock + (rn*0.3)
end
equipmentStock[station][e] = math.floor(stock >=0 and stock or 0)
end
equipmentStock[station][e] = math.floor(stock >=0 and stock or 0)
end
else
equipmentStock[station][e] = 0 -- commodity that cant be bought
Expand Down Expand Up @@ -141,6 +156,10 @@ end
--
function SpaceStation:GetEquipmentStock (e)
assert(self:exists())
if not equipmentStock or not equipmentStock[self] or not equipmentStock[self][e] then
print("equipmentStock is incomplete/missing")
return 0
end
return equipmentStock[self][e] or 0
end

Expand Down
54 changes: 30 additions & 24 deletions data/pigui/modules/station-view/01-lobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,24 @@ end

local function drawPlayerInfo()
local station = Game.player:GetDockedWith()
if not station or not shipDef then return end

if(not (station and shipDef)) then return end

local tech_certified

if station.techLevel == 11 then
tech_certified = l.TECH_CERTIFIED_MILITARY
else
tech_certified = string.interp(l.TECH_CERTIFIED, { tech_level = station.techLevel})
end

local station_docks = string.interp(l.STATION_DOCKS, { total_docking_pads = string.format("%d", station.numDocks),})
local substrings = { shipbay = station:GetAssignedBayNumber(Game.player) + 1,
bays = string.format("%d", station.numDocks),
tech_level = station.techLevel }

local tech_certified = (station.techLevel >= 11) and l.TECH_CERTIFIED_MILITARY or string.interp(l.TECH_CERTIFIED, substrings)
local station_docks = string.interp(l.STATION_DOCKS, substrings)
local orbit_period = station.path:GetSystemBody().orbitPeriod

local station_frameBody = Space.GetBody(station.path:GetSystemBody().parent.index)
local local_gravity_pressure = ""
if station.type == "STARPORT_SURFACE" then
if station.path:GetSystemBody().parent.hasAtmosphere then
local_gravity_pressure = string.format(l.STATION_LOCAL_GRAVITY_PRESSURE, (station.path:GetSystemBody().parent.gravity/9.8), station_frameBody:GetAtmosphericState(station))
local local_conditions = ""
if station.isGroundStation then
local myBody = station.path:GetSystemBody()
if myBody.parent.hasAtmosphere then
local parentBody = Space.GetBody(myBody.parent.index)
local_conditions = string.format(l.STATION_LOCAL_GRAVITY_PRESSURE, (myBody.parent.gravity/9.8), parentBody:GetAtmosphericState(station))
else
local_gravity_pressure = string.format(l.STATION_LOCAL_GRAVITY, (station.path:GetSystemBody().parent.gravity/9.8))
local_conditions = string.format(l.STATION_LOCAL_GRAVITY, (myBody.parent.gravity/9.8))
end
end

Expand All @@ -266,16 +262,26 @@ local function drawPlayerInfo()
local infoColumnWidth = conReg.x - widgetSizes.faceSize.x - widgetSizes.windowPadding.x*3
local lobbyMenuHeight = widgetSizes.buttonSizeBase.y*3 + widgetSizes.itemSpacing.y*3 + widgetSizes.windowPadding.y*2
local lobbyMenuAtBottom = (conReg.y - widgetSizes.faceSize.y > lobbyMenuHeight + widgetSizes.windowPadding.x*2)

local tabLines = { { tech_certified, "" }, { station_docks, "" } }
if station_orbit_info ~= "" then
table.insert(tabLines, { station_orbit_info, "" })
end
if local_conditions ~= "" then
table.insert(tabLines, { local_conditions, "" })
end
ui.child("Wrapper", Vector2(0, lobbyMenuAtBottom and -lobbyMenuHeight or 0), {}, function()
ui.child("PlayerShipFuel", Vector2(infoColumnWidth, 0), {"AlwaysUseWindowPadding"}, function()
local curPos = ui.getCursorPos()
textTable.withHeading(station.label, orbiteer.xlarge, {
{ tech_certified, "" },
{ station_docks, "" },
{ station_orbit_info, "" },
{ local_gravity_pressure, ""},
})
textTable.withHeading(station.label, orbiteer.xlarge, tabLines )
if station.nolanglore then
ui.separator()
ui.text(station.nolanglore)
end
if not station.nolanglore and station.lore then
local lorelang = Lang.GetResource("lore")
ui.separator()
ui.text(lorelang[station.lore])
end

if not lobbyMenuAtBottom then
lobbyMenu(Vector2(curPos.x, conReg.y - lobbyMenuHeight))
Expand Down
44 changes: 44 additions & 0 deletions data/world/WORLD.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
world/factions/<##_name>.lua

Contains properties of factions

## determines order of precedence when loading
Name filename only. faction name is determined by contents of the file

world/systems/<##_Name>.lua

Contains manually created layouts of star systems

## determines order of precedence when loading
Name filename only. faction name is determined by contents of the file

world/stations/<system+stationID>.json
world/stations/<system>/<stationID>.json

Contains patch properties for individual stations.
System subdirectories is checked first.

Stations Json format:
{
"<PropertyName>" : {
"value" : "<content>"
},
...
}

Properties are passed to station:setprop(<PropertyName>, <content>) for all properties
in SpaceStation:Constructor() (libs/SpaceStation.lua).
If PropertyName contains other keys than "value", those are ignored.
Safe to use "comment" for example.

Recognized PropertyName's:

techLevel Override stations randomly generated techLevel

lore Use this key, translated from lang/lore/*.json, as station lore text

nolanglore Use this text as-is, as station lore text
overrides lore

noCargoForSale (true/false) if present and not false, sets all cargo stocks except hydrogen
to zero. cargo can still be sold.
File renamed without changes.
5 changes: 5 additions & 0 deletions data/world/stations/00000000/SCC0000000004-Shanghai.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lore" : {
"value" : "SOL_EARTH_SHANGHAI"
}
}
5 changes: 5 additions & 0 deletions data/world/stations/00000000/SCC0000000006-London.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lore" : {
"value" : "SOL_EARTH_LONDON"
}
}
5 changes: 5 additions & 0 deletions data/world/stations/00000000/SCC0000000007-Moscow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lore" : {
"value" : "SOL_EARTH_MOSCOW"
}
}
8 changes: 8 additions & 0 deletions data/world/stations/00000000/SCC0000000012-Cydonia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"techLevel" : {
"value" : "10"
},
"lore" : {
"value" : "SOL_MARS_CYDONIA"
}
}
5 changes: 5 additions & 0 deletions data/world/stations/00000000/SCC0000000013-OlympusMons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lore" : {
"value" : "SOL_EARTH_OLYMPUS"
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/galaxy/GalaxyGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RefCountedPtr<Galaxy> GalaxyGenerator::Create(const std::string &name, Version v

assert(name == "legacy"); // Once whe have have more, this will become an if switch
// NB : The galaxy density image MUST be in BMP format due to OSX failing to load pngs the same as Linux/Windows
s_galaxy = RefCountedPtr<Galaxy>(new DensityMapGalaxy(galgen, "galaxy_dense.bmp", 50000.0, 25000.0, 0.0, "factions", "systems"));
s_galaxy = RefCountedPtr<Galaxy>(new DensityMapGalaxy(galgen, "galaxy_dense.bmp", 50000.0, 25000.0, 0.0, "world/factions", "world/systems"));
s_galaxy->Init();
return s_galaxy;
} else {
Expand Down
Loading