diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 3813abe5143..3a7e6dda022 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -100,6 +100,7 @@
emagged = 0 //Ignores if somebody doesn't have card access to that machine.
var/seconds_electrified = 0 //Shock customers like an airlock.
var/shoot_inventory = 0 //Fire items at customers! We're broken!
+ var/shoot_inventory_chance = 2
var/scan_id = 1
var/obj/item/coin/coin
@@ -758,7 +759,7 @@
src.speak(slogan)
src.last_slogan = world.time
- if(src.shoot_inventory && prob(2))
+ if(src.shoot_inventory && prob(shoot_inventory_chance))
src.throw_item()
return
@@ -811,12 +812,12 @@
//Somebody cut an important wire and now we're following a new definition of "pitch."
/obj/machinery/vending/proc/throw_item()
- var/obj/throw_item = null
+ var/obj/item/throw_item = null
var/mob/living/target = locate() in view(7,src)
if(!target)
return 0
- for(var/datum/data/vending_product/R in src.product_records)
+ for(var/datum/data/vending_product/R in shuffle(product_records))
if (R.amount <= 0) //Try to use a record that actually has something to dump.
continue
var/dump_path = R.product_path
@@ -827,9 +828,9 @@
SSvueui.check_uis_for_change(src)
throw_item = new dump_path(src.loc)
break
- if (!throw_item)
- return 0
- spawn(0)
- throw_item.throw_at(target, 16, 3, src)
+ if(!throw_item)
+ return FALSE
+ throw_item.vendor_action(src)
+ INVOKE_ASYNC(throw_item, /atom/movable.proc/throw_at, target, 16, 3, src)
src.visible_message("[src] launches [throw_item.name] at [target.name]!")
- return 1
+ return 1
\ No newline at end of file
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 18a4ec3b383..956f7c149a5 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -877,4 +877,8 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
. += "Throw Force: [throwforce]
"
/obj/item/proc/use_resource(var/mob/user, var/use_amount)
- return
\ No newline at end of file
+ return
+
+// this gets called when the item gets chucked by the vending machine
+/obj/item/proc/vendor_action(var/obj/machinery/vending/V)
+ return
diff --git a/code/game/objects/items/devices/lighting/flashlight.dm b/code/game/objects/items/devices/lighting/flashlight.dm
index 1eea20fa1f4..823747bf291 100644
--- a/code/game/objects/items/devices/lighting/flashlight.dm
+++ b/code/game/objects/items/devices/lighting/flashlight.dm
@@ -51,12 +51,18 @@
if(!isturf(user.loc))
to_chat(user, "You cannot turn the light on while in this [user.loc].") //To prevent some lighting anomalities.)
return 0
+ toggle()
+ user.update_action_buttons()
+ return 1
+
+/obj/item/device/flashlight/proc/toggle()
on = !on
if(on && activation_sound)
playsound(src.loc, activation_sound, 75, 1)
update_icon()
- user.update_action_buttons()
- return 1
+
+/obj/item/device/flashlight/vendor_action(var/obj/machinery/vending/V)
+ toggle()
/obj/item/device/flashlight/examine(mob/user, distance)
. = ..()
diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm
index bbbe3f88e32..378a51a77d2 100644
--- a/code/game/objects/items/weapons/cigs_lighters.dm
+++ b/code/game/objects/items/weapons/cigs_lighters.dm
@@ -783,9 +783,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
base_state = icon_state
if(user.r_hand == src || user.l_hand == src)
if(!lit)
- lit = TRUE
- update_icon()
- playsound(src.loc, pick(activation_sound), 75, 1)
+ handle_lighting()
if(istype(src, /obj/item/flame/lighter/zippo))
if(last_open <= world.time - 20) //Spam limiter.
last_open = world.time
@@ -806,8 +804,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
if(last_open <= world.time - 20) //Spam limiter.
last_open = world.time
user.visible_message(SPAN_DANGER("After a few attempts, [user] manages to light \the [src], they however burn their finger in the process."), range = 3)
- set_light(flame_light_power, flame_light_range, l_color = flame_light_color)
- START_PROCESSING(SSprocessing, src)
else
lit = FALSE
update_icon()
@@ -825,6 +821,15 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return ..()
return
+/obj/item/flame/lighter/proc/handle_lighting()
+ lit = TRUE
+ update_icon()
+ playsound(src.loc, pick(activation_sound), 75, 1)
+ set_light(flame_light_power, flame_light_range, l_color = flame_light_color)
+ START_PROCESSING(SSprocessing, src)
+
+/obj/item/flame/lighter/vendor_action(var/obj/machinery/vending/V)
+ handle_lighting()
/obj/item/flame/lighter/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!istype(M, /mob))
diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm
index 7f740f9de09..6c49168197d 100644
--- a/code/game/objects/items/weapons/grenades/grenade.dm
+++ b/code/game/objects/items/weapons/grenades/grenade.dm
@@ -59,21 +59,21 @@
return
-/obj/item/grenade/proc/activate(mob/user as mob)
+/obj/item/grenade/proc/activate(var/atom/user)
if(active)
return
- if(user)
- msg_admin_attack("[user.name] ([user.ckey]) primed \a [fake ? ("fake ") : ("")][src] (JMP)",ckey=key_name(user))
+ if(ismob(user))
+ var/mob/M = user
+ msg_admin_attack("[M.name] ([M.ckey]) primed \a [fake ? ("fake ") : ("")][src] (JMP)",ckey=key_name(M))
+ else
+ message_admins("[user.name] primed \a [fake ? ("fake ") : ("")][src] (JMP)")
icon_state = initial(icon_state) + "_active"
active = 1
playsound(loc, activation_sound, 75, 1, -3)
- spawn(det_time)
- prime()
- return
-
+ addtimer(CALLBACK(src, .proc/prime), det_time)
/obj/item/grenade/proc/prime()
var/turf/T = get_turf(src)
@@ -84,3 +84,6 @@
walk(src, null, null)
..()
return
+
+/obj/item/grenade/vendor_action(var/obj/machinery/vending/V)
+ activate(V)
\ No newline at end of file
diff --git a/html/changelogs/geeves-vendor_throwing.yml b/html/changelogs/geeves-vendor_throwing.yml
new file mode 100644
index 00000000000..25426418036
--- /dev/null
+++ b/html/changelogs/geeves-vendor_throwing.yml
@@ -0,0 +1,6 @@
+author: Geeves
+
+delete-after: True
+
+changes:
+ - tweak: "Tweaked how vending machines act when they throw things at you. Should be a bit more spicy now."
\ No newline at end of file