mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 12:02:31 +01:00
Don't let the large file size scare you, it's just mostly splitting stuff into contained sprites and putting them in the correct place. Anyway, resprites most non-resprited devices in devices.dmi, and puts them in contained sprites. Also puts any related /obj/item/device into contained sprites too. That's basically the long and short of it.
158 lines
4.3 KiB
Plaintext
158 lines
4.3 KiB
Plaintext
/obj/item/device/chameleon
|
|
name = "chameleon projector"
|
|
desc = "A strange device."
|
|
desc_antag = "This device can let you disguise as common objects. Click on an object with this in your active hand to scan it, then activate it to use it in your hand."
|
|
icon = 'icons/obj/item/device/chameleon.dmi'
|
|
icon_state = "shield0"
|
|
item_state = "electronic"
|
|
obj_flags = OBJ_FLAG_CONDUCTABLE
|
|
slot_flags = SLOT_BELT
|
|
throwforce = 5
|
|
throw_speed = 1
|
|
throw_range = 5
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
origin_tech = list(TECH_ILLEGAL = 4, TECH_MAGNET = 4)
|
|
var/can_use = TRUE
|
|
var/obj/effect/dummy/chameleon/active_dummy = null
|
|
var/saved_item = /obj/item/trash/cigbutt
|
|
var/saved_icon = 'icons/obj/clothing/masks.dmi'
|
|
var/saved_icon_state = "cigbutt"
|
|
var/saved_overlays
|
|
|
|
/obj/item/device/chameleon/dropped()
|
|
disrupt()
|
|
..()
|
|
|
|
/obj/item/device/chameleon/equipped()
|
|
disrupt()
|
|
..()
|
|
|
|
/obj/item/device/chameleon/attack_self()
|
|
toggle()
|
|
|
|
/obj/item/device/chameleon/afterattack(atom/target, mob/user , proximity)
|
|
if(!proximity)
|
|
return
|
|
if(!active_dummy)
|
|
if(istype(target,/obj/item) && !istype(target, /obj/item/disk/nuclear))
|
|
playsound(get_turf(src), 'sound/weapons/flash.ogg', 100, 1, -6)
|
|
to_chat(user, SPAN_NOTICE("Scanned [target]."))
|
|
saved_item = target.type
|
|
saved_icon = target.icon
|
|
saved_icon_state = target.icon_state
|
|
saved_overlays = target.overlays
|
|
|
|
/obj/item/device/chameleon/proc/toggle()
|
|
if(!can_use || !saved_item)
|
|
return
|
|
if(active_dummy)
|
|
eject_all()
|
|
playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6)
|
|
qdel(active_dummy)
|
|
active_dummy = null
|
|
to_chat(usr, SPAN_NOTICE("You deactivate \the [src]."))
|
|
var/obj/effect/overlay/T = new /obj/effect/overlay(get_turf(src))
|
|
T.icon = 'icons/effects/effects.dmi'
|
|
flick("emppulse",T)
|
|
QDEL_IN(T, 8)
|
|
else
|
|
playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6)
|
|
var/obj/O = new saved_item(src)
|
|
if(!O)
|
|
return
|
|
var/obj/effect/dummy/chameleon/C = new /obj/effect/dummy/chameleon(usr.loc)
|
|
C.activate(O, usr, saved_icon, saved_icon_state, saved_overlays, src)
|
|
qdel(O)
|
|
to_chat(usr, SPAN_NOTICE("You activate \the [src]."))
|
|
var/obj/effect/overlay/T = new/obj/effect/overlay(get_turf(src))
|
|
T.icon = 'icons/effects/effects.dmi'
|
|
flick("emppulse",T)
|
|
QDEL_IN(T, 8)
|
|
|
|
/obj/item/device/chameleon/proc/disrupt(var/delete_dummy = 1)
|
|
if(active_dummy)
|
|
spark(src, 5)
|
|
eject_all()
|
|
if(delete_dummy)
|
|
qdel(active_dummy)
|
|
active_dummy = null
|
|
can_use = 0
|
|
spawn(50) can_use = 1
|
|
|
|
/obj/item/device/chameleon/proc/eject_all()
|
|
for(var/atom/movable/A in active_dummy)
|
|
A.forceMove(active_dummy.loc)
|
|
if(ismob(A))
|
|
var/mob/M = A
|
|
M.reset_view(null)
|
|
|
|
/obj/effect/dummy/chameleon
|
|
name = ""
|
|
desc = ""
|
|
density = FALSE
|
|
anchored = TRUE
|
|
mouse_opacity = MOUSE_OPACITY_ICON
|
|
var/can_move = TRUE
|
|
var/obj/item/device/chameleon/master = null
|
|
|
|
/obj/effect/dummy/chameleon/proc/activate(var/obj/O, var/mob/M, new_icon, new_iconstate, new_overlays, var/obj/item/device/chameleon/C)
|
|
name = O.name
|
|
desc = O.desc
|
|
icon = new_icon
|
|
icon_state = new_iconstate
|
|
overlays = new_overlays
|
|
set_dir(O.dir)
|
|
M.forceMove(src)
|
|
master = C
|
|
master.active_dummy = src
|
|
|
|
/obj/effect/dummy/chameleon/attackby()
|
|
for(var/mob/M in src)
|
|
to_chat(M, SPAN_WARNING("Your chameleon-projector deactivates."))
|
|
master.disrupt()
|
|
|
|
/obj/effect/dummy/chameleon/attack_hand()
|
|
for(var/mob/M in src)
|
|
to_chat(M, SPAN_WARNING("Your chameleon-projector deactivates."))
|
|
master.disrupt()
|
|
|
|
/obj/effect/dummy/chameleon/ex_act(var/severity = 2.0)
|
|
for(var/mob/M in src)
|
|
to_chat(M, SPAN_WARNING("Your chameleon-projector deactivates."))
|
|
master.disrupt()
|
|
|
|
/obj/effect/dummy/chameleon/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit)
|
|
. = ..()
|
|
if(. != BULLET_ACT_HIT)
|
|
return .
|
|
|
|
for(var/mob/M in src)
|
|
to_chat(M, SPAN_WARNING("Your chameleon-projector deactivates."))
|
|
master.disrupt()
|
|
|
|
/obj/effect/dummy/chameleon/relaymove(mob/living/user, direction)
|
|
. = ..()
|
|
|
|
if(istype(loc, /turf/space))
|
|
return //No magical space movement!
|
|
|
|
if(can_move)
|
|
can_move = 0
|
|
switch(user.bodytemperature)
|
|
if(300 to INFINITY)
|
|
spawn(10) can_move = 1
|
|
if(295 to 300)
|
|
spawn(13) can_move = 1
|
|
if(280 to 295)
|
|
spawn(16) can_move = 1
|
|
if(260 to 280)
|
|
spawn(20) can_move = 1
|
|
else
|
|
spawn(25) can_move = 1
|
|
step(src, direction)
|
|
return
|
|
|
|
/obj/effect/dummy/chameleon/Destroy()
|
|
master.disrupt(0)
|
|
return ..()
|