mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
59 lines
1.9 KiB
Plaintext
59 lines
1.9 KiB
Plaintext
/obj/item/shield_diffuser
|
|
name = "portable shield diffuser"
|
|
desc = "A small handheld device designed to disrupt energy barriers."
|
|
description_info = "This device disrupts shields on directly adjacent tiles (in a + shaped pattern), in a similar way the floor mounted variant does. It is, however, portable and run by an internal battery. Can be recharged with a regular recharger."
|
|
icon = 'icons/obj/machines/shielding.dmi'
|
|
icon_state = "hdiffuser_off"
|
|
origin_tech = list(TECH_MAGNET = 5, TECH_POWER = 5, TECH_ILLEGAL = 2)
|
|
var/obj/item/cell/device/cell
|
|
var/enabled = 0
|
|
|
|
|
|
/obj/item/shield_diffuser/Initialize(mapload)
|
|
. = ..()
|
|
cell = new(src)
|
|
|
|
/obj/item/shield_diffuser/Destroy()
|
|
QDEL_NULL(cell)
|
|
if(enabled)
|
|
STOP_PROCESSING(SSobj, src)
|
|
. = ..()
|
|
|
|
/obj/item/shield_diffuser/get_cell()
|
|
return cell
|
|
|
|
/obj/item/shield_diffuser/process()
|
|
if(!enabled)
|
|
return PROCESS_KILL
|
|
|
|
for(var/direction in GLOB.cardinal)
|
|
var/turf/simulated/shielded_tile = get_step(get_turf(src), direction)
|
|
for(var/obj/effect/shield/S in shielded_tile)
|
|
// 10kJ per pulse, but gap in the shield lasts for longer than regular diffusers.
|
|
if(istype(S) && !S.diffused_for && !S.disabled_for && cell.checked_use(10 KILOWATTS * CELLRATE))
|
|
S.diffuse(20)
|
|
// Legacy shield support
|
|
for(var/obj/effect/energy_field/S in shielded_tile)
|
|
if(istype(S) && cell.checked_use(10 KILOWATTS * CELLRATE))
|
|
qdel(S)
|
|
|
|
/obj/item/shield_diffuser/update_icon()
|
|
if(enabled)
|
|
icon_state = "hdiffuser_on"
|
|
else
|
|
icon_state = "hdiffuser_off"
|
|
|
|
/obj/item/shield_diffuser/attack_self(mob/user)
|
|
enabled = !enabled
|
|
update_icon()
|
|
if(enabled)
|
|
START_PROCESSING(SSobj, src)
|
|
else
|
|
STOP_PROCESSING(SSobj, src)
|
|
to_chat(user, "You turn \the [src] [enabled ? "on" : "off"].")
|
|
|
|
/obj/item/shield_diffuser/examine(mob/user)
|
|
. = ..()
|
|
. += "The charge meter reads [cell ? cell.percent() : 0]%"
|
|
. += "It is [enabled ? "enabled" : "disabled"]."
|