Files
Batrachophreno 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

109 lines
2.9 KiB
Plaintext

//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
/obj/effect/accelerated_particle
name = "Accelerated Particles"
desc = "Small things moving very fast."
icon = 'icons/obj/machinery/particle_accelerator.dmi'
icon_state = "particle"//Need a new icon for this
anchored = TRUE
density = FALSE
var/active = FALSE
var/movement_range = 10
var/energy = 10 //energy in eV
var/mega_energy = 0 //energy in MeV
var/frequency = 1
var/ionizing = 0
var/particle_type
var/additional_particles = 0
var/turf/target
var/turf/source
var/movetotarget = 1
/obj/effect/accelerated_particle/weak
movement_range = 8
energy = 5
/obj/effect/accelerated_particle/strong
movement_range = 15
energy = 15
// Can only be obtained by hacking the machine
/obj/effect/accelerated_particle/powerful
movement_range = 20
energy = 50
/obj/effect/accelerated_particle/Initialize(maploading, dir = 2)
. = ..()
set_dir(dir)
if(movement_range > 20)
movement_range = 20
active = TRUE
move(1)
/obj/effect/accelerated_particle/Collide(atom/A)
if (!active)
return
if (A)
if(ismob(A))
toxmob(A)
if((istype(A,/obj/structure/machinery/the_singularitygen))||(istype(A,/obj/singularity)))
var/obj/singularity/singulo = A
singulo.energy += energy
else if(istype(A, /obj/structure/machinery/power/fusion_core))
var/obj/structure/machinery/power/fusion_core/collided_core = A
if(particle_type && particle_type != "neutron")
if(collided_core.AddParticles(particle_type, 12 + additional_particles))
collided_core.owned_field.plasma_temperature += mega_energy
collided_core.owned_field.energy += energy
qdel(src)
else if(istype(A, /obj/effect/fusion_particle_catcher))
var/obj/effect/fusion_particle_catcher/PC = A
if(particle_type && particle_type != "neutron")
if(PC.parent.owned_core.AddParticles(particle_type, 12 + additional_particles))
PC.parent.plasma_temperature += mega_energy
PC.parent.energy += energy
qdel(src)
/obj/effect/accelerated_particle/CollidedWith(atom/bumped_atom)
. = ..()
if (!active)
return
if(ismob(bumped_atom))
toxmob(bumped_atom)
/obj/effect/accelerated_particle/ex_act(severity)
if (!active)
return
qdel(src)
/obj/effect/accelerated_particle/proc/toxmob(mob/living/M)
if (!active)
return
var/radiation = (energy*2)
M.apply_damage((radiation*3), DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
M.updatehealth()
/obj/effect/accelerated_particle/proc/move(lag)
set waitfor = FALSE
if(QDELETED(src))
return
if (!active)
return
var/destination
if(target)
destination = movetotarget ? get_step_towards(src, target) : get_step_away(src, source)
else
destination = get_step(src, dir)
if(!step_towards(src, destination))
if(QDELETED(src))
return
forceMove(destination)
if(target && movetotarget && (get_dist(src,target) < 1))
movetotarget = FALSE
movement_range--
if(movement_range <= 0)
qdel(src)
return
sleep(lag)
move(lag)