Files
Bubberstation/code/modules/mob/living/basic/drone/drones_as_items.dm
Jeremiah bbe440b3d6 More standardization for ghost notifications (READY) (#79596)
## About The Pull Request
I'm still not satisfied with how ghost notifications work. This gives
every notification with a source (99% of all notifications, in other
words) a link to jump/orbit. Currently, notifications with "play"
interactions would only get the interact link, so jumping to the source
was pretty annoying.

It removes posting the entire message in the alert tooltip, as some got
pretty lengthy and it didn't seem to fit. To replace this, they will
always use headers

After:


![image](https://github.com/tgstation/tgstation/assets/42397676/debfce52-3627-4a43-8663-33d61d893161)


![image](https://github.com/tgstation/tgstation/assets/42397676/01f299ae-dc6a-45f8-a97a-cb2c815088b2)


![image](https://github.com/tgstation/tgstation/assets/42397676/99567376-063e-458e-af2a-2dd4306747cc)

NOTIFY_JUMP and NOTIFY_ORBIT have been merged, since the only difference
seems to be whether it's a turf. The result shaves off some redundant
lines of code, since most-every usage of notify_ghosts uses
NOTIFY_ORBIT.
## Why It's Good For The Game
More standardization for the ghost notification system. Adds a few alert
headers that never had them. All in all, makes it easier for creators to
throw alerts at ghosts
## Changelog
🆑
qol: Nearly every ghost alert should now feature a "VIEW" button, even
those with click interaction.
del: Ghost alerts no longer show the entire message in the tooltip,
instead have been replaced with titles.
/🆑
2023-11-19 05:13:25 +01:00

59 lines
2.3 KiB
Plaintext

/** Drone Shell: Ghost role item for drones
*
* A simple mob spawner item that transforms into a maintenance drone
* Respects drone minimum age
*/
/obj/effect/mob_spawn/ghost_role/drone
name = "drone shell"
desc = "A shell of a maintenance drone, an expendable robot built to perform station repairs."
icon = 'icons/mob/silicon/drone.dmi'
icon_state = "drone_maint_hat" //yes reuse the _hat state.
layer = BELOW_MOB_LAYER
density = FALSE
mob_name = "drone"
///Type of drone that will be spawned
mob_type = /mob/living/basic/drone
role_ban = ROLE_DRONE
show_flavor = FALSE
prompt_name = "maintenance drone"
you_are_text = "You are a Maintenance Drone."
flavour_text = "Born out of science, your purpose is to maintain Space Station 13. Maintenance Drones can become the backbone of a healthy station."
important_text = "You MUST read and follow your laws carefully."
spawner_job_path = /datum/job/maintenance_drone
/obj/effect/mob_spawn/ghost_role/drone/Initialize(mapload)
. = ..()
var/area/area = get_area(src)
if(area)
notify_ghosts(
"A drone shell has been created in \the [area.name].",
source = src,
header = "Drone Shell Created",
click_interact = TRUE,
ignore_key = POLL_IGNORE_DRONE,
notify_flags = (GHOST_NOTIFY_IGNORE_MAPLOAD),
)
/obj/effect/mob_spawn/ghost_role/drone/allow_spawn(mob/user, silent = FALSE)
var/client/user_client = user.client
var/mob/living/basic/drone/drone_type = mob_type
if(!initial(drone_type.shy) || isnull(user_client) || !CONFIG_GET(flag/use_exp_restrictions_other))
return ..()
var/required_role = CONFIG_GET(string/drone_required_role)
var/required_playtime = CONFIG_GET(number/drone_role_playtime) * 60
if(CONFIG_GET(flag/use_exp_restrictions_admin_bypass) && check_rights_for(user.client, R_ADMIN))
return ..()
if(user?.client?.prefs.db_flags & DB_FLAG_EXEMPT)
return ..()
if(required_playtime <= 0)
return ..()
var/current_playtime = user_client?.calc_exp_type(required_role)
if (current_playtime < required_playtime)
var/minutes_left = required_playtime - current_playtime
var/playtime_left = DisplayTimeText(minutes_left * (1 MINUTES))
if(!silent)
to_chat(user, span_danger("You need to play [playtime_left] more as [required_role] to spawn as a Maintenance Drone!"))
return FALSE
return ..()