mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-28 07:39:13 +01:00
[MIRROR] Size Toy Fun (#7727)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
co-authored by
Heroman3003
CHOMPStation2
parent
c69cca113f
commit
cbba031a7d
@@ -3,7 +3,7 @@
|
||||
|
||||
/obj/item/device/slow_sizegun
|
||||
name = "gradual size gun"
|
||||
desc = "A highly advanced ray gun, designed for progressive and gradual changing of size."
|
||||
desc = "A highly advanced ray gun, designed for progressive and gradual changing of size. Size trading can be toggled on via alt-clicking."
|
||||
icon = 'icons/obj/gun_vr.dmi'
|
||||
icon_state = "sizegun-old-0"
|
||||
var/base_icon_state = "sizegun-old"
|
||||
@@ -17,6 +17,7 @@
|
||||
var/dorm_size = TRUE
|
||||
var/size_increment = 0.01
|
||||
var/current_target
|
||||
var/trading = 0
|
||||
|
||||
/obj/item/device/slow_sizegun/update_icon()
|
||||
icon_state = "[base_icon_state]-[sizeshift_mode]"
|
||||
@@ -50,6 +51,9 @@
|
||||
if(unresizable)
|
||||
return TRUE
|
||||
|
||||
if(trading == 1 && !(user.resizable))
|
||||
return TRUE
|
||||
|
||||
if(!(target.has_large_resize_bounds()) && (target.size_multiplier >= RESIZE_MAXIMUM) && sizeshift_mode == SIZE_GROW)
|
||||
return TRUE
|
||||
|
||||
@@ -62,6 +66,18 @@
|
||||
if(target.size_multiplier <= RESIZE_MINIMUM_DORMS && sizeshift_mode == SIZE_SHRINK)
|
||||
return TRUE
|
||||
|
||||
if(trading == 1 && !(user.has_large_resize_bounds()) && (user.size_multiplier >= RESIZE_MAXIMUM) && sizeshift_mode == SIZE_GROW)
|
||||
return TRUE
|
||||
|
||||
if(trading == 1 && user.size_multiplier >= RESIZE_MAXIMUM_DORMS && sizeshift_mode == SIZE_GROW)
|
||||
return TRUE
|
||||
|
||||
if(trading == 1 && !(user.has_large_resize_bounds()) && (user.size_multiplier <= RESIZE_MINIMUM) && sizeshift_mode == SIZE_SHRINK)
|
||||
return TRUE
|
||||
|
||||
if(trading == 1 && user.size_multiplier <= RESIZE_MINIMUM_DORMS && sizeshift_mode == SIZE_SHRINK)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/item/device/slow_sizegun/afterattack(atom/target, mob/user, proximity_flag)
|
||||
@@ -81,6 +97,7 @@
|
||||
return
|
||||
|
||||
var/mob/living/L = target
|
||||
var/mob/living/U = user
|
||||
|
||||
if(get_dist(target, user) > beam_range)
|
||||
to_chat(user, span("warning", "You are too far away from \the [target] to affect it. Get closer."))
|
||||
@@ -100,6 +117,9 @@
|
||||
if(!(L.resizable))
|
||||
unresizable = TRUE
|
||||
|
||||
if(trading == 1 && !(user.resizable))
|
||||
unresizable = TRUE
|
||||
|
||||
if(unresizable)
|
||||
to_chat(user, span("warning", "\the [target] is immune to resizing."))
|
||||
|
||||
@@ -119,14 +139,25 @@
|
||||
|
||||
var/active_hand = user.get_active_hand()
|
||||
|
||||
while(!should_stop(target, user, active_hand))
|
||||
stoplag(3)
|
||||
if (trading == 0)
|
||||
while(!should_stop(target, user, active_hand))
|
||||
stoplag(3)
|
||||
|
||||
if(sizeshift_mode == SIZE_SHRINK)
|
||||
L.resize((L.size_multiplier - size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
else if(sizeshift_mode == SIZE_GROW)
|
||||
L.resize((L.size_multiplier + size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
if(sizeshift_mode == SIZE_SHRINK)
|
||||
L.resize((L.size_multiplier - size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
else if(sizeshift_mode == SIZE_GROW)
|
||||
L.resize((L.size_multiplier + size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
|
||||
if (trading == 1)
|
||||
while(!should_stop(target, user, active_hand))
|
||||
stoplag(3)
|
||||
|
||||
if(sizeshift_mode == SIZE_SHRINK)
|
||||
L.resize((L.size_multiplier - size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
U.resize((U.size_multiplier + size_increment), uncapped = U.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
else if(sizeshift_mode == SIZE_GROW)
|
||||
L.resize((L.size_multiplier + size_increment), uncapped = L.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
U.resize((U.size_multiplier - size_increment), uncapped = U.has_large_resize_bounds(), aura_animation = FALSE)
|
||||
busy = FALSE
|
||||
current_target = null
|
||||
|
||||
@@ -219,3 +250,13 @@
|
||||
/obj/item/device/slow_sizegun/proc/color_box(list/box_segments, new_color, new_time)
|
||||
for(var/i in box_segments)
|
||||
animate(i, color = new_color, time = new_time)
|
||||
|
||||
//Alt click to activate size trading
|
||||
|
||||
/obj/item/device/slow_sizegun/AltClick(mob/user)
|
||||
if (trading == 0)
|
||||
trading = 1
|
||||
to_chat(user, span("notice", "\The [src] will now trade your targets size for your own."))
|
||||
else
|
||||
trading = 0
|
||||
to_chat(user, span("notice", "\The [src] will no longer trade your targets size for your own."))
|
||||
|
||||
@@ -26,11 +26,20 @@
|
||||
/obj/item/weapon/gun/energy/sizegun/New()
|
||||
..()
|
||||
verbs += PROC_REF(select_size)
|
||||
verbs += PROC_REF(spin_dial)
|
||||
|
||||
/obj/item/weapon/gun/energy/sizegun/attack_self(mob/user)
|
||||
. = ..()
|
||||
select_size()
|
||||
|
||||
/obj/item/weapon/gun/energy/sizegun/proc/spin_dial()
|
||||
set name = "Spin Size Dial"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
size_set_to = (rand(25,200)) /100
|
||||
usr.visible_message("<span class='warning'>\The [usr] spins the size dial to a random value!</span>","<span class='notice'>You spin the dial to a random value!</span>")
|
||||
|
||||
/obj/item/weapon/gun/energy/sizegun/consume_next_projectile()
|
||||
. = ..()
|
||||
var/obj/item/projectile/beam/sizelaser/G = .
|
||||
|
||||
Reference in New Issue
Block a user