mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 01:24:21 +01:00
The All-In-One Grinder shakes when activated. (#68803)
Fixes https://github.com/tgstation/tgstation/issues/68802
This commit is contained in:
@@ -256,15 +256,30 @@
|
||||
holdingitems -= O
|
||||
qdel(O)
|
||||
|
||||
/obj/machinery/reagentgrinder/proc/shake_for(duration)
|
||||
var/offset = prob(50) ? -2 : 2
|
||||
var/old_pixel_x = pixel_x
|
||||
animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = -1) //start shaking
|
||||
addtimer(CALLBACK(src, .proc/stop_shaking, old_pixel_x), duration)
|
||||
/obj/machinery/reagentgrinder/proc/start_shaking()
|
||||
var/static/list/transforms
|
||||
if(!transforms)
|
||||
var/matrix/M1 = matrix()
|
||||
var/matrix/M2 = matrix()
|
||||
var/matrix/M3 = matrix()
|
||||
var/matrix/M4 = matrix()
|
||||
M1.Translate(-1, 0)
|
||||
M2.Translate(0, 1)
|
||||
M3.Translate(1, 0)
|
||||
M4.Translate(0, -1)
|
||||
transforms = list(M1, M2, M3, M4)
|
||||
animate(src, transform=transforms[1], time=0.4, loop=-1)
|
||||
animate(transform=transforms[2], time=0.2)
|
||||
animate(transform=transforms[3], time=0.4)
|
||||
animate(transform=transforms[4], time=0.6)
|
||||
|
||||
/obj/machinery/reagentgrinder/proc/stop_shaking(old_px)
|
||||
animate(src)
|
||||
pixel_x = old_px
|
||||
/obj/machinery/reagentgrinder/proc/shake_for(duration)
|
||||
start_shaking() //start shaking
|
||||
addtimer(CALLBACK(src, .proc/stop_shaking), duration)
|
||||
|
||||
/obj/machinery/reagentgrinder/proc/stop_shaking()
|
||||
update_appearance()
|
||||
animate(src, transform = matrix())
|
||||
|
||||
/obj/machinery/reagentgrinder/proc/operate_for(time, silent = FALSE, juicing = FALSE)
|
||||
shake_for(time / speed)
|
||||
|
||||
Reference in New Issue
Block a user