Files
Aurora.3/code/modules/shieldgen/energy_field.dm
0c342878e5 Engineering spriting (detailing & port), portable shield balance, bugfixes (#21862)
EXTREMELY MINOR MISCELLANEOUS CHANGES TEEHEE

changes:
- imageadd: "Adds +bolted, +welded, +lights overlays to several large
machines for easier visual identification of whether or not clicking on
that emitter will kill you or not, etc."
- imageadd: "Modifies the base of the Shield Wall Generator sprite to
better match that of the Emergency Shield Projector (and so they can use
the same overlays mentioned above)."
- imageadd: "Tweaks the Emitter's directional sprites slightly so that
the base doesn't seem to change shape quite so drastically when
rotated."
- imageadd: "Ports very pretty space heater sprites made by Wallemations
and vinylspiders from /tg/."
  - imageadd: "Adds unique sprites for Old and Heavy-Duty power cells."
- balance: "Increases power draw and range of Emergency Shield
Projectors."
  - balance: "Increases power draw of Shield Wall Generators."
- balance: "Greatly reduces time for debugger to fix APCs corrupted by
electrical storms."
- balance: "Increases multi-z shield capacitor reserve charge and
maximum throughput, so that high-strength shields can actually be run
(at high power draw)."
- balance: "Tweaks the INDRA power output formula to scale better with
increasing temperature."
- balance: "Slight adjustments to space heater efficiency formula with a
friendly handwave to entropy."
- balance: "Old power cells have a 5% chance to be defective and have
slightly lower maxcharge than standard cells."
  - qol: "Adds extended examine hints to engineering objects."
- qol: "Extends list of object types which INDRA core field will
interact peacefully with."
- qol: "Improved space heater UX (chat msgs changed to balloon alerts,
audible feedback, etc.)"
  - code_imp: "Updates many code comments to use DMdocs."
- code_imp: "Consolidates various shield generation machine sprites in
scattered across multiple files into a single shield generator machines
sprite file."
  - bugfix: "Fixes Emergency Shield Projector hard del issue."
- bugfix: "Emergency Shield Projector now shuts down as intended if the
area's APC gets completely drained."
- bugfix: "Firing the gyrotron into the INDRA while no reactants are
present will no longer generate heat."
  - bugfix: "Fixes INDRA runtime."
- bugfix: "Fixes Power Monitoring app not displaying grid sensors when
run from a modular computer held in-hand."
  
  Bolted/welded down Emitter:
<img width="130" height="101" alt="Screenshot 2026-02-13 123842"
src="https://github.com/user-attachments/assets/8357b5ea-77e6-46f7-b4a0-724aaa141cef"
/>

Modified shieldwall sprites (with old ones for comparison)
<img width="667" height="103" alt="Screenshot 2026-02-13 111422"
src="https://github.com/user-attachments/assets/2b1e849e-f955-49cb-b094-0bef098a754f"
/>

Shields actually useful for damage control now (though they'll blow
through APC charge if you go as crazy as this):
<img width="804" height="891" alt="Screenshot 2026-02-13 124245"
src="https://github.com/user-attachments/assets/39268b42-5abe-4a3b-ba8a-a18bdc63873e"
/>

### Asset Licenses
The following assets that **have not** been created by myself are
included in this PR:

