mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 23:58:07 +01:00
[MIRROR] Cursed Slot Machine Fixes [MDB IGNORE] (#23420)
* Cursed Slot Machine Fixes (#77989) <!-- 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 A lot of these were stuff I did in response to reviews but apparently didn't test extremely thoroughly. My bad. * The proc for checking if the machine is in use is split out into its own thing for clarity, and for potential reuse. * The signal is no longer fucked up so you can actually get more than one curse out of the slot machine as intended. * Admin heals (and admin heals only) can remove the status effect. This is just in case someone fucks up a variable when running an event and wants to quickly heal some people while they varedit it to actually be a proper event. * Some nice code stuff while I was there, we don't need to be typecasting to human anymore so it's nice to fix that. <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game Fixes are good. <!-- 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. --> ## 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: The Cursed Slot Machine should now actually give you more than one pull. /🆑 <!-- 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. --> * Cursed Slot Machine Fixes --------- Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
@@ -34,36 +34,18 @@
|
||||
if(!ishuman(user))
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/human_user = user
|
||||
|
||||
if(in_use)
|
||||
balloon_alert(human_user, "already spinning!")
|
||||
return
|
||||
|
||||
if(!COOLDOWN_FINISHED(src, spin_cooldown))
|
||||
to_chat(human_user, span_danger("The machine doesn't engage. You get the compulsion to try again in a few seconds."))
|
||||
return
|
||||
|
||||
in_use = TRUE
|
||||
|
||||
var/signal_value = SEND_SIGNAL(human_user, COMSIG_CURSED_SLOT_MACHINE_USE, max_curse_amount)
|
||||
|
||||
if(signal_value & SLOT_MACHINE_USE_POSTPONE)
|
||||
return
|
||||
|
||||
if(signal_value & SLOT_MACHINE_USE_CANCEL) // failsafe in case we don't want to let the machine be used for some reason (like if we're maxed out on curses but not getting gibbed)
|
||||
say("We're sorry, but we can no longer serve you at this establishment.")
|
||||
if(!check_and_set_usage(user))
|
||||
return
|
||||
|
||||
user.visible_message(
|
||||
span_warning("[human_user] pulls [src]'s lever with a glint in [user.p_their()] eyes!"),
|
||||
span_warning("[user] pulls [src]'s lever with a glint in [user.p_their()] eyes!"),
|
||||
span_warning("You feel a draining as you pull the lever, but you know it'll be worth it."),
|
||||
)
|
||||
|
||||
icon_screen = "slots_screen_working"
|
||||
update_appearance()
|
||||
playsound(src, 'sound/lavaland/cursed_slot_machine.ogg', 50, FALSE)
|
||||
addtimer(CALLBACK(src, PROC_REF(determine_victor), human_user), 5 SECONDS)
|
||||
addtimer(CALLBACK(src, PROC_REF(determine_victor), user), 5 SECONDS)
|
||||
|
||||
/obj/structure/cursed_slot_machine/update_overlays()
|
||||
. = ..()
|
||||
@@ -71,11 +53,32 @@
|
||||
. += mutable_appearance(icon, overlay_state)
|
||||
. += emissive_appearance(icon, overlay_state, src)
|
||||
|
||||
/obj/structure/cursed_slot_machine/proc/determine_victor(mob/living/user)
|
||||
/// Validates that the user can use the cursed slot machine. User is the person using the slot machine. Returns TRUE if we can, FALSE otherwise.
|
||||
/obj/structure/cursed_slot_machine/proc/check_and_set_usage(mob/living/carbon/human/user)
|
||||
if(in_use)
|
||||
balloon_alert_to_viewers("already spinning!")
|
||||
return FALSE
|
||||
|
||||
var/signal_value = SEND_SIGNAL(user, COMSIG_CURSED_SLOT_MACHINE_USE, max_curse_amount)
|
||||
|
||||
if(!COOLDOWN_FINISHED(src, spin_cooldown) || (signal_value & SLOT_MACHINE_USE_POSTPONE))
|
||||
to_chat(user, span_danger("The machine doesn't engage. You get the compulsion to try again in a few seconds."))
|
||||
return FALSE
|
||||
|
||||
if(signal_value & SLOT_MACHINE_USE_CANCEL) // failsafe in case we don't want to let the machine be used for some reason (like if we're maxed out on curses but not getting gibbed)
|
||||
say("We're sorry, but we can no longer serve you at this establishment.")
|
||||
return FALSE
|
||||
|
||||
in_use = TRUE
|
||||
return TRUE
|
||||
|
||||
/obj/structure/cursed_slot_machine/proc/determine_victor(mob/living/carbon/human/user)
|
||||
icon_screen = initial(icon_screen)
|
||||
update_appearance()
|
||||
|
||||
in_use = FALSE
|
||||
COOLDOWN_START(src, spin_cooldown, cooldown_length)
|
||||
|
||||
if(!prob(win_prob))
|
||||
if(status_effect_on_roll && isnull(user.has_status_effect(/datum/status_effect/grouped/cursed)))
|
||||
user.apply_status_effect(/datum/status_effect/grouped/cursed)
|
||||
|
||||
Reference in New Issue
Block a user