mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
On screen alert system
Replaces some of the hardcoded HUD icons defined at mob level with a pair of mob procs throw_alert() and clear_alert(). Alerts will appear on the top-right side of the screen.
You can shift-click alerts to get a description of what's wrong and sometimes a tip on how to solve the alert.
Alerts can be given a master, which overlays the master on top of a box and forwards clicks of the alert to that master. Getting buckled will put an alert of what you're buckled to, for example. If it's a chair, you just click the alert and you're unbuckled. The idea I'm shooting for is to replace resist entirely with this kind of stuff.
Making a new alert and using it is a little complicated. This explanation will suck, but this is simpler than I'm making it sound, I promise. Throw_alert() has 4 args, category, id, severity, and obj/new_master. If you don't supply an id, category will be used as id. Only 1 alert per category is allowed; any duplicate will be replaced. Additionally clear_alert() clears alerts by category. Id MUST match a type path of /obj/screen/alert/[id]. That type path is where the alert's name and desc come from. The icon_state of the alert will either be "template" if new_master is set or [id][severity] otherwise. new_master is totally optional.
Examples:
throw_alert("oxy") -- takes name/desc of obj/screen/alert/oxy, icon_state = "oxy" -- clear_alert("oxy")
throw_alert("nutrition","fat") -- takes name/desc of obj/screen/alert/fat, icon_state = "fat" -- clear_alert("nutrition")
throw_alert("nutrition","starving") -- takes name/desc of obj/screen/alert/starving, icon_state = "starving" -- clear_alert("nutrition")
throw_alert("temp","cold",1) -- takes name/desc of obj/screen/alert/cold, icon_state = "cold1" -- clear_alert("temp")
throw_alert("temp","cold",3) -- takes name/desc of obj/screen/alert/cold, icon_state = "cold3" -- clear_alert("temp")
If you pass a new_master, id is only used to get name/desc and still must match a path, but the icon_state is "template" and icon is from the mob's ui preference instead of icons/mob/screen_alert.dmi.
Several unused icons removed, like borg oxygen and temperature alerts. Also some icons were used but now are not and were removed, like the nutrition icon for being well-fed and cyborg charge icon for being fully charged.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
buckled_mob = M
|
||||
M.update_canmove()
|
||||
post_buckle_mob(M)
|
||||
M.throw_alert("buckled", new_master = src)
|
||||
return 1
|
||||
|
||||
/obj/proc/unbuckle_mob()
|
||||
@@ -50,6 +51,7 @@
|
||||
buckled_mob.buckled = null
|
||||
buckled_mob.anchored = initial(buckled_mob.anchored)
|
||||
buckled_mob.update_canmove()
|
||||
buckled_mob.clear_alert("buckled")
|
||||
buckled_mob = null
|
||||
|
||||
post_buckle_mob(.)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
/obj/item/weapon/restraints/handcuffs/proc/apply_cuffs(mob/living/carbon/target, mob/user)
|
||||
if(!target.handcuffed)
|
||||
user.drop_item()
|
||||
//target.throw_alert("handcuffed", src) // Can't do this because escaping cuffs isn't standardized. Also zipties.
|
||||
if(trashtype)
|
||||
target.handcuffed = new trashtype(target)
|
||||
qdel(src)
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
if(ishuman(L) || ismonkey(L) || iscorgi(L))
|
||||
if(L.buckled)
|
||||
L.buckled = 0
|
||||
L.anchored = 0
|
||||
L.buckled.unbuckle_mob()
|
||||
if(L.client)
|
||||
L.client.perspective = EYE_PERSPECTIVE
|
||||
L.client.eye = src
|
||||
|
||||
Reference in New Issue
Block a user