mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-21 15:51:31 +00:00
A lot has changed.
Major points:
- All mobs now use the -tg- thrown alerts system. This is a system where
a maximum of 5 "alerts" (which take the apperance of HUD icons like the
inventory and modular action buttons) on their HUD.
- Alerts are defined as a subtype of /obj/screen/alert.
- Alerts are "thrown", or activated on the mob with the proc
`mob.throw_alert("alert_id", /obj/screen/alert/path, severity
(optional), new_master (optional, overlays the referenced "obj" on the
button))`
- Alerts are cleared by calling `mob.clear_alert("alert_id")` or by the
/obj/screen/alert containing a `timeout` setting, which will
automatically clear itself after that period of deciseconds.
- Alerts may have functionality beyond appearance: Mousing over them
will use the WireWraith tooltip system to generate a themed tooltip,
and clicking them may have a function defined on the
/obj/screen/alert object.
- Shift-clicking an alert will give you it's name and status, in case
the tooltips fail to work.
- Hunger/Oxygen/Toxin/Nitrogen/Pressure/Etc warnings are now handled via
the -tg- thrown alerts system.
- Failing to breathe anything will display as an "No O2" warning.
- Species breathing has been refactored to accomodate this. Vox are
able to breathe the station air without instantly dying, but will be
poisoned every time they breathe by the oxygen in the air. Any
species with a unique gas breathing type will also display the
correct "Choking (no X gas)" instead of just "oxygen". (Unless they
have not breathed anything in, it's a quirk.)
- Robot cell/temperature alerts also use this.
- Aliens, though not harmed by toxins, will have an alert if they
breathe in toxins, notifying them that "You'll be toast if this
lights up."
- More alerts have been added
- Buckling
- Activated on: Being buckled to an object.
- Cleared on: Being unbuckled.
- Click functionality: Calls resist(); Will unbuckle from chair
instantly if unrestrained, otherwise, there is a delay period.
- Hand/Leg cuffs
- Activated on: Being handcuffed.
- Cleared on: Being unhandcuffed.
- Click functionality: Calls resist(); Will attempt to either get out
of the handcuffs, or, if you are a xenomorph or hulk, break the
handcuffs in 5 seconds.
- Blind/High
- Activated on: Becoming blinded/becoming high on LSD.
- Cleared on: Becoming unblinded/the high wearing off.
- Click functionality: None.
- Asleep
- Activated on: Life() tick detecting sleeping.
- Deactivated on: Sleeping being 0 or less.
- Click functionality: None.
- Weightless
- Activated on: Losing gravity.
- Deactivated on: Moving back into an area with gravity.
- Click functionality: None.
- On Fire
- Activated on: Catching fire.
- Deactivated on: Being extinguished.
- Click functionality: Calls resist(); Causes you to stop, drop, and
roll, which will reduce firestacks and possibly extinguish you.
- Law update (BORG ONLY)
- Activated on: Laws being changed.
- Deactivated on: Timer, 300 deciseconds.
- Click functionality: None.
- Hacked (BORG ONLY)
- Activated on: Being emagged/given malf tools by the malf AI.
- Deactivated on: Emagged status being removed.
- Click functionality: None.
- Locked (BORG ONLY)
- Activated on: Lockdown being set (by emag law rewriting/robotics
console/wire being destroyed)
- Deactivated on: Movement being unlocked.
- Click functionality: None.
- Notify Cloning (GHOST ONLY)
- Activated on: A human's body being placed in a DNA scanner.
- Deactivated on: Timer, 300 deciseconds.
- Click functionality: Reenters body.
- Notify Jump (MULTIPURPOSE) (GHOST ONLY)
- Activated on: Any sort of chance to become a mob (ie, golem rune).
- Deactivated on: Timer, 300 deciseconds.
- Click functionality: Varies.
117 lines
3.5 KiB
Plaintext
117 lines
3.5 KiB
Plaintext
/*
|
|
Tooltips v1.1 - 22/10/15
|
|
Developed by Wire (#goonstation on irc.synirc.net)
|
|
- Added support for screen_loc pixel offsets. Should work. Maybe.
|
|
- Added init function to more efficiently send base vars
|
|
|
|
Configuration:
|
|
- Set control to the correct skin element (remember to actually place the skin element)
|
|
- Set file to the correct path for the .html file (remember to actually place the html file)
|
|
- Attach the datum to the user client on login, e.g.
|
|
/client/New()
|
|
src.tooltips = new /datum/tooltip(src)
|
|
|
|
Usage:
|
|
- Define mouse event procs on your (probably HUD) object and simply call the show and hide procs respectively:
|
|
/obj/screen/hud
|
|
MouseEntered(location, control, params)
|
|
usr.client.tooltip.show(params, title = src.name, content = src.desc)
|
|
|
|
MouseExited()
|
|
usr.client.tooltip.hide()
|
|
|
|
Customization:
|
|
- Theming can be done by passing the theme var to show() and using css in the html file to change the look
|
|
- For your convenience some pre-made themes are included
|
|
|
|
Notes:
|
|
- You may have noticed 90% of the work is done via javascript on the client. Gotta save those cycles man.
|
|
- This is entirely untested in any other codebase besides goonstation so I have no idea if it will port nicely. Good luck!
|
|
- After testing and discussion (Wire, Remie, MrPerson, AnturK) ToolTips are ok and work for /tg/station13
|
|
*/
|
|
|
|
|
|
/datum/tooltip
|
|
var/client/owner
|
|
var/control = "mainwindow.tooltip"
|
|
var/file = 'code/modules/tooltip/tooltip.html'
|
|
var/showing = 0
|
|
var/queueHide = 0
|
|
var/init = 0
|
|
|
|
|
|
/datum/tooltip/New(client/C)
|
|
if (C)
|
|
owner = C
|
|
owner << browse(file2text(file), "window=[control]")
|
|
|
|
..()
|
|
|
|
|
|
/datum/tooltip/proc/show(atom/movable/thing, params = null, title = null, content = null, theme = "default", special = "none")
|
|
if (!thing || !params || (!title && !content) || !owner || !isnum(world.icon_size))
|
|
return 0
|
|
if (!init)
|
|
//Initialize some vars
|
|
init = 1
|
|
owner << output(list2params(list(world.icon_size, control)), "[control]:tooltip.init")
|
|
|
|
showing = 1
|
|
|
|
if (title && content)
|
|
title = "<h1>[title]</h1>"
|
|
content = "<p>[content]</p>"
|
|
else if (title && !content)
|
|
title = "<p>[title]</p>"
|
|
else if (!title && content)
|
|
content = "<p>[content]</p>"
|
|
|
|
//Make our dumb param object
|
|
params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"}
|
|
|
|
//Send stuff to the tooltip
|
|
owner << output(list2params(list(params, owner.view, "[title][content]", theme, special)), "[control]:tooltip.update")
|
|
|
|
//If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips
|
|
showing = 0
|
|
if (queueHide)
|
|
hide()
|
|
|
|
return 1
|
|
|
|
|
|
/datum/tooltip/proc/hide()
|
|
if(queueHide)
|
|
spawn(1)
|
|
winshow(owner, control, 0)
|
|
else
|
|
winshow(owner, control, 0)
|
|
|
|
queueHide = showing ? 1 : 0
|
|
|
|
return 1
|
|
|
|
|
|
/* TG SPECIFIC CODE */
|
|
|
|
|
|
//Open a tooltip for user, at a location based on params
|
|
//Theme is a CSS class in tooltip.html, by default this wrapper chooses a CSS class based on the user's UI_style (Midnight, Plasmafire, Retro, etc)
|
|
//Includes sanity.checks
|
|
/proc/openToolTip(mob/user = null, atom/movable/tip_src = null, params = null, title = "", content = "", theme = "")
|
|
if(istype(user))
|
|
if(user.client && user.client.tooltips)
|
|
if(!theme && user.client.prefs && user.client.prefs.UI_style)
|
|
theme = lowertext(user.client.prefs.UI_style)
|
|
if(!theme)
|
|
theme = "default"
|
|
user.client.tooltips.show(tip_src, params, title, content, theme)
|
|
|
|
|
|
//Arbitrarily close a user's tooltip
|
|
//Includes sanity checks.
|
|
/proc/closeToolTip(mob/user)
|
|
if(istype(user))
|
|
if(user.client && user.client.tooltips)
|
|
user.client.tooltips.hide()
|