mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Mecha omni-shield generator
This commit is contained in:
97
code/game/mecha/equipment/tools/shield_omni.dm
Normal file
97
code/game/mecha/equipment/tools/shield_omni.dm
Normal file
@@ -0,0 +1,97 @@
|
||||
#define OMNI_SHIELD_DRAIN 30
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield
|
||||
name = "omni shield"
|
||||
desc = "A shield generator that forms an ennlosing, omnidirectional shield around the exosuit."
|
||||
icon_state = "shield"
|
||||
origin_tech = list(TECH_PHORON = 3, TECH_MAGNET = 6, TECH_ILLEGAL = 4)
|
||||
equip_cooldown = 5
|
||||
energy_drain = OMNI_SHIELD_DRAIN
|
||||
range = 0
|
||||
|
||||
var/obj/item/shield_projector/shields = null
|
||||
var/shield_type = /obj/item/shield_projector/rectangle/mecha
|
||||
|
||||
equip_type = EQUIP_HULL
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/critfail()
|
||||
..()
|
||||
shields.adjust_health(-200)
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/Destroy()
|
||||
QDEL_NULL(shields)
|
||||
..()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/attach(obj/mecha/M as obj)
|
||||
. = ..()
|
||||
if(chassis)
|
||||
shields = new shield_type(chassis)
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/detach()
|
||||
if(chassis)
|
||||
QDEL_NULL(shields)
|
||||
. = ..()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/handle_movement_action()
|
||||
if(chassis && shields)
|
||||
shields.update_shield_positions()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/proc/toggle_shield()
|
||||
..()
|
||||
if(shields)
|
||||
shields.set_on(!shields.active)
|
||||
if(shields.active)
|
||||
set_ready_state(0)
|
||||
log_message("Activated.")
|
||||
else
|
||||
set_ready_state(1)
|
||||
log_message("Deactivated.")
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/Topic(href, href_list)
|
||||
..()
|
||||
if(href_list["toggle_omnishield"])
|
||||
toggle_shield()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/omni_shield/get_equip_info()
|
||||
if(!chassis) return
|
||||
return "<span style=\"color:[equip_ready?"#0f0":"#f00"];\">*</span> [src.name] - <a href='?src=\ref[src];toggle_omnishield=1'>[shields?.active?"Dea":"A"]ctivate</a>"
|
||||
|
||||
|
||||
////// The shield projector object
|
||||
/obj/item/shield_projector/rectangle/mecha
|
||||
shield_health = 200
|
||||
max_shield_health = 200
|
||||
shield_regen_delay = 10 SECONDS
|
||||
shield_regen_amount = 10
|
||||
size_x = 1
|
||||
size_y = 1
|
||||
|
||||
var/shift_x = 0
|
||||
var/shift_y = 0
|
||||
|
||||
var/obj/mecha/my_mech = null
|
||||
|
||||
/obj/item/shield_projector/rectangle/mecha/Initialize()
|
||||
. = ..()
|
||||
my_mech = loc
|
||||
GLOB.moved_event.register(my_mech, src, /obj/item/shield_projector/proc/update_shield_positions)
|
||||
|
||||
/obj/item/shield_projector/rectangle/mecha/Destroy()
|
||||
GLOB.moved_event.unregister(my_mech, src, /obj/item/shield_projector/proc/update_shield_positions)
|
||||
my_mech = null
|
||||
..()
|
||||
|
||||
/obj/item/shield_projector/rectangle/mecha/create_shield()
|
||||
. = ..()
|
||||
if(shift_x || shift_y)
|
||||
var/obj/effect/directional_shield/newshield = active_shields[active_shields.len]
|
||||
newshield.pixel_x = shift_x
|
||||
newshield.pixel_y = shift_y
|
||||
|
||||
/obj/item/shield_projector/rectangle/mecha/adjust_health(amount)
|
||||
. = ..()
|
||||
my_mech.use_power(OMNI_SHIELD_DRAIN)
|
||||
if(!active && shield_health < shield_regen_amount)
|
||||
my_mech.use_power(OMNI_SHIELD_DRAIN * 4)
|
||||
|
||||
#undef OMNI_SHIELD_DRAIN
|
||||
@@ -570,6 +570,14 @@
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 8000, "gold" = 2000, "silver" = 3000, "phoron" = 5000, "glass" = 3750)
|
||||
build_path = /obj/item/mecha_parts/mecha_equipment/combat_shield
|
||||
|
||||
/datum/design/item/mecha/omni_shield
|
||||
name = "Omni Shield"
|
||||
desc = "Integral shield projector. Can only protect the exosuit, but has no weak angles."
|
||||
id = "mech_shield_omni"
|
||||
req_tech = list(TECH_PHORON = 3, TECH_MAGNET = 6, TECH_ILLEGAL = 4)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 8000, "gold" = 2000, "silver" = 3000, "phoron" = 5000, "glass" = 3750)
|
||||
build_path = /obj/item/mecha_parts/mecha_equipment/omni_shield
|
||||
|
||||
/datum/design/item/mecha/crisis_drone
|
||||
name = "Crisis Drone"
|
||||
desc = "Deploys a small medical drone capable of patching small wounds in order to stabilize nearby patients."
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
for(var/obj/effect/directional_shield/S in active_shields)
|
||||
active_shields -= S
|
||||
qdel(S)
|
||||
set_light(0)
|
||||
active = FALSE
|
||||
|
||||
/obj/item/shield_projector/proc/update_shield_positions()
|
||||
@@ -179,13 +180,18 @@
|
||||
if(always_on)
|
||||
to_chat(user, "<span class='warning'>You can't seem to deactivate \the [src].</span>")
|
||||
return
|
||||
|
||||
destroy_shields()
|
||||
set_on(FALSE)
|
||||
else
|
||||
set_dir(user.dir) // Needed for linear shields.
|
||||
create_shields()
|
||||
set_on(TRUE)
|
||||
visible_message("<span class='notice'>\The [user] [!active ? "de":""]activates \the [src].</span>")
|
||||
|
||||
/obj/item/shield_projector/proc/set_on(var/on)
|
||||
if(isnull(on))
|
||||
return
|
||||
|
||||
on ? create_shields() : destroy_shields() // Harmless if called when in the wrong state.
|
||||
|
||||
/obj/item/shield_projector/process()
|
||||
if(shield_health < max_shield_health && ( (last_damaged_time + shield_regen_delay) < world.time) )
|
||||
adjust_health(shield_regen_amount)
|
||||
|
||||
@@ -932,6 +932,7 @@
|
||||
#include "code\game\mecha\equipment\tools\rcd.dm"
|
||||
#include "code\game\mecha\equipment\tools\repair_droid.dm"
|
||||
#include "code\game\mecha\equipment\tools\shield.dm"
|
||||
#include "code\game\mecha\equipment\tools\shield_omni.dm"
|
||||
#include "code\game\mecha\equipment\tools\sleeper.dm"
|
||||
#include "code\game\mecha\equipment\tools\speedboost.dm"
|
||||
#include "code\game\mecha\equipment\tools\syringe_gun.dm"
|
||||
|
||||
Reference in New Issue
Block a user