| Path | Original Author | License |
| --- | --- | --- |
| icons/obj/atmos.dmi (all "sheater*") | [Wallemations, VinylSpiders
(/tg/station #93800)](https://github.com/tgstation/tgstation/pull/93800)
| CC-BY-SA |

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
2026-03-11 16:39:54 +00:00

146 lines
4.6 KiB
Plaintext

//---------- actual energy field
/obj/effect/energy_field
name = "energy shield"
desc = "A strong field of energy, capable of blocking anything as long as it's active."
icon = 'icons/effects/effects.dmi'
icon_state = "shield_normal"
alpha = 0
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
anchored = 1
layer = ABOVE_HUMAN_LAYER
density = 0
/// A ref holding the /datum/energy_field that this field object belongs to.
var/datum/energy_field/energy_field
/// The damage suffered by the field.
var/damage = 0
var/ticks_recovering = 10
/// If strength goes is 1 or above, this is set to TRUE, this is to prevent flickering and animate being called constantly
var/is_strong = FALSE
atmos_canpass = CANPASS_ALWAYS
/obj/effect/energy_field/Initialize(mapload, datum/energy_field/mother_field)
. = ..()
if(istype(mother_field))
energy_field = mother_field
else
log_debug("Energy field generated without mother field, deleting.")
qdel_self()
RegisterSignal(mother_field, COMSIG_SHIELDS_UPDATE_STRENGTH_STATUS, PROC_REF(update_strength))
update_nearby_tiles()
/obj/effect/energy_field/Destroy()
if(istype(energy_field))
energy_field.field -= src
energy_field = null
update_nearby_tiles()
return ..()
/obj/effect/energy_field/proc/diffuse(var/duration)
energy_field.remove_individual_field(src)
/obj/effect/energy_field/attackby(obj/item/attacking_item, mob/user)
user.do_attack_animation(src, attacking_item)
if(attacking_item.force < 10)
user.visible_message(SPAN_WARNING("[user] harmlessly attacks \the [src] with \the [attacking_item]."),
SPAN_WARNING("You attack \the [src] with \the [attacking_item], but it bounces off without doing any damage."))
else
user.visible_message(SPAN_WARNING("[user] attacks \the [src] with \the [attacking_item]."),
SPAN_WARNING("You attack \the [src] with \the [attacking_item]."))
damage_field(attacking_item.force / 10)
/obj/effect/energy_field/attack_hand(mob/living/carbon/human/H)
if(istype(H))
if(H.species.can_shred(H))
H.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
H.do_attack_animation(src, FIST_ATTACK_ANIMATION)
H.visible_message(SPAN_WARNING("[H] shreds \the [src]!"), SPAN_WARNING("You shred \the [src]!"))
damage_field(1)
return
to_chat(H, SPAN_WARNING("You touch \the [src], and it repulses your hand."))
/obj/effect/energy_field/ex_act(var/severity)
damage_field(0.5 + severity)
/obj/effect/energy_field/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit)
. = ..()
if(. != BULLET_ACT_HIT)
return .
damage_field(hitting_projectile.get_structure_damage() / 10)
/obj/effect/energy_field/proc/damage_field(var/severity)
if(!severity)
return
damage += severity
if(!(datum_flags & DF_ISPROCESSING))
// Start processing ONLY when we're damaged. Through processing, we're going to slowly climb back up to field strength.
START_PROCESSING(SSprocessing, src)
var/shield_health = get_health()
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
ticks_recovering = min(ticks_recovering + 2, 10)
if(shield_health < 1 && is_strong)
density_check(FALSE)
is_strong = FALSE
ticks_recovering = 10
else if(shield_health >= 1 && !is_strong)
density_check(TRUE)
is_strong = TRUE
/obj/effect/energy_field/process(seconds_per_tick)
if(!damage) // No need to process anymore.
update_strength()
return PROCESS_KILL
if(ticks_recovering)
ticks_recovering--
else
damage = max(damage - energy_field.strengthen_rate, 0)
/obj/effect/energy_field/proc/density_check(var/turn_on)
if(turn_on)
alpha = 0
density = TRUE
mouse_opacity = MOUSE_OPACITY_ICON
animate(src, 2 SECONDS, alpha = 255)
else
alpha = 255
density = FALSE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
animate(src, 2 SECONDS, alpha = 0)
/obj/effect/energy_field/proc/update_strength()
SIGNAL_HANDLER
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
var/old_density = density
var/shield_health = get_health()
if(shield_health >= 1 && !is_strong)
is_strong = TRUE
density_check(TRUE)
else if(shield_health < 1 && is_strong)
is_strong = FALSE
density_check(FALSE)
if (density != old_density)
update_nearby_tiles()
/**
* Easy helper proc to return the shield's current health.
*/
/obj/effect/energy_field/proc/get_health()
return max(energy_field.field_strength - damage, 0)
/obj/effect/energy_field/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
if(mover?.movement_type & PHASING)
return TRUE
return (!density || air_group)
/obj/effect/energy_field/afterShuttleMove(obj/effect/shuttle_landmark/destination)
qdel_self()