Skip to content

Commit e391bd9

Browse files
committed
UI enhance
1 parent 214c827 commit e391bd9

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

code/game/machinery/planet_scanner.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,15 @@
131131
data["can_scan"] = anchored && !(stat & (BROKEN|NOPOWER)) && !scanning && scans_completed < PLANET_SCANNER_MAX_SCANS
132132
data["at_scan_limit"] = scans_completed >= PLANET_SCANNER_MAX_SCANS
133133

134-
if(SSmapping && SSmapping.planets && SSmapping.planets.len > 0)
134+
if(SSmapping?.planets.len > 0)
135135
var/list/planet_data = list()
136136
for(var/datum/planet_type/planet in SSmapping.planets)
137137
var/list/planet_info = list()
138138
planet_info["name"] = planet.name
139139
planet_info["desc"] = planet.desc
140140
planet_info["type"] = planet.type
141141
planet_info["procedural_name"] = planet.planet_name
142+
planet_info["icon_data"] = icon2base64(planet.ico)
142143
planet_data += list(planet_info)
143144
data["discovered_planets"] = planet_data
144145
data["has_discoveries"] = TRUE

code/modules/procedural mapping/planetGenerator/planet_types.dm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@
2222
var/loot_modifier = 0
2323
//Allocation occupied by this planet.
2424
var/allocation = null
25+
//Icon shown in the planet scanner.
26+
var/icon_state = "moon"
27+
var/icon/ico
2528

2629
/datum/planet_type/New()
2730
..()
2831
planet_name = generate_planet_name()
32+
ico = icon('icons/ui/planet_scanner/128x128.dmi', "bg")
33+
var/icon/fg = icon('icons/ui/planet_scanner/64x64.dmi', icon_state)
34+
ico.Blend(fg,ICON_OVERLAY,32,32)
2935

3036
/datum/planet_type/proc/generate_planet_name()
3137
// Complete planet names
@@ -189,6 +195,7 @@
189195
ruin_type = RUINTYPE_BEACH
190196
loot_type = LOOT_TYPE_BEACH
191197
climate_type = CLIMATE_TROPICAL
198+
icon_state = "beach2"
192199

193200
/datum/planet_type/desert
194201
name = "desert planetoid"
@@ -199,6 +206,7 @@
199206
loot_type = LOOT_TYPE_DESERT
200207
climate_type = CLIMATE_DESERT
201208
loot_modifier = 5
209+
icon_state = "desert"
202210

203211
/datum/planet_type/grass
204212
name = "grass planetoid"
@@ -208,6 +216,7 @@
208216
ruin_type = RUINTYPE_LAVA
209217
loot_type = LOOT_TYPE_GRASS
210218
climate_type = CLIMATE_TEMPERATE
219+
icon_state = "earth"
211220

212221
/datum/planet_type/jungle
213222
name = "jungle planetoid"
@@ -218,6 +227,7 @@
218227
loot_type = LOOT_TYPE_JUNGLE
219228
climate_type = CLIMATE_TROPICAL
220229
loot_modifier = 10
230+
icon_state = "jungle2"
221231

222232
/datum/planet_type/lava
223233
name = "lava planetoid"
@@ -228,6 +238,7 @@
228238
loot_type = LOOT_TYPE_LAVA
229239
climate_type = CLIMATE_LAVA
230240
loot_modifier = 15
241+
icon_state = "lava"
231242

232243
/datum/planet_type/snow
233244
name = "frozen planetoid"
@@ -238,6 +249,7 @@
238249
loot_type = LOOT_TYPE_SNOW
239250
climate_type = CLIMATE_ARCTIC
240251
loot_modifier = 5
252+
icon_state = "snow"
241253

242254
/datum/planet_type/urban
243255
name = "wasteland planetoid"
@@ -248,6 +260,7 @@
248260
loot_type = LOOT_TYPE_URBAN
249261
climate_type = CLIMATE_DESERT
250262
loot_modifier = 10
263+
icon_state = "barren"
251264

