mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
Adds hourglass (#44384)
* Adds hourglass * Proper icon and animation. * Makes throwing not break animate. * Adds hourglass to library game vendor.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
speed /= segments
|
||||
|
||||
animate(src, transform = matrices[1], time = speed, loops)
|
||||
animate(src, transform = matrices[1], time = speed, loops , flags = ANIMATION_PARALLEL)
|
||||
for(var/i in 2 to segments) //2 because 1 is covered above
|
||||
animate(transform = matrices[i], time = speed)
|
||||
//doesn't have an object argument because this is "Stacking" with the animate call above
|
||||
|
||||
@@ -63,6 +63,12 @@
|
||||
/obj/effect/countdown/ex_act(severity, target) //immune to explosions
|
||||
return
|
||||
|
||||
/obj/effect/countdown/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/countdown/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/countdown/syndicatebomb
|
||||
name = "syndicate bomb countdown"
|
||||
|
||||
@@ -154,8 +160,14 @@
|
||||
var/time_left = max(0, (A.death_time - world.time) / 10)
|
||||
return round(time_left)
|
||||
|
||||
/obj/effect/countdown/singularity_pull()
|
||||
return
|
||||
/obj/effect/countdown/hourglass
|
||||
name = "hourglass countdown"
|
||||
|
||||
/obj/effect/countdown/hourglass/get_value()
|
||||
var/obj/item/hourglass/H = attached_to
|
||||
if(!istype(H))
|
||||
return
|
||||
else
|
||||
var/time_left = max(0, (H.finish_time - world.time) / 10)
|
||||
return round(time_left)
|
||||
|
||||
/obj/effect/countdown/singularity_act()
|
||||
return
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#define HOURGLASS_STATES 7 //Remember to update if you change the sprite
|
||||
|
||||
/obj/item/hourglass
|
||||
name = "hourglass"
|
||||
desc = "Nanotrasen patented gravity invariant hourglass. Guaranteed to flow perfectly under any conditions."
|
||||
var/obj/effect/countdown/hourglass/countdown
|
||||
var/time = 1 MINUTES
|
||||
var/finish_time //So countdown doesn't need to fiddle with timers
|
||||
var/timing_id //if present we're timing
|
||||
var/hand_activated = TRUE
|
||||
icon = 'icons/obj/hourglass.dmi'
|
||||
icon_state = "hourglass_idle"
|
||||
|
||||
/obj/item/hourglass/Initialize(mapload)
|
||||
. = ..()
|
||||
countdown = new(src)
|
||||
|
||||
/obj/item/hourglass/attack_self(mob/user)
|
||||
. = ..()
|
||||
if(hand_activated)
|
||||
toggle(user)
|
||||
|
||||
/obj/item/hourglass/proc/toggle(mob/user)
|
||||
if(!timing_id)
|
||||
to_chat(user,"<span class='notice'>You flip the [src]</span>")
|
||||
start()
|
||||
flick("hourglass_flip",src)
|
||||
else
|
||||
to_chat(user,"<span class='notice'>You stop the [src].</span>") //Sand magically flows back because that's more convinient to use.
|
||||
stop()
|
||||
|
||||
/obj/item/hourglass/update_icon()
|
||||
if(timing_id)
|
||||
icon_state = "hourglass_active"
|
||||
else
|
||||
icon_state = "hourglass_idle"
|
||||
|
||||
/obj/item/hourglass/proc/start()
|
||||
finish_time = world.time + time
|
||||
timing_id = addtimer(CALLBACK(src, .proc/finish), time, TIMER_STOPPABLE)
|
||||
countdown.start()
|
||||
timing_animation()
|
||||
|
||||
/obj/item/hourglass/proc/timing_animation()
|
||||
var/step_time = time / HOURGLASS_STATES
|
||||
animate(src, time = step_time, icon_state = "hourglass_1")
|
||||
for(var/i in 2 to HOURGLASS_STATES)
|
||||
animate(time = step_time, icon_state = "hourglass_[i]")
|
||||
|
||||
/obj/item/hourglass/proc/stop()
|
||||
if(timing_id)
|
||||
deltimer(timing_id)
|
||||
timing_id = null
|
||||
countdown.stop()
|
||||
finish_time = null
|
||||
animate(src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/hourglass/proc/finish()
|
||||
visible_message("<span class='notice'>[src] stops.</span>")
|
||||
stop()
|
||||
|
||||
/obj/item/hourglass/Destroy()
|
||||
QDEL_NULL(countdown)
|
||||
. = ..()
|
||||
|
||||
//Admin events zone.
|
||||
/obj/item/hourglass/admin
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
anchored = TRUE
|
||||
hand_activated = FALSE
|
||||
|
||||
/obj/item/hourglass/admin/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(user.client && user.client.holder)
|
||||
toggle(user)
|
||||
|
||||
/obj/item/hourglass/admin/attack_ghost(mob/user)
|
||||
if(user.client && user.client.holder)
|
||||
toggle(user)
|
||||
|
||||
#undef HOURGLASS_STATES
|
||||
@@ -6,7 +6,8 @@
|
||||
products = list(/obj/item/toy/cards/deck = 5,
|
||||
/obj/item/storage/pill_bottle/dice = 10,
|
||||
/obj/item/toy/cards/deck/cas = 3,
|
||||
/obj/item/toy/cards/deck/cas/black = 3)
|
||||
/obj/item/toy/cards/deck/cas/black = 3,
|
||||
/obj/item/hourglass = 2)
|
||||
contraband = list(/obj/item/dice/fudge = 9)
|
||||
refill_canister = /obj/item/vending_refill/games
|
||||
default_price = 10
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -836,6 +836,7 @@
|
||||
#include "code\game\objects\items\holosign_creator.dm"
|
||||
#include "code\game\objects\items\holy_weapons.dm"
|
||||
#include "code\game\objects\items\hot_potato.dm"
|
||||
#include "code\game\objects\items\hourglass.dm"
|
||||
#include "code\game\objects\items\inducer.dm"
|
||||
#include "code\game\objects\items\kitchen.dm"
|
||||
#include "code\game\objects\items\latexballoon.dm"
|
||||
|
||||
Reference in New Issue
Block a user