Skip to content

Commit

Permalink
[MIRROR] Fixes arcade cabinets being un-hittable (#1105)
Browse files Browse the repository at this point in the history
* Fixes arcade cabinets being un-hittable (#81620)

## About The Pull Request

What if we put all of our item based interactions in the same function
that attacks are handled? Great idea, I'm sure no one will ever forget
to call parent

Fixes that. 

Also cleans up ticket code. 

Also renames the base type so mappers stop mapping it in. 

## Changelog

:cl: Melbert
fix: You can now take our your anger upon arcade cabinets upon losing
(they can be hit again)
/:cl:

* Fixes arcade cabinets being un-hittable

---------

Co-authored-by: MrMelbert <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Feb 23, 2024
1 parent 2834330 commit c7dfecd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
33 changes: 18 additions & 15 deletions code/game/machinery/computer/arcade/arcade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
/obj/item/storage/box/party_poppers = 2))

/obj/machinery/computer/arcade
name = "random arcade"
desc = "random arcade machine"
name = "\proper the arcade cabinet which shouldn't exist"
desc = "This arcade cabinet has no games installed, and in fact, should not exist. \
Report the location of this machine to your local diety."
icon_state = "arcade"
icon_keyboard = null
icon_screen = "invaders"
Expand Down Expand Up @@ -136,19 +137,21 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
new empprize(loc)
explosion(src, devastation_range = -1, light_impact_range = 1+num_of_prizes, flame_range = 1+num_of_prizes)

/obj/machinery/computer/arcade/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/stack/arcadeticket))
var/obj/item/stack/arcadeticket/T = O
var/amount = T.get_amount()
if(amount <2)
to_chat(user, span_warning("You need 2 tickets to claim a prize!"))
return
prizevend(user)
T.pay_tickets()
T.update_appearance()
O = T
to_chat(user, span_notice("You turn in 2 tickets to the [src] and claim a prize!"))
return
/obj/machinery/computer/arcade/item_interaction(mob/living/user, obj/item/tool, list/modifiers, is_right_clicking)
. = ..()
if(. & ITEM_INTERACT_ANY_BLOCKER)
return .
if(!istype(tool, /obj/item/stack/arcadeticket))
return .

var/obj/item/stack/arcadeticket/tickets = tool
if(!tickets.use(2))
balloon_alert(user, "need 2 tickets!")
return ITEM_INTERACT_BLOCKING

prizevend(user)
balloon_alert(user, "prize claimed")
return ITEM_INTERACT_SUCCESS

// ** BATTLE ** //
/obj/machinery/computer/arcade/battle
Expand Down
12 changes: 1 addition & 11 deletions code/game/objects/items/stacks/tickets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
max_amount = 30
merge_type = /obj/item/stack/arcadeticket

/obj/item/stack/arcadeticket/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
. = ..()
update_appearance()

/obj/item/stack/arcadeticket/update_icon_state()
. = ..()
var/amount = get_amount()
switch(amount)
switch(get_amount())
if(12 to INFINITY)
icon_state = "arcade-ticket_4"
if(6 to 12)
Expand All @@ -25,10 +20,5 @@
else
icon_state = "arcade-ticket"

/obj/item/stack/arcadeticket/proc/pay_tickets()
amount -= 2
if (amount == 0)
qdel(src)

/obj/item/stack/arcadeticket/thirty
amount = 30

0 comments on commit c7dfecd

Please sign in to comment.