mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Adds Trait Genetics (#10142)
Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d81e145924
commit
7bfffc808d
86
code/_helpers/announcements.dm
Normal file
86
code/_helpers/announcements.dm
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Sends a div formatted chat box announcement
|
||||
*
|
||||
* Formatted like:
|
||||
*
|
||||
* " Server Announcement " (or sender_override)
|
||||
*
|
||||
* " Title "
|
||||
*
|
||||
* " Text "
|
||||
*
|
||||
* Arguments
|
||||
* * text - required, the text to announce
|
||||
* * title - optional, the title of the announcement.
|
||||
* * players - optional, a list of all players to send the message to. defaults to the entire world
|
||||
* * play_sound - if TRUE, play a sound with the announcement (based on player option)
|
||||
* * sound_override - optional, override the default announcement sound
|
||||
* * sender_override - optional, modifies the sender of the announcement
|
||||
* * encode_title - if TRUE, the title will be HTML encoded (escaped)
|
||||
* * encode_text - if TRUE, the text will be HTML encoded (escaped)
|
||||
*/
|
||||
|
||||
/proc/send_ooc_announcement(
|
||||
text,
|
||||
title = "",
|
||||
players,
|
||||
play_sound = TRUE,
|
||||
sound_override = 'sound/misc/bloop.ogg',
|
||||
sender_override = "Server Admin Announcement",
|
||||
encode_title = TRUE,
|
||||
encode_text = FALSE,
|
||||
)
|
||||
if(isnull(text))
|
||||
return
|
||||
|
||||
var/list/announcement_strings = list()
|
||||
|
||||
if(encode_title && title && length(title) > 0)
|
||||
title = html_encode(title)
|
||||
if(encode_text)
|
||||
text = html_encode(text)
|
||||
if(!length(text))
|
||||
return
|
||||
|
||||
announcement_strings += span_major_announcement_title(sender_override)
|
||||
announcement_strings += span_subheader_announcement_text(title)
|
||||
announcement_strings += span_ooc_announcement_text(text)
|
||||
var/finalized_announcement = create_ooc_announcement_div(jointext(announcement_strings, ""))
|
||||
|
||||
if(islist(players))
|
||||
for(var/mob/target in players)
|
||||
to_chat(target, finalized_announcement)
|
||||
//if(play_sound && target.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements))
|
||||
if(play_sound && target.client?.prefs.read_preference(/datum/preference/toggle/holder/play_adminhelp_ping))
|
||||
SEND_SOUND(target, sound(sound_override))
|
||||
else
|
||||
to_chat(world, finalized_announcement)
|
||||
|
||||
if(!play_sound)
|
||||
return
|
||||
|
||||
for(var/mob/player in player_list)
|
||||
//if(player.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements))
|
||||
if(player.client?.prefs.read_preference(/datum/preference/toggle/holder/play_adminhelp_ping))
|
||||
SEND_SOUND(player, sound(sound_override))
|
||||
|
||||
/**
|
||||
* Inserts a span styled message into an alert box div
|
||||
*
|
||||
*
|
||||
* Arguments
|
||||
* * message - required, the message contents
|
||||
* * color - optional, set a div color other than default
|
||||
*/
|
||||
/proc/create_announcement_div(message, color = "default")
|
||||
return "<div class='chat_alert_[color]'>[message]</div>"
|
||||
|
||||
/**
|
||||
* Inserts a span styled message into an OOC alert style div
|
||||
*
|
||||
*
|
||||
* Arguments
|
||||
* * message - required, the message contents
|
||||
*/
|
||||
/proc/create_ooc_announcement_div(message)
|
||||
return "<div class='ooc_alert'>[message]</div>"
|
||||
@@ -578,6 +578,9 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN,
|
||||
traits_costs[path] = cost
|
||||
all_traits[path] = instance
|
||||
|
||||
// Traitgenes Initilize trait genes
|
||||
setupgenetics(all_traits)
|
||||
|
||||
// Shakey shakey shake
|
||||
sortTim(all_traits, GLOBAL_PROC_REF(cmp_trait_datums_name), associative = TRUE)
|
||||
|
||||
@@ -585,19 +588,20 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN,
|
||||
for(var/traitpath in all_traits)
|
||||
var/datum/trait/T = all_traits[traitpath]
|
||||
var/category = T.category
|
||||
switch(category)
|
||||
if(-INFINITY to -0.1)
|
||||
negative_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_negative[traitpath] = T
|
||||
if(0)
|
||||
neutral_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_neutral[traitpath] = T
|
||||
if(0.1 to INFINITY)
|
||||
positive_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_positive[traitpath] = T
|
||||
if(!T.hidden) // Traitgenes forbid hidden traits from showing, done to hide genetics only traits
|
||||
switch(category)
|
||||
if(-INFINITY to -0.1)
|
||||
negative_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_negative[traitpath] = T
|
||||
if(0)
|
||||
neutral_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_neutral[traitpath] = T
|
||||
if(0.1 to INFINITY)
|
||||
positive_traits[traitpath] = T
|
||||
if(!(T.custom_only))
|
||||
everyone_traits_positive[traitpath] = T
|
||||
|
||||
|
||||
// Weaver recipe stuff
|
||||
|
||||
Reference in New Issue
Block a user