mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #11498 from VOREStation/upstream-merge-8240
[MIRROR] Vending machine throwing tweaks
This commit is contained in:
committed by
Chompstation Bot
parent
145f8172f4
commit
362a58386e
@@ -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 CELLS 8 //Amount of cells per row/column in grid
|
||||||
#define CELLSIZE (world.icon_size/CELLS) //Size of a cell in pixels
|
#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.
|
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'
|
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"]
|
W.pixel_y = (CELLSIZE * (0.5 + cell_y)) - W.center_of_mass["y"]
|
||||||
|
|
||||||
#undef CELLS
|
#undef CELLS
|
||||||
#undef CELLSIZE
|
#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
|
||||||
|
|||||||
@@ -112,3 +112,6 @@
|
|||||||
walk(src, null, null)
|
walk(src, null, null)
|
||||||
..()
|
..()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/vendor_action(var/obj/machinery/vending/V)
|
||||||
|
activate(V)
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
emagged = 0 //Ignores if somebody doesn't have card access to that machine.
|
emagged = 0 //Ignores if somebody doesn't have card access to that machine.
|
||||||
var/seconds_electrified = 0 //Shock customers like an airlock.
|
var/seconds_electrified = 0 //Shock customers like an airlock.
|
||||||
var/shoot_inventory = 0 //Fire items at customers! We're broken!
|
var/shoot_inventory = 0 //Fire items at customers! We're broken!
|
||||||
|
var/shoot_inventory_chance = 1
|
||||||
|
|
||||||
var/scan_id = 1
|
var/scan_id = 1
|
||||||
var/obj/item/weapon/coin/coin
|
var/obj/item/weapon/coin/coin
|
||||||
@@ -677,7 +678,7 @@ GLOBAL_LIST_EMPTY(vending_products)
|
|||||||
speak(slogan)
|
speak(slogan)
|
||||||
last_slogan = world.time
|
last_slogan = world.time
|
||||||
|
|
||||||
if(shoot_inventory && prob(2))
|
if(shoot_inventory && prob(shoot_inventory_chance))
|
||||||
throw_item()
|
throw_item()
|
||||||
|
|
||||||
return
|
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."
|
//Somebody cut an important wire and now we're following a new definition of "pitch."
|
||||||
/obj/machinery/vending/proc/throw_item()
|
/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)
|
var/mob/living/target = locate() in view(7,src)
|
||||||
if(!target)
|
if(!target)
|
||||||
return 0
|
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)
|
throw_item = R.get_product(loc)
|
||||||
if(!throw_item)
|
if(!throw_item)
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
if(!throw_item)
|
if(!throw_item)
|
||||||
return 0
|
return FALSE
|
||||||
spawn(0)
|
throw_item.vendor_action(src)
|
||||||
throw_item.throw_at(target, 16, 3, 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>")
|
visible_message("<span class='warning'>\The [src] launches \a [throw_item] at \the [target]!</span>")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user