252265
/datum/planet_type/xeno
253266
name = "unknown planetoid"
@@ -258,3 +271,4 @@
258271
loot_type = LOOT_TYPE_XENO
259272
climate_type = CLIMATE_XENO
260273
loot_modifier = 20
274+
icon_state = "xeno1"
1.74 KB
Binary file not shown.

icons/ui/planet_scanner/64x64.dmi

14.2 KB
Binary file not shown.

tgui/packages/tgui/interfaces/PlanetScanner.tsx

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type PlanetData = {
99
desc: string;
1010
type: string;
1111
procedural_name: string;
12+
icon_data: string;
1213
};
1314

1415
type Data = {
@@ -80,7 +81,7 @@ export const PlanetScanner = (props) => {
8081
};
8182

8283
return (
83-
<Window width={600} height={450}>
84+
<Window width={600} height={485}>
8485
<Window.Content>
8586
<Stack fill vertical>
8687
{!anchored && (
@@ -104,22 +105,6 @@ export const PlanetScanner = (props) => {
104105
<Stack.Item>
105106
<Section title="Scanner Status">
106107
<Stack vertical>
107-
<Stack.Item>
108-
<Stack>
109-
<Stack.Item basis="40%">
110-
Maximum Power Rate:
111-
</Stack.Item>
112-
<Stack.Item grow>
113-
<ProgressBar
114-
value={Math.min(available_power, min_power_rate)}
115-
maxValue={min_power_rate || 1}
116-
color="blue"
117-
>
118-
{min_power_rate?.toLocaleString() || 0} W
119-
</ProgressBar>
120-
</Stack.Item>
121-
</Stack>
122-
</Stack.Item>
123108
<Stack.Item>
124109
<Stack>
125110
<Stack.Item basis="40%">
@@ -131,7 +116,7 @@ export const PlanetScanner = (props) => {
131116
maxValue={Math.max(available_power || 0, min_power_rate || 1)}
132117
color="good"
133118
>
134-
{available_power?.toLocaleString() || 0} W
119+
{available_power?.toLocaleString() || 0} W / {min_power_rate?.toLocaleString() || 0} W
135120
</ProgressBar>
136121
</Stack.Item>
137122
</Stack>
@@ -157,13 +142,13 @@ export const PlanetScanner = (props) => {
157142
<Stack.Item grow>
158143
<Section title="Discovered Planets">
159144
<Stack>
160-
<Stack.Item width="150px">
145+
<Stack.Item width="280px">
161146
<Box textAlign="center">
162147
<Box
163148
as="img"
164-
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
165-
width="128px"
166-
height="128px"
149+
src={currentPlanet ? `data:image/png;base64,${currentPlanet.icon_data}` : undefined}
150+
height="256px"
151+
width="256px"
167152
style={{
168153
border: '2px solid #888',
169154
backgroundColor: '#333',
@@ -177,11 +162,11 @@ export const PlanetScanner = (props) => {
177162
</Box>
178163
</Stack.Item>
179164
<Stack.Item grow>
180-
<Stack vertical>
165+
<Stack vertical fill>
181166
<Stack.Item>
182167
<Stack>
183168
<Stack.Item grow>
184-
<Box fontSize="16px" bold color="good">
169+
<Box fontSize="18px" bold color="good">
185170
{currentPlanet ? currentPlanet.procedural_name : 'No Planet Selected'}
186171
</Box>
187172
</Stack.Item>
@@ -193,7 +178,7 @@ export const PlanetScanner = (props) => {
193178
</Stack>
194179
</Stack.Item>
195180
<Stack.Item>
196-
<Box mb={1}>
181+
<Box mb={2} fontSize="14px">
197182
{currentPlanet ? currentPlanet.desc : 'No planet data available.'}
198183
</Box>
199184
</Stack.Item>

0 commit comments

Comments
 (0)