mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-04 14:01:22 +00:00
About The Pull Request Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage. Also changes a couple of places where a list was picked from instead of using get_sfx internal calls This was done via regex: (playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1 (playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0 full sed commands: /(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE /(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE I'm not very good with regex and these could probably be optimized, but they worked. Why It's Good For The Game Code usability
84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
/datum/language/codespeak
|
|
name = "Codespeak"
|
|
desc = "Syndicate operatives can use a series of codewords to convey complex information, while sounding like random concepts and drinks to anyone listening in."
|
|
key = "t"
|
|
default_priority = 0
|
|
flags = TONGUELESS_SPEECH | LANGUAGE_HIDE_ICON_IF_NOT_UNDERSTOOD
|
|
icon_state = "codespeak"
|
|
|
|
/datum/language/codespeak/scramble(input)
|
|
var/lookup = check_cache(input)
|
|
if(lookup)
|
|
return lookup
|
|
|
|
. = ""
|
|
var/list/words = list()
|
|
while(length(.) < length(input))
|
|
words += generate_code_phrase(return_list=TRUE)
|
|
. = jointext(words, ", ")
|
|
|
|
. = capitalize(.)
|
|
|
|
var/input_ending = copytext(input, length(input))
|
|
|
|
var/static/list/endings
|
|
if(!endings)
|
|
endings = list("!", "?", ".")
|
|
|
|
if(input_ending in endings)
|
|
. += input_ending
|
|
|
|
add_to_cache(input, .)
|
|
|
|
/obj/item/codespeak_manual
|
|
name = "codespeak manual"
|
|
desc = "The book's cover reads: \"Codespeak(tm) - Secure your communication with metaphors so elaborate, they seem randomly generated!\""
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "book2"
|
|
var/charges = 1
|
|
|
|
/obj/item/codespeak_manual/attack_self(mob/living/user)
|
|
if(!isliving(user))
|
|
return
|
|
|
|
if(user.has_language(/datum/language/codespeak))
|
|
to_chat(user, "<span class='boldannounce'>You start skimming through [src], but you already know Codespeak.</span>")
|
|
return
|
|
|
|
to_chat(user, "<span class='boldannounce'>You start skimming through [src], and suddenly your mind is filled with codewords and responses.</span>")
|
|
user.grant_language(/datum/language/codespeak)
|
|
|
|
use_charge(user)
|
|
|
|
/obj/item/codespeak_manual/attack(mob/living/M, mob/living/user)
|
|
if(!istype(M) || !istype(user))
|
|
return
|
|
if(M == user)
|
|
attack_self(user)
|
|
return
|
|
|
|
playsound(loc, "punch", 25, TRUE, -1)
|
|
|
|
if(M.stat == DEAD)
|
|
M.visible_message("<span class='danger'>[user] smacks [M]'s lifeless corpse with [src].</span>", "<span class='userdanger'>[user] smacks your lifeless corpse with [src].</span>", "<span class='italics'>You hear smacking.</span>")
|
|
else if(M.has_language(/datum/language/codespeak))
|
|
M.visible_message("<span class='danger'>[user] beats [M] over the head with [src]!</span>", "<span class='userdanger'>[user] beats you over the head with [src]!</span>", "<span class='italics'>You hear smacking.</span>")
|
|
else
|
|
M.visible_message("<span class='notice'>[user] teaches [M] by beating [M.p_them()] over the head with [src]!</span>", "<span class='boldnotice'>As [user] hits you with [src], codewords and responses flow through your mind.</span>", "<span class='italics'>You hear smacking.</span>")
|
|
M.grant_language(/datum/language/codespeak)
|
|
use_charge(user)
|
|
|
|
/obj/item/codespeak_manual/proc/use_charge(mob/user)
|
|
charges--
|
|
if(!charges)
|
|
var/turf/T = get_turf(src)
|
|
T.visible_message("<span class='warning'>The cover and contents of [src] start shifting and changing!</span>")
|
|
|
|
qdel(src)
|
|
var/obj/item/book/manual/random/book = new(T)
|
|
user.put_in_active_hand(book)
|
|
|
|
/obj/item/codespeak_manual/unlimited
|
|
name = "deluxe codespeak manual"
|
|
charges = INFINITY
|