Skip to content

Commit

Permalink
Merge pull request #5561 from Gliese852/new-game-menu
Browse files Browse the repository at this point in the history
New game start dialog
  • Loading branch information
Web-eWorks committed Aug 25, 2023
2 parents dc2e4e2 + 507c263 commit 6a904b6
Show file tree
Hide file tree
Showing 53 changed files with 7,161 additions and 1,886 deletions.
82 changes: 75 additions & 7 deletions data/lang/ui-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@
"description": "Paintshop button",
"message": "Change Pattern"
},
"CHARACTER": {
"description": "",
"message": "Character"
},
"CHARISMA": {
"description": "Character parameter",
"message": "Charisma"
},
"CHIEF_MECHANIC": {
"description": "",
"message": "Chief Mechanic"
Expand Down Expand Up @@ -263,6 +271,10 @@
"description": "in game currency",
"message": "Credits"
},
"CREW": {
"description": "Tab item in the start game menu",
"message": "Crew"
},
"CREW_CABINS": {
"description": "",
"message": "Crew cabins"
Expand Down Expand Up @@ -445,7 +457,7 @@
},
"ENGINEERING": {
"description": "Engineering skills of crew",
"message": "Engineering:"
"message": "Engineering"
},
"ENTRY": {
"description": "A note/entry/record into the flight log",
Expand Down Expand Up @@ -1159,6 +1171,10 @@
"description": "Label displaying commodity flow at a per-system level",
"message": "Interstellar Trade:"
},
"INTELLIGENCE": {
"description": "Character parameter",
"message": "Intelligence"
},
"INVERT_MOUSE_Y": {
"description": "",
"message": "Invert Mouse Y"
Expand Down Expand Up @@ -1231,6 +1247,10 @@
"description": "",
"message": "Permission granted. Watch for traffic on your departure."
},
"LAWFULNESS": {
"description": "Character parameter",
"message": "Lawfulness"
},
"LEGAL_STATUS": {
"description": "",
"message": "Legal status"
Expand Down Expand Up @@ -1303,6 +1323,10 @@
"description": "",
"message": "Low"
},
"LUCK": {
"description": "Character parameter",
"message": "Luck"
},
"LY": {
"description": "Light year",
"message": "ly"
Expand Down Expand Up @@ -1415,6 +1439,14 @@
"description": "",
"message": "Mission Details"
},
"MODEL": {
"description": "3d model of the ship",
"message": "Model"
},
"MONEY": {
"description": "",
"message": "Money"
},
"MORE_INFO": {
"description": "",
"message": "More info..."
Expand Down Expand Up @@ -1460,8 +1492,8 @@
"message": "Name"
},
"NAVIGATION": {
"description": "",
"message": "Navigation:"
"description": "Crew skill",
"message": "Navigation"
},
"NAVIGATOR": {
"description": "",
Expand All @@ -1471,6 +1503,10 @@
"description": "",
"message": "Negotiate"
},
"NEW_GAME": {
"description": "Main menu item",
"message": "New game"
},
"NEW_PAINTJOB_APPLIED": {
"description": "Paintshop popup",
"message": "The new paintjob has been applied to your ship."
Expand Down Expand Up @@ -1507,6 +1543,10 @@
"description": "",
"message": "Notes:"
},
"NOTORIETY": {
"description": "Character parameter",
"message": "Notoriety"
},
"NOT_ENOUGH_ALLOY_TO_ATTEMPT_A_REPAIR": {
"description": "",
"message": "Not enough {alloy} to attempt a repair"
Expand Down Expand Up @@ -1672,8 +1712,8 @@
"message": "Pilot"
},
"PILOTING": {
"description": "",
"message": "Piloting:"
"description": "Crew skill",
"message": "Piloting"
},
"PILOT_SEAT_IS_NOW_OCCUPIED_BY_NAME": {
"description": "",
Expand Down Expand Up @@ -1895,6 +1935,10 @@
"description": "",
"message": "Select game to load..."
},
"SELECT_START_PROFILE": {
"description": "Combo box for selecting the starting position",
"message": "Select start profile:"
},
"SELL": {
"description": "Commodities and equipment prices",
"message": "Sell"
Expand All @@ -1904,8 +1948,8 @@
"message": "Sell Equipped"
},
"SENSORS": {
"description": "",
"message": "Sensors:"
"description": "Crew skill",
"message": "Sensors"
},
"SENSORS_AND_DEFENCE": {
"description": "",
Expand Down Expand Up @@ -1963,6 +2007,14 @@
"description": "",
"message": "Ship Market"
},
"SHIP_NAME": {
"description": "",
"message": "Ship name"
},
"SHIP_PARAMETERS": {
"description": "",
"message": "Ship parameters"
},
"SHIP_REPAIRS": {
"description": "Station tab name",
"message": "Ship Repairs & Paintshop"
Expand All @@ -1975,10 +2027,18 @@
"description": "",
"message": "Simulating evolution of the universe: {age} billion years ;-)"
},
"SOME_PARAMETERS_ARE_NOT_OK": {
"description": "Diagnostics at game start",
"message": "Some parameters are not OK:"
},
"SOUND": {
"description": "",
"message": "Sound"
},
"STANDARD_GAME_START_TIME": {
"description": "Standard game start time, current moment + 1200 years",
"message": "Standard game start time"
},
"START_AT_BARNARDS_STAR": {
"description": "",
"message": "Start at Barnard's Star"
Expand All @@ -2003,6 +2063,10 @@
"description": "",
"message": "This is a moderate start from Itzalean on New Hope in the Epsilon Eridani system."
},
"START_GAME": {
"description": "Button",
"message": "Start game"
},
"START_LOG_ENTRY_1": {
"description": "First custom log message when starting a new game, giving backstory to the character. Importantly we here hint at what actions the player is best to take: buy fuel, get reputation, ask for take off clearance.",
"message": "Unfortunately, uncle never showed me how to operate this old barge when he was alive, but I think I'm making an entry in the ship's log now. It's strange, I can still feel him, as if he's in the very walls of this ship. Maybe he can be my co-pilot, and together we will manifest our destiny in the great void. But first, I just need to buy some hydrogen for the jump drive, plot a course to lucrative trading opportunities, and pray to the heavens that traffic control will allow an inexperienced pilot like me to take off, then we'll see what this baby can do. Time to make a reputation for myself!"
Expand Down Expand Up @@ -2055,6 +2119,10 @@
"description": "",
"message": "Status"
},
"SUMMARY": {
"description": "Tab item in the start game menu",
"message": "Summary"
},
"TECH_CERTIFIED": {
"description": "Lobby screen shows the tech level (an integer number) of the station",
"message": "This station holds a level {tech_level} technology certificate."
Expand Down
93 changes: 39 additions & 54 deletions data/libs/Character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ local Game = require 'Game'
local Event = require 'Event'
local NameGen = require 'NameGen'
local Serializer = require 'Serializer'
local utils = require 'utils'

local Character;
Character = {
Expand Down Expand Up @@ -965,6 +966,18 @@ Character = {
end
end,

combatRatings = {
{ 'HARMLESS' },
{ 'MOSTLY_HARMLESS', 8 },
{ 'POOR', 16 },
{ 'AVERAGE', 32 },
{ 'ABOVE_AVERAGE', 64 },
{ 'COMPETENT', 128 },
{ 'DANGEROUS', 512 },
{ 'DEADLY', 2400 },
{ 'ELITE', 6000 }
},

--
-- Method: GetCombatRating
--
Expand Down Expand Up @@ -994,25 +1007,7 @@ Character = {
-- experimental
--
GetCombatRating = function (self)
if self.killcount < 8 then
return('HARMLESS')
elseif self.killcount < 16 then
return('MOSTLY_HARMLESS')
elseif self.killcount < 32 then
return('POOR')
elseif self.killcount < 64 then
return('AVERAGE')
elseif self.killcount < 128 then
return('ABOVE_AVERAGE')
elseif self.killcount < 512 then
return('COMPETENT')
elseif self.killcount < 2400 then
return('DANGEROUS')
elseif self.killcount < 6000 then
return('DEADLY')
else
return('ELITE')
end
return utils.getFromIntervals(self.combatRatings, self.killcount)
end,

--
Expand Down Expand Up @@ -1055,20 +1050,12 @@ Character = {
-- This function is completely agnostic of the values of the ratings.
local ratingflag = false
local combatrating = self:GetCombatRating()
for i,testrating in ipairs {'HARMLESS',
'MOSTLY_HARMLESS',
'POOR',
'AVERAGE',
'ABOVE_AVERAGE',
'COMPETENT',
'DANGEROUS',
'DEADLY',
'ELITE'} do
if testrating == rating then
for i,testrating in ipairs(self.combatRatings) do
if testrating[1] == rating then
-- We have reached the desired rating
ratingflag = true
end
if testrating == combatrating and ratingflag then
if testrating[1] == combatrating and ratingflag then
-- The character's rating is equal to the one we've rached, and
-- we have either reached or passed the desired rating
return true
Expand All @@ -1077,6 +1064,21 @@ Character = {
return false
end,

reputations = {
{ 'INCOMPETENT' },
{ 'UNRELIABLE', -8 },
{ 'NOBODY', 0 },
{ 'INEXPERIENCED', 4 },
{ 'EXPERIENCED', 8 },
{ 'CREDIBLE', 16 },
{ 'RELIABLE', 32 },
{ 'TRUSTWORTHY', 64 },
{ 'PROFESSIONAL', 128 },
{ 'EXPERT', 256 },
{ 'MASTER', 512 }
},


--
-- Method: GetReputationRating
--
Expand Down Expand Up @@ -1106,29 +1108,7 @@ Character = {
-- experimental
--
GetReputationRating = function (self)
if self.reputation < -8 then
return('INCOMPETENT')
elseif self.reputation < 0 then
return('UNRELIABLE')
elseif self.reputation < 4 then
return('NOBODY')
elseif self.reputation < 8 then
return('INEXPERIENCED')
elseif self.reputation < 16 then
return('EXPERIENCED')
elseif self.reputation < 32 then
return('CREDIBLE')
elseif self.reputation < 64 then
return('RELIABLE')
elseif self.reputation < 128 then
return('TRUSTWORTHY')
elseif self.reputation < 256 then
return('PROFESSIONAL')
elseif self.reputation < 512 then
return('EXPERT')
else
return('MASTER')
end
return utils.getFromIntervals(self.reputations, self.reputation)
end,

-- Debug function
Expand Down Expand Up @@ -1173,7 +1153,7 @@ local onGameStart = function ()
for k,newCharacter in pairs(loaded_data.PersistentCharacters) do
Character.persistent[k] = newCharacter
end
else
elseif not Character.persistent.player then
-- Make a new character sheet for the player, with just
-- the average values. We'll find some way to ask the
-- player for a new name in the future.
Expand All @@ -1196,6 +1176,10 @@ local serialize = function ()
return { PersistentCharacters = Character.persistent}
end

local function onGameEnd ()
Character.persistent = {}
end

local unserialize = function (data)
loaded_data = data
end
Expand Down Expand Up @@ -1243,6 +1227,7 @@ end
--

Event.Register("onGameStart", onGameStart)
Event.Register("onGameEnd", onGameEnd)
Serializer:Register("Characters", serialize, unserialize)
Serializer:RegisterClass("Character", Character)

Expand Down
Loading

0 comments on commit 6a904b6

Please sign in to comment.