Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 4c2d46e

Browse files
real menu button
1 parent 3c777b6 commit 4c2d46e

File tree

12 files changed

+76
-59
lines changed

12 files changed

+76
-59
lines changed

code/__DEFINES/hud.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
#define ui_borg_radio "EAST-1:28,SOUTH+1:7"
107107
#define ui_borg_intents "EAST-2:26,SOUTH:5"
108108
#define ui_language_menu "EAST-4:6,SOUTH:21"
109+
#define ui_skill_menu "EAST-4:6,SOUTH:5"
109110

110111
//Upper-middle right (alerts)
111112
#define ui_alert1 "EAST-1:28,CENTER+5:27"

code/_onclick/hud/alert.dm

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -327,68 +327,10 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
327327
/atom/movable/screen/alert/skill_up
328328
name = "Allocate Skill Points"
329329
desc = "You have unspent skill points! Click here to allocate them."
330-
var/list/allocated_skills = list(
331-
SKILL_PHYSIOLOGY = 0,
332-
SKILL_MECHANICAL = 0,
333-
SKILL_TECHNICAL = 0,
334-
SKILL_SCIENCE = 0,
335-
SKILL_FITNESS = 0,
336-
)
337-
var/allocated_points = 0
338330

339331
/atom/movable/screen/alert/skill_up/Click(location, control, params)
340332
. = ..()
341-
ui_interact(mob_viewer)
342-
343-
/atom/movable/screen/alert/skill_up/ui_interact(mob/user, datum/tgui/ui)
344-
ui = SStgui.try_update_ui(user, src, ui)
345-
if (!ui)
346-
ui = new(user, src, "SkillMenu", "Allocate Skill Points")
347-
ui.open()
348-
349-
/atom/movable/screen/alert/skill_up/ui_data(mob/user)
350-
var/list/data = list()
351-
var/list/skill_data = list()
352-
for(var/skill in user.mind.skills)
353-
skill_data.Add(list(list(
354-
"base" = user.get_skill(skill),
355-
"allocated" = allocated_skills[skill],
356-
)))
357-
data["skills"] = skill_data
358-
data["skill_points"] = user.mind.skill_points
359-
data["allocated_points"] = allocated_points
360-
data["exceptional_skill"] = HAS_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)
361-
return data
362-
363-
/atom/movable/screen/alert/skill_up/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
364-
. = ..()
365-
if(.)
366-
return
367-
var/mob/user = usr
368-
if(!user.mind)
369-
CRASH("User ([user]) without a mind attempted to allocate skill points!")
370-
switch(action)
371-
if("confirm")
372-
for(var/skill in user.mind.skills)
373-
user.adjust_skill(skill, allocated_skills[skill], max_skill = EXP_GENIUS)
374-
allocated_skills[skill] = 0
375-
user.mind.skill_points -= allocated_points
376-
allocated_points = 0
377-
if(!user.mind.skill_points)
378-
user.clear_alert("skill points")
379-
return TRUE
380-
if("allocate")
381-
allocated_skills[params["skill"]] += params["amount"]
382-
allocated_points += params["amount"]
383-
return TRUE
384-
385-
/atom/movable/screen/alert/skill_up/ui_status(mob/user)
386-
if(!user.mind)
387-
return UI_CLOSE
388-
return UI_INTERACTIVE
389-
390-
/atom/movable/screen/alert/skill_up/ui_state(mob/user)
391-
return GLOB.always_state
333+
mob_viewer.hud_used?.skill_menu?.ui_interact(mob_viewer)
392334

393335
//ALIENS
394336

code/_onclick/hud/hud.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
4040
var/atom/movable/screen/rest_icon
4141
var/atom/movable/screen/throw_icon
4242
var/atom/movable/screen/module_store_icon
43+
var/atom/movable/screen/skill_menu
4344

4445
var/list/static_inventory = list() //the screen objects which are static
4546
var/list/toggleable_inventory = list() //the screen objects which can be hidden

code/_onclick/hud/human.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101
using.screen_loc = UI_BOXAREA
102102
static_inventory += using
103103

104+
skill_menu = new /atom/movable/screen/skill_menu(src)
105+
skill_menu.icon = ui_style
106+
if(!widescreen_layout)
107+
skill_menu.screen_loc = UI_BOXAREA
108+
static_inventory += skill_menu
109+
104110
action_intent = new /atom/movable/screen/combattoggle/flashy(src)
105111
action_intent.icon = ui_style
106112
action_intent.screen_loc = ui_combat_toggle

code/_onclick/hud/screen_objects.dm

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,73 @@
118118
var/datum/language_holder/H = M.get_language_holder()
119119
H.open_language_menu(usr)
120120

121+
/atom/movable/screen/skill_menu
122+
name = "skills menu"
123+
icon = 'icons/mob/screen_midnight.dmi'
124+
icon_state = "skill_menu"
125+
screen_loc = ui_skill_menu
126+
var/list/allocated_skills = list(
127+
SKILL_PHYSIOLOGY = 0,
128+
SKILL_MECHANICAL = 0,
129+
SKILL_TECHNICAL = 0,
130+
SKILL_SCIENCE = 0,
131+
SKILL_FITNESS = 0,
132+
)
133+
var/allocated_points = 0
134+
135+
/atom/movable/screen/skill_menu/Click()
136+
ui_interact(usr)
137+
138+
/atom/movable/screen/skill_menu/ui_interact(mob/user, datum/tgui/ui)
139+
ui = SStgui.try_update_ui(user, src, ui)
140+
if (!ui)
141+
ui = new(user, src, "SkillMenu", "Allocate Skill Points")
142+
ui.open()
143+
144+
/atom/movable/screen/skill_menu/ui_data(mob/user)
145+
var/list/data = list()
146+
var/list/skill_data = list()
147+
for(var/skill in user.mind.skills)
148+
skill_data.Add(list(list(
149+
"base" = user.get_skill(skill),
150+
"allocated" = allocated_skills[skill],
151+
)))
152+
data["skills"] = skill_data
153+
data["skill_points"] = user.mind.skill_points
154+
data["allocated_points"] = allocated_points
155+
data["exceptional_skill"] = HAS_TRAIT(user, TRAIT_EXCEPTIONAL_SKILL)
156+
return data
157+
158+
/atom/movable/screen/skill_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
159+
. = ..()
160+
if(.)
161+
return
162+
var/mob/user = usr
163+
if(!user.mind)
164+
CRASH("User ([user]) without a mind attempted to allocate skill points!")
165+
switch(action)
166+
if("confirm")
167+
for(var/skill in user.mind.skills)
168+
user.adjust_skill(skill, allocated_skills[skill], max_skill = EXP_GENIUS)
169+
allocated_skills[skill] = 0
170+
user.mind.skill_points -= allocated_points
171+
allocated_points = 0
172+
if(!user.mind.skill_points)
173+
user.clear_alert("skill points")
174+
return TRUE
175+
if("allocate")
176+
allocated_skills[params["skill"]] += params["amount"]
177+
allocated_points += params["amount"]
178+
return TRUE
179+
180+
/atom/movable/screen/skill_menu/ui_status(mob/user)
181+
if(!user.mind)
182+
return UI_CLOSE
183+
return UI_INTERACTIVE
184+
185+
/atom/movable/screen/skill_menu/ui_state(mob/user)
186+
return GLOB.always_state
187+
121188
/atom/movable/screen/ghost/pai
122189
name = "pAI Candidate"
123190
icon = 'icons/mob/screen_midnight.dmi'

icons/mob/screen_detective.dmi

191 Bytes
Binary file not shown.

icons/mob/screen_midnight.dmi

544 Bytes
Binary file not shown.

icons/mob/screen_obsidian.dmi

670 Bytes
Binary file not shown.

icons/mob/screen_operative.dmi

107 Bytes
Binary file not shown.

icons/mob/screen_plasmafire.dmi

163 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)