diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 3fb73c4848..5956e6af45 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -954,6 +954,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. #define CELLS 8 //Amount of cells per row/column in grid #define CELLSIZE (world.icon_size/CELLS) //Size of a cell in pixels + /* Automatic alignment of items to an invisible grid, defined by CELLS and CELLSIZE. Since the grid will be shifted to own a cell that is perfectly centered on the turf, we end up with two 'cell halves' @@ -989,4 +990,8 @@ Note: This proc can be overwritten to allow for different types of auto-alignmen W.pixel_y = (CELLSIZE * (0.5 + cell_y)) - W.center_of_mass["y"] #undef CELLS -#undef CELLSIZE \ No newline at end of file +#undef CELLSIZE + +// 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/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index 7ac049a774..209e47b253 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -112,3 +112,6 @@ walk(src, null, null) ..() return + +/obj/item/weapon/grenade/vendor_action(var/obj/machinery/vending/V) + activate(V) \ No newline at end of file diff --git a/code/modules/economy/vending.dm b/code/modules/economy/vending.dm index ddd4520bdf..09a9b480aa 100644 --- a/code/modules/economy/vending.dm +++ b/code/modules/economy/vending.dm @@ -65,6 +65,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 @@ -677,7 +678,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 @@ -717,20 +718,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("\The [src] launches \a [throw_item] at \the [target]!") return 1