Vending machine throwing tweaks

This commit is contained in:
Cerebulon
2021-08-23 18:30:39 +01:00
parent 17cbd9e7fb
commit 6b73ba2fe1
3 changed files with 15 additions and 7 deletions

View File

@@ -60,6 +60,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 = 1
var/scan_id = 1
var/obj/item/weapon/coin/coin
@@ -662,7 +663,7 @@ GLOBAL_LIST_EMPTY(vending_products)
speak(slogan)
last_slogan = world.time
if(shoot_inventory && prob(2))
if(shoot_inventory && prob(shoot_inventory_chance))
throw_item()
return
@@ -702,20 +703,20 @@ GLOBAL_LIST_EMPTY(vending_products)
//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/stored_item/vending_product/R in product_records)
for(var/datum/stored_item/vending_product/R in shuffle(product_records))
throw_item = R.get_product(loc)
if(!throw_item)
continue
break
if(!throw_item)
return 0
spawn(0)
throw_item.throw_at(target, 16, 3, src)
return FALSE
throw_item.vendor_action(src)
INVOKE_ASYNC(throw_item, /atom/movable.proc/throw_at, target, rand(3, 10), rand(1, 3), src)
visible_message("<span class='warning'>\The [src] launches \a [throw_item] at \the [target]!</span>")
return 1