mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Hallucinations 2.0
This commit is contained in:
@@ -3,15 +3,18 @@
|
||||
//PUBLIC - call these wherever you want
|
||||
|
||||
|
||||
/mob/proc/throw_alert(category, type, severity, obj/new_master)
|
||||
/mob/proc/throw_alert(category, type, severity, obj/new_master, override = FALSE)
|
||||
|
||||
/* Proc to create or update an alert. Returns the alert if the alert is new or updated, 0 if it was thrown already
|
||||
/*
|
||||
Proc to create or update an alert. Returns the alert if the alert is new or updated, 0 if it was thrown already
|
||||
category is a text string. Each mob may only have one alert per category; the previous one will be replaced
|
||||
path is a type path of the actual alert type to throw
|
||||
severity is an optional number that will be placed at the end of the icon_state for this alert
|
||||
For example, high pressure's icon_state is "highpressure" and can be serverity 1 or 2 to get "highpressure1" or "highpressure2"
|
||||
new_master is optional and sets the alert's icon state to "template" in the ui_style icons with the master as an overlay.
|
||||
Clicks are forwarded to master */
|
||||
Clicks are forwarded to master
|
||||
Override makes it so the alert is not replaced until cleared by a clear_alert with clear_override, and it's used for hallucinations.
|
||||
*/
|
||||
|
||||
if(!category)
|
||||
return
|
||||
@@ -19,6 +22,8 @@
|
||||
var/obj/screen/alert/alert
|
||||
if(alerts[category])
|
||||
alert = alerts[category]
|
||||
if(alert.override_alerts)
|
||||
return 0
|
||||
if(new_master && new_master != alert.master)
|
||||
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [alert.master]")
|
||||
clear_alert(category)
|
||||
@@ -33,7 +38,10 @@
|
||||
else //no need to update
|
||||
return 0
|
||||
else
|
||||
alert = new type
|
||||
alert = new type()
|
||||
alert.override_alerts = override
|
||||
if(override)
|
||||
alert.timeout = null
|
||||
|
||||
if(new_master)
|
||||
var/old_layer = new_master.layer
|
||||
@@ -63,10 +71,12 @@
|
||||
return alert
|
||||
|
||||
// Proc to clear an existing alert.
|
||||
/mob/proc/clear_alert(category)
|
||||
/mob/proc/clear_alert(category, clear_override = FALSE)
|
||||
var/obj/screen/alert/alert = alerts[category]
|
||||
if(!alert)
|
||||
return 0
|
||||
if(alert.override_alerts && !clear_override)
|
||||
return 0
|
||||
|
||||
alerts -= category
|
||||
if(client && hud_used)
|
||||
@@ -83,6 +93,7 @@
|
||||
var/timeout = 0 //If set to a number, this alert will clear itself after that many deciseconds
|
||||
var/severity = 0
|
||||
var/alerttooltipstyle = ""
|
||||
var/override_alerts = FALSE //If it is overriding other alerts of the same type
|
||||
|
||||
|
||||
/obj/screen/alert/MouseEntered(location,control,params)
|
||||
@@ -197,12 +208,12 @@ The box in your backpack has an oxygen tank and gas mask in it."
|
||||
name = "High Pressure"
|
||||
desc = "The air around you is hazardously thick. A fire suit would protect you."
|
||||
icon_state = "highpressure"
|
||||
|
||||
|
||||
/obj/screen/alert/lightexposure
|
||||
name = "Light Exposure"
|
||||
desc = "You're exposed to light."
|
||||
icon_state = "lightexposure"
|
||||
|
||||
|
||||
/obj/screen/alert/nolight
|
||||
name = "No Light"
|
||||
desc = "You're not exposed to any light."
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -527,9 +527,9 @@
|
||||
H.healths.icon_state = "health7"
|
||||
else
|
||||
switch(H.hal_screwyhud)
|
||||
if(1) H.healths.icon_state = "health6"
|
||||
if(2) H.healths.icon_state = "health7"
|
||||
if(5) H.healths.icon_state = "health0"
|
||||
if(SCREWYHUD_CRIT) H.healths.icon_state = "health6"
|
||||
if(SCREWYHUD_DEAD) H.healths.icon_state = "health7"
|
||||
if(SCREWYHUD_HEALTHY) H.healths.icon_state = "health0"
|
||||
else
|
||||
switch(100 - ((flags & NO_PAIN) ? 0 : H.traumatic_shock) - H.staminaloss)
|
||||
if(100 to INFINITY) H.healths.icon_state = "health0"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
amount = amount * species.stun_mod
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/SetSleeping(amount, updating = 1)
|
||||
/mob/living/carbon/human/SetSleeping(amount, updating = 1, no_alert = FALSE)
|
||||
if(species)
|
||||
amount = amount * species.stun_mod
|
||||
..()
|
||||
@@ -345,7 +345,7 @@
|
||||
if(..())
|
||||
handle_dreams()
|
||||
adjustStaminaLoss(-10)
|
||||
if(prob(10) && health && !hal_crit)
|
||||
if(prob(10) && health && hal_screwyhud != SCREWYHUD_CRIT)
|
||||
spawn(0)
|
||||
emote("snore")
|
||||
// Keep SSD people asleep
|
||||
|
||||
@@ -354,19 +354,19 @@
|
||||
|
||||
// SLEEPING
|
||||
|
||||
/mob/living/Sleeping(amount, updating = 1)
|
||||
SetSleeping(max(sleeping, amount), updating)
|
||||
/mob/living/Sleeping(amount, updating = 1, no_alert = FALSE)
|
||||
SetSleeping(max(sleeping, amount), updating, no_alert)
|
||||
|
||||
/mob/living/SetSleeping(amount, updating = 1)
|
||||
/mob/living/SetSleeping(amount, updating = 1, no_alert = FALSE)
|
||||
sleeping = max(amount, 0)
|
||||
update_sleeping_effects()
|
||||
update_sleeping_effects(no_alert)
|
||||
if(updating)
|
||||
update_stat()
|
||||
update_canmove()
|
||||
|
||||
/mob/living/AdjustSleeping(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1)
|
||||
/mob/living/AdjustSleeping(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1, no_alert = FALSE)
|
||||
var/new_value = directional_bounded_sum(sleeping, amount, bound_lower, bound_upper)
|
||||
SetSleeping(new_value, updating)
|
||||
SetSleeping(new_value, updating, no_alert)
|
||||
|
||||
// SLOWED
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
else
|
||||
clear_fullscreen("nearsighted")
|
||||
|
||||
/mob/living/update_sleeping_effects()
|
||||
/mob/living/update_sleeping_effects(no_alert = FALSE)
|
||||
if(sleeping)
|
||||
throw_alert("asleep", /obj/screen/alert/asleep)
|
||||
if(!no_alert)
|
||||
throw_alert("asleep", /obj/screen/alert/asleep)
|
||||
else
|
||||
clear_alert("asleep")
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 253 KiB |
Binary file not shown.
Reference in New Issue
Block a user