mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-05 22:31:04 +01:00
48e36ef2c7
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> Fixes #69798 Fixes #71621 When using hypnosis on a victim, the language should be accounted for and whether the victim can properly hear it. Before the hearing code would magically translate any message, this is no longer the case. This also fixes the language barrier involving hearing for: - Mind echo trauma - Phobia trauma - Hypnotic trigger trauma - Split Personality brainwashing trauma - Codeword hearing - Hypnotize status effect - Impure Inacusiate reagent ## Why It's Good For The Game <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> Better consistency, improved readability, and less bugs in the future. ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and it's effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 fix: Fix hypnosis, mind echo trauma, phobia trauma, hypnotic trigger trauma, split personality brainwashing trauma, codeword hearing, and impure inacusiate reagent all bypassing language and hearing checks. If you try to give commands to a victim in a language they don't understand, they will no longer magically understand the words. fix: Fix sign language having accent modifications refactor: Refactored saycode to be more robust, readable, and have more unit tests. /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
233 lines
5.9 KiB
Plaintext
233 lines
5.9 KiB
Plaintext
/obj/item/toy/eightball
|
|
name = "magic eightball"
|
|
desc = "A black ball with a stenciled number eight in white on the side. It seems full of dark liquid.\nThe instructions state that you should ask your question aloud, and then shake."
|
|
|
|
icon = 'icons/obj/toys/toy.dmi'
|
|
icon_state = "eightball"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
verb_say = "rattles"
|
|
|
|
var/shaking = FALSE
|
|
var/on_cooldown = FALSE
|
|
|
|
var/shake_time = 50
|
|
var/cooldown_time = 100
|
|
|
|
var/static/list/possible_answers = list(
|
|
"It is certain",
|
|
"It is decidedly so",
|
|
"Without a doubt",
|
|
"Yes definitely",
|
|
"You may rely on it",
|
|
"As I see it, yes",
|
|
"Most likely",
|
|
"Outlook good",
|
|
"Yes",
|
|
"Signs point to yes",
|
|
"Reply hazy try again",
|
|
"Ask again later",
|
|
"Better not tell you now",
|
|
"Cannot predict now",
|
|
"Concentrate and ask again",
|
|
"Don't count on it",
|
|
"My reply is no",
|
|
"My sources say no",
|
|
"Outlook not so good",
|
|
"Very doubtful")
|
|
|
|
/obj/item/toy/eightball/Initialize(mapload)
|
|
. = ..()
|
|
if(MakeHaunted())
|
|
return INITIALIZE_HINT_QDEL
|
|
|
|
/obj/item/toy/eightball/proc/MakeHaunted()
|
|
. = prob(1)
|
|
if(.)
|
|
new /obj/item/toy/eightball/haunted(loc)
|
|
|
|
/obj/item/toy/eightball/attack_self(mob/user)
|
|
if(shaking)
|
|
return
|
|
|
|
if(on_cooldown)
|
|
to_chat(user, span_warning("[src] was shaken recently, it needs time to settle."))
|
|
return
|
|
|
|
user.visible_message(span_notice("[user] starts shaking [src]."), span_notice("You start shaking [src]."), span_hear("You hear shaking and sloshing."))
|
|
|
|
shaking = TRUE
|
|
|
|
start_shaking(user)
|
|
if(do_after(user, shake_time))
|
|
var/answer = get_answer()
|
|
say(answer)
|
|
|
|
on_cooldown = TRUE
|
|
addtimer(CALLBACK(src, PROC_REF(clear_cooldown)), cooldown_time)
|
|
|
|
shaking = FALSE
|
|
|
|
/obj/item/toy/eightball/proc/start_shaking(user)
|
|
return
|
|
|
|
/obj/item/toy/eightball/proc/get_answer()
|
|
return pick(possible_answers)
|
|
|
|
/obj/item/toy/eightball/proc/clear_cooldown()
|
|
on_cooldown = FALSE
|
|
|
|
// A broken magic eightball, it only says "YOU SUCK" over and over again.
|
|
|
|
/obj/item/toy/eightball/broken
|
|
name = "broken magic eightball"
|
|
desc = "A black ball with a stenciled number eight in white on the side. It is cracked and seems empty."
|
|
var/fixed_answer
|
|
|
|
/obj/item/toy/eightball/broken/Initialize(mapload)
|
|
. = ..()
|
|
fixed_answer = pick(possible_answers)
|
|
|
|
/obj/item/toy/eightball/broken/get_answer()
|
|
return fixed_answer
|
|
|
|
// Haunted eightball is identical in description and function to toy,
|
|
// except it actually ASKS THE DEAD (wooooo)
|
|
|
|
/obj/item/toy/eightball/haunted
|
|
shake_time = 30 SECONDS
|
|
cooldown_time = 3 MINUTES
|
|
var/last_message
|
|
var/selected_message
|
|
//these kind of store the same thing but one is easier to work with.
|
|
var/list/votes = list()
|
|
var/list/voted = list()
|
|
var/static/list/haunted_answers = list(
|
|
"yes" = list(
|
|
"It is certain",
|
|
"It is decidedly so",
|
|
"Without a doubt",
|
|
"Yes definitely",
|
|
"You may rely on it",
|
|
"As I see it, yes",
|
|
"Most likely",
|
|
"Outlook good",
|
|
"Yes",
|
|
"Signs point to yes"
|
|
),
|
|
"maybe" = list(
|
|
"Reply hazy try again",
|
|
"Ask again later",
|
|
"Better not tell you now",
|
|
"Cannot predict now",
|
|
"Concentrate and ask again"
|
|
),
|
|
"no" = list(
|
|
"Don't count on it",
|
|
"My reply is no",
|
|
"My sources say no",
|
|
"Outlook not so good",
|
|
"Very doubtful"
|
|
)
|
|
)
|
|
|
|
/obj/item/toy/eightball/haunted/Initialize(mapload)
|
|
. = ..()
|
|
for (var/answer in haunted_answers)
|
|
votes[answer] = 0
|
|
SSpoints_of_interest.make_point_of_interest(src)
|
|
become_hearing_sensitive()
|
|
|
|
/obj/item/toy/eightball/haunted/MakeHaunted()
|
|
return FALSE
|
|
|
|
//ATTACK GHOST IGNORING PARENT RETURN VALUE
|
|
/obj/item/toy/eightball/haunted/attack_ghost(mob/user)
|
|
if(!shaking)
|
|
to_chat(user, span_warning("[src] is not currently being shaken."))
|
|
return
|
|
interact(user)
|
|
return ..()
|
|
|
|
/obj/item/toy/eightball/haunted/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, list/message_mods = list(), message_range)
|
|
. = ..()
|
|
last_message = raw_message
|
|
|
|
/obj/item/toy/eightball/haunted/start_shaking(mob/user)
|
|
// notify ghosts that someone's shaking a haunted eightball
|
|
// and inform them of the message, (hopefully a yes/no question)
|
|
selected_message = last_message
|
|
notify_ghosts("[user] is shaking [src], hoping to get an answer to \"[selected_message]\"", source=src, enter_link="<a href=?src=[REF(src)];interact=1>(Click to help)</a>", action=NOTIFY_ATTACK, header = "Magic eightball")
|
|
|
|
/obj/item/toy/eightball/haunted/Topic(href, href_list)
|
|
if(href_list["interact"])
|
|
if(isobserver(usr))
|
|
interact(usr)
|
|
|
|
/obj/item/toy/eightball/haunted/get_answer()
|
|
var/top_amount = 0
|
|
var/top_vote
|
|
|
|
for(var/vote in votes)
|
|
var/amount_of_votes = length(votes[vote])
|
|
if(amount_of_votes > top_amount)
|
|
top_vote = vote
|
|
top_amount = amount_of_votes
|
|
//If one option actually has votes and there's a tie, pick between them 50/50
|
|
else if(top_amount && amount_of_votes == top_amount && prob(50))
|
|
top_vote = vote
|
|
top_amount = amount_of_votes
|
|
|
|
if(isnull(top_vote))
|
|
top_vote = pick(votes)
|
|
|
|
for(var/vote in votes)
|
|
votes[vote] = 0
|
|
|
|
voted.Cut()
|
|
|
|
return top_vote
|
|
|
|
/obj/item/toy/eightball/haunted/ui_state(mob/user)
|
|
return GLOB.observer_state
|
|
|
|
/obj/item/toy/eightball/haunted/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "EightBallVote", name)
|
|
ui.open()
|
|
|
|
/obj/item/toy/eightball/haunted/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["shaking"] = shaking
|
|
data["question"] = selected_message
|
|
|
|
data["answers"] = list()
|
|
for(var/pa in haunted_answers)
|
|
var/list/L = list()
|
|
L["answer"] = pa
|
|
L["amount"] = votes[pa]
|
|
L["selected"] = voted[user.ckey]
|
|
|
|
data["answers"] += list(L)
|
|
return data
|
|
|
|
/obj/item/toy/eightball/haunted/ui_act(action, params)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/mob/user = usr
|
|
|
|
switch(action)
|
|
if("vote")
|
|
var/selected_answer = params["answer"]
|
|
if(!(selected_answer in haunted_answers))
|
|
return
|
|
if(user.ckey in voted)
|
|
return
|
|
else
|
|
votes[selected_answer] += 1
|
|
voted[user.ckey] = selected_answer
|
|
. = TRUE
|