-
-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass on ship threat as spawn criteria
- Add debug module for ShipBuilder - Split default ship outfitting rules into separate file
- Loading branch information
Showing
3 changed files
with
448 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
local debugView = require 'pigui.views.debug' | ||
local ShipDef = require 'ShipDef' | ||
local ShipBuilder = require 'modules.MissionUtils.ShipBuilder' | ||
local ShipConfig = require 'ShipConfig' | ||
|
||
local ui = require 'pigui' | ||
|
||
debugView.registerTab("ShipBuilder", { | ||
selectedHull = nil, | ||
draw = function(self) | ||
if not ui.beginTabItem("ShipBuilder") then | ||
return | ||
end | ||
|
||
if self.selectedHull then | ||
if ui.button("<") then | ||
self.selectedHull = nil | ||
|
||
ui.endTabItem() | ||
return | ||
end | ||
|
||
ui.sameLine() | ||
ui.text(self.selectedHull) | ||
|
||
ui.spacing() | ||
|
||
if ui.collapsingHeader("Hull Threat") then | ||
local threat = ShipBuilder.GetHullThreat(self.selectedHull) | ||
|
||
for k, v in pairs(threat) do | ||
ui.text(tostring(k) .. ": " .. tostring(v)) | ||
end | ||
end | ||
|
||
if ui.collapsingHeader("Slots") then | ||
local config = ShipConfig[self.selectedHull] | ||
|
||
for k, v in pairs(config.slots) do | ||
ui.text(k) | ||
|
||
local data = " " | ||
for k2, v2 in pairs(v) do | ||
data = data .. tostring(k2) .. " = " .. tostring(v2) .. ", " | ||
end | ||
|
||
ui.text(data) | ||
end | ||
end | ||
else | ||
for id, def in pairs(ShipDef) do | ||
if ui.selectable(id) then | ||
self.selectedHull = id | ||
end | ||
|
||
local threat = ShipBuilder.GetHullThreat(id) | ||
ui.sameLine() | ||
ui.text("threat: " .. tostring(threat.total)) | ||
end | ||
end | ||
|
||
ui.endTabItem() | ||
end | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details | ||
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt | ||
|
||
local Engine = require 'Engine' | ||
local Equipment = require 'Equipment' | ||
local EquipSet = require 'EquipSet' | ||
local ShipDef = require 'ShipDef' | ||
local ShipConfig = require 'ShipConfig' | ||
local Space = require 'Space' | ||
local Ship = require 'Ship' | ||
|
||
local utils = require 'utils' | ||
|
||
---@class MissionUtils.OutfitRules | ||
local OutfitRules = {} | ||
|
||
OutfitRules.DefaultHyperdrive = { | ||
slot = "hyperdrive" | ||
} | ||
|
||
OutfitRules.DefaultAtmoShield = { | ||
slot = "hull", | ||
filter = "hull.atmo_shield", | ||
limit = 1 | ||
} | ||
|
||
OutfitRules.DefaultShieldGen = { | ||
slot = "shield", | ||
limit = 1 | ||
} | ||
|
||
OutfitRules.DefaultAutopilot = { | ||
slot = "computer", | ||
equip = "misc.autopilot", | ||
limit = 1 | ||
} | ||
|
||
OutfitRules.DefaultLaserCooling = { | ||
slot = nil, | ||
equip = "misc.laser_cooling_booster", | ||
limit = 1 | ||
} | ||
|
||
return OutfitRules |
Oops, something went wrong.