Skip to content

Commit

Permalink
Merge pull request #5734 from Web-eWorks/equip-v2
Browse files Browse the repository at this point in the history
Ship Equipment Overhaul - EquipSet v2
  • Loading branch information
Web-eWorks authored Nov 4, 2024
2 parents 7228502 + 1f6f38b commit 627d296
Show file tree
Hide file tree
Showing 100 changed files with 9,296 additions and 3,741 deletions.
188 changes: 180 additions & 8 deletions data/lang/equipment-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,6 @@
"description": "",
"message": "R40 Unguided Rocket"
},
"MULTI_SCOOP": {
"description": "A ship equipment: a cargo scoop and fuel scoop combined into one",
"message": "Multi Scoop"
},
"MULTI_SCOOP_DESCRIPTION": {
"description": "",
"message": "Although less effective than a fuel scoop it permits scooping of both cargo and fuel"
},
"ORBIT_SCANNER": {
"description": "A ship equipment that records data of terrain, for cartography mapping/geological survey. Note: Scout Mission module reference and distinguishes between 'orbital' and 'surface' scanner types, the former scans planet from orbit, the latter from low altitude.",
"message": "Orbital scanner XKM-650"
Expand Down Expand Up @@ -446,5 +438,185 @@
"WEAPONS": {
"description": "Category name of weapon-related equipment",
"message": "Weapons"
},
"THRUSTERS_DEFAULT": {
"description": "Equipment name for default RCS thrusters",
"message": "Default Thrusters"
},
"PROJECTILE_SPEED": {
"description": "Stat label for weapon projectile speeds",
"message": "Projectile Speed"
},
"STAT_VOLUME": {
"description": "Stat label for equipment volume",
"message": "Volume"
},
"STAT_WEIGHT": {
"description": "Stat label for equipment weight",
"message": "Weight"
},
"STAT_POWER_DRAW": {
"description": "Stat label for equipment power draw",
"message": "Power Draw"
},
"COMPUTER_MODULES": {
"description": "Category name of computer-related equipment",
"message": "Computer Modules"
},
"HULL_MOUNTS": {
"description": "Category name for hull-mounted equipment",
"message": "Hull Mounts"
},
"HARDPOINT_FUEL_SCOOP": {
"description": "Name for the 'Fuel Scoop' equipment hardpoint",
"message": "Fuel Scoop"
},
"HARDPOINT_MISSILE": {
"description": "Name for a generic missile mount",
"message": "Missile"
},
"HARDPOINT_PYLON": {
"description": "Name for a generic missile pylon",
"message": "Pylon"
},
"HARDPOINT_MISSILE_BAY": {
"description": "Name for the 'Missile Bay' equipment hardpoint",
"message": "Missile Bay"
},
"HARDPOINT_MISSILE_ARRAY": {
"description": "Name for the 'Missile Array' equipment hardpoint",
"message": "Missile Array"
},
"HARDPOINT_UTILITY": {
"description": "Name for a generic utility hardpoint",
"message": "Utility"
},
"HARDPOINT_WEAPON": {
"description": "Name for a generic weapon hardpoint",
"message": "Weapon"
},
"HARDPOINT_WEAPON_FRONT": {
"description": "Name for a generic front-facing weapon hardpoint",
"message": "Front Weapon"
},
"HARDPOINT_WEAPON_CHIN": {
"description": "Name for the 'Chin Mount' equipment hardpoint",
"message": "Chin Mount"
},
"HARDPOINT_WEAPON_LEFT_NOSE": {
"description": "Name for the 'Left Nose' weapon hardpoint",
"message": "Left Nose"
},
"HARDPOINT_WEAPON_RIGHT_NOSE": {
"description": "Name for the 'Right Nose' weapon hardpoint",
"message": "Right Nose"
},
"HARDPOINT_WEAPON_REAR": {
"description": "Name for a generic rear-facing weapon hardpoint",
"message": "Rear Weapon"
},
"SLOT_SENSOR": {
"description": "Name for a generic (flight/navigation) sensor slot",
"message": "Sensor"
},
"SLOT_CABIN": {
"description": "Name for a generic room slot inside the pressurized living space",
"message": "Cabin"
},
"SLOT_COMPUTER": {
"description": "Name for a generic computer equipment slot",
"message": "Computer"
},
"SLOT_SHIELD": {
"description": "Name for a generic shield slot",
"message": "Shield"
},
"SLOT_SHIELD_LEFT": {
"description": "Name for a left-side shield slot",
"message": "Shield L"
},
"SLOT_SHIELD_RIGHT": {
"description": "Name for a right-side shield equipment slot",
"message": "Shield R"
},
"SLOT_HULL": {
"description": "Name for an equipment slot that augments or modifies the ship hull",
"message": "Hull"
},
"SLOT_HYPERDRIVE": {
"description": "Name for a ship's singular hyperdrive equipment slot",
"message": "Hyperdrive"
},
"SLOT_ENGINE": {
"description": "Name for the ship's primary travel engines",
"message": "Engines"
},
"SLOT_THRUSTER": {
"description": "Generic name for secondary attitude or maneuvering thrusters",
"message": "Thrusters"
},
"SLOT_CABIN_FORE": {
"description": "Name for a cabin slot towards the front of the ship",
"message": "Fore Cabin"
},
"SLOT_CABIN_REAR": {
"description": "Name for a cabin slot towards the rear of the ship",
"message": "Rear Cabin"
},
"SLOT_STRUCTURE": {
"description": "Name for the ship's internal structure modification slot",
"message": "Structure"
},
"MISC_EQUIPMENT": {
"description": "Category header for miscellaneous equipment",
"message": "Miscellaneous"
},
"OPLI_INTERNAL_MISSILE_RACK_S2": {
"description": "Equipment name for an OPLI internal missile rack",
"message": "OPLI Internal Missile Rack"
},
"OKB_KALURI_BOWFIN_MISSILE_RACK": {
"description": "Equipment name for an OKB-Kaluri Bowfin internal missile launcher",
"message": "Bowfin Missile Launcher"
},
"CABINS": {
"description": "Category header for pressurized cabin slots",
"message": "Cabins"
},
"PASSENGER_BERTHS": {
"description": "Label for the total number of passenger berths in a cabin equipment item",
"message": "Passenger Berths"
},
"OCCUPIED_BERTHS": {
"description": "Label for the number of passenger berths currently occupied in a cabin equipment item",
"message": "Occupied Berths"
},
"MISSILE_RAIL_S1": {
"description": "Name for a single-missile external launcher. 'Cnida' is a brand name.",
"message": "Cnida-101 Missile Rail"
},
"MISSILE_RAIL_S2": {
"description": "Name for a single-missile external launcher. 'Cnida' is a brand name.",
"message": "Cnida-102 Missile Rail"
},
"MISSILE_RAIL_S3": {
"description": "Name for a single-missile external launcher. 'Cnida' is a brand name.",
"message": "Cnida-103 Missile Rail"
},
"MISSILE_RACK_341": {
"description": "Name for a multiple-missile external missile rack. 'Hydri' is a brand name.",
"message": "LH-140 Hydri Missile Rack"
},
"MISSILE_RACK_322": {
"description": "Name for a multiple-missile external missile rack. 'Hydri' is a brand name.",
"message": "LH-230 Hydri Missile Rack"
},
"MISSILE_RACK_221": {
"description": "Name for a multiple-missile external missile rack. 'Hydri' is a brand name.",
"message": "LH-120 Hydri Missile Rack"
},
"REINFORCED_STRUCTURE": {
"description": "Name for an equipment item that reinforces the hull's superstructure",
"message": "Reinforced Structure"
}
}
40 changes: 38 additions & 2 deletions data/lang/ui-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2011,9 +2011,9 @@
"description": "",
"message": "Repair {damage}% hull damage for {price}"
},
"REPLACE_EQUIPMENT_WITH": {
"REPLACE_EQUIPMENT": {
"description": "Market header when replacing equipped items",
"message": "Replace Equipment With"
"message": "Replace Equipment"
},
"REPUTATION": {
"description": "",
Expand Down Expand Up @@ -2618,5 +2618,41 @@
"ZOOM": {
"description": "Label for a zoom (magnification) control bar.",
"message": "Zoom"
},
"SELECTED": {
"description": "Label indicating the following item is selected",
"message": "Selected"
},
"INSTALLED": {
"description": "Label indicating something is installed",
"message": "Installed"
},
"SELL_EQUIP": {
"description": "Button text to sell installed equipment. May be used in a singular or plural context.",
"message": "Sell {name}"
},
"BUY_EQUIP": {
"description": "Button text to buy selected equipment. May be used in a singular or plural context.",
"message": "Buy {name}"
},
"EXPAND": {
"description": "Open / expand a collapsed folder or group",
"message": "Expand"
},
"COLLAPSE": {
"description": "Close / collapse an open folder or group",
"message": "Collapse"
},
"CANNOT_SELL_NONEMPTY_EQUIP": {
"description": "",
"message": "Cannot sell an equipment item unless it is empty."
},
"VOLUME": {
"description": "The volume property of some object",
"message": "Volume"
},
"EQUIPMENT_CAPACITY": {
"description": "The equipment capacity of a ship",
"message": "Equipment Capacity"
}
}
19 changes: 6 additions & 13 deletions data/libs/CargoManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function CargoManager:Constructor(ship)
if not self.ship:hasprop("totalCargo") then
ship:setprop("totalCargo", self:GetTotalSpace())
end

if not self.ship:hasprop("usedCargo") then
ship:setprop("usedCargo", 0)
end
Expand Down Expand Up @@ -63,14 +63,7 @@ end
--
-- Returns the available amount of cargo space currently present on the vessel.
function CargoManager:GetFreeSpace()
local ship = self.ship

-- use mass_cap directly here instead of freeCapacity because this can be
-- called before ship:UpdateEquipStats() has been called
local avail_mass = ShipDef[ship.shipId].capacity - (ship.mass_cap or 0)
local cargo_space = ShipDef[ship.shipId].equipSlotCapacity.cargo or 0

return math.min(avail_mass, cargo_space - self.usedCargoSpace)
return self:GetTotalSpace() - self.usedCargoSpace
end

-- Method: GetUsedSpace
Expand All @@ -84,7 +77,7 @@ end
--
-- Returns the maximum amount of cargo that could be stored on the vessel.
function CargoManager:GetTotalSpace()
return self:GetFreeSpace() + self.usedCargoSpace
return ShipDef[self.ship.shipId].cargo
end

-- Method: AddCommodity
Expand All @@ -103,9 +96,9 @@ end
---@param type CommodityType
---@param count integer
function CargoManager:AddCommodity(type, count)
-- TODO: use a cargo volume metric with variable mass instead of fixed 1m^3 == 1t
-- TODO: use a cargo volume metric with variable mass instead of fixed 1t == 1m^3
local required_space = (type.mass or 1) * (count or 1)

if self:GetFreeSpace() < required_space then
return false
end
Expand Down Expand Up @@ -251,7 +244,7 @@ end
function CargoManager:Unserialize()
setmetatable(self, CargoManager.meta)
self.listeners = {}

return self
end

Expand Down
1 change: 1 addition & 0 deletions data/libs/Character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ local Serializer = require 'Serializer'
local utils = require 'utils'

local Character;
---@class Character
Character = {

--
Expand Down
5 changes: 5 additions & 0 deletions data/libs/Economy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ table.sort(Economies, function(a, b) return a.id < b.id end)
-- Percentage modifier applied to buying/selling commodities
-- Prevents buying a commodity at a station and immediately reselling it
Economy.TradeFeeSplit = 2

-- Total trade fee percentage applied to a buy->sell transaction
Economy.TotalTradeFees = 2 * Economy.TradeFeeSplit

-- Scalar multiplier applied when reselling "used" equipment items back onto the market
Economy.BaseResellPriceModifier = 0.8

-- stationMarket is a persistent table of stock information for every station
-- the player has visited in their journey
local stationMarket = {}
Expand Down
Loading

0 comments on commit 627d296

Please sign in to comment.