Tesla tweaks and bugfixes (#6955)

Bugfix: Tesla no longer gains energy from just colliding with objects

    Bugfix: Fixes sprite for singularity beacon not showing up

    Bugfix: Tesla no longer spams admin longs when a new ball is created outside of containment

    Bugfix: Telsa looses energy when dropping ball which should be slightly below how much is required for new ball.

    tweak: Tesla dissipation rate has been buffed, it now looses energy faster

    tweak: Tesla dissipates every time it zaps something

    tweak: Tesla now melts any object or mob(but not turfs) it touches or when it zaps it while sacrificing a miniball.

    rscadd: Added special emergency singularity beacon that is to be used when Singulo/Telsa are on the Loose. When Tesla zaps the beacon, it will discharge all energy into it, dying and destroying beacon.
This commit is contained in:
Mykhailo Bykhovtsev
2019-10-23 21:09:46 +03:00
committed by Erki
parent 037887700e
commit b167f0eade
5 changed files with 110 additions and 18 deletions
@@ -30,9 +30,10 @@
var/chained = 0//Adminbus chain-grab
/obj/singularity/New(loc, var/starting_energy = 50, var/temp = 0)
/obj/singularity/New(loc, var/starting_energy = 50, var/temp = 0, var/alert = TRUE)
//CARN: admin-alert for chuckle-fuckery.
admin_investigate_setup()
if(alert)
admin_investigate_setup()
energy = starting_energy
if (temp)
+48 -14
View File
@@ -95,10 +95,12 @@
if(move_dir & (UP | DOWN) )
move_amount = 0
var/move_tesla = !move_amount ? 0.1 : move_amount
for(var/i in 0 to move_amount)
do_single_move(move_dir, move_amount)
do_single_move(move_dir)
sleep(1 SECOND / move_tesla)
/obj/singularity/energy_ball/proc/do_single_move(var/move_dir, var/speed)
/obj/singularity/energy_ball/proc/do_single_move(var/move_dir)
var/z_move = 0
var/turf/T
switch(move_dir)
@@ -118,7 +120,7 @@
zMove(UP)
visible_message(span("danger","\The [src] gravitates from below!"))
if(0)
walk_to(src, T, 0, speed)
Move(T)
if(-1)
visible_message(span("danger","\The [src] gravitates downwards!"))
zMove(DOWN)
@@ -159,6 +161,7 @@
else if(energy < energy_to_lower && orbiting_balls.len)
energy_to_raise = energy_to_raise / 1.25
energy_to_lower = (energy_to_raise / 1.25) - 20
energy = energy_to_raise - 5
var/Orchiectomy_target = pick(orbiting_balls)
qdel(Orchiectomy_target)
@@ -167,13 +170,13 @@
// Basically the more balls we have the faster Tesla looses energy.
if(orbiting_balls.len > 16)
dissipate_delay = 3
dissipate_delay = 1.5
dissipate_strength = 5
if(orbiting_balls.len > 12)
dissipate_delay = 5
dissipate_delay = 2.5
dissipate_strength = 2
if(orbiting_balls.len <= 12)
dissipate_delay = 10
dissipate_delay = 5
dissipate_strength = 1
dissipate() //sing code has a much better system.
@@ -184,7 +187,7 @@
/obj/singularity/energy_ball/proc/new_mini_ball()
if(!loc)
return
var/obj/singularity/energy_ball/EB = new(loc, 0)
var/obj/singularity/energy_ball/EB = new(loc, 0, FALSE, FALSE)
EB.transform *= pick(0.3, 0.4, 0.5, 0.6, 0.7)
var/icon/I = icon(icon,icon_state,dir)
@@ -196,12 +199,30 @@
/obj/singularity/energy_ball/Collide(atom/A)
. = ..()
dust_mobs(A)
if(isliving(A))
dust_mobs(A)
else if(isobj(A))
var/obj/O = A
O.tesla_act(0, TRUE)
/obj/singularity/energy_ball/CollidedWith(atom/A)
if(isliving(A))
dust_mobs(A)
else if(isobj(A))
var/obj/O = A
O.tesla_act(0, TRUE)
/obj/singularity/energy_ball/Move(NewLoc, Dir)
. = ..()
dust_mobs(A)
for(var/v in view(0, loc))
if(istype(v, /obj/singularity))
continue
if(isliving(v))
dust_mobs(v)
else if(isobj(v))
var/obj/O = v
O.tesla_act(0, TRUE)
/obj/singularity/energy_ball/orbit(obj/singularity/energy_ball/target)
if (istype(target))
@@ -271,7 +292,18 @@
for(var/A in typecache_filter_multi_list_exclusion(oview(source, zap_range+2), things_to_shock, blacklisted_types))
if(istype(A, /obj/machinery/power/tesla_coil))
if(istype(source, /obj/singularity/energy_ball) && istype(A, /obj/machinery/power/singularity_beacon/emergency))
var/obj/machinery/power/singularity_beacon/emergency/E = A
var/obj/singularity/energy_ball/B = source
if(!E.active)
return
B.visible_message("\The [src] discharges entirely at [A] until it dissapears and [A] melts down")
B.Beam(E, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=2)
E.tesla_act(0, TRUE)
qdel(B)
return
else if(istype(A, /obj/machinery/power/tesla_coil))
var/dist = get_dist(source, A)
var/obj/machinery/power/tesla_coil/C = A
if(dist <= zap_range && (dist < closest_dist || !closest_tesla_coil) && !C.being_shocked)
@@ -339,16 +371,18 @@
if(istype(source, /obj/singularity/energy_ball))
var/obj/singularity/energy_ball/E = source
if(E.energy && (E.orbiting_balls.len > rods_count * 4)) // so that miniballs don't fry stuff.
melt = TRUE// 1 grounding rod can handle max 4 balls
melt = TRUE // 1 grounding rod can handle max 4 balls
E.visible_message(span("danger", "All [E.orbiting_balls.len] energize for a second, sending their energy to the main ball, which redirects it at the nearest object! Sacrificing one of its miniballs!"))
for(var/obj/singularity/energy_ball/mini in E.orbiting_balls)
mini.Beam(source, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=2)
playsound(source.loc, 'sound/magic/lightning_chargeup.ogg', 100, 1, extrarange = 30)
E.energy_to_raise = E.energy_to_raise / 1.25
E.energy_to_lower = (E.energy_to_raise / 1.25) - 20
E.energy = E.energy_to_raise - 5
var/Orchiectomy_target = pick(E.orbiting_balls)
qdel(Orchiectomy_target)
E.dissipate()
//Alright, we've done our loop, now lets see if was anything interesting in range
if(closest_atom)
@@ -380,7 +414,7 @@
tesla_zap(closest_mob, 5, power / 1.5, explosive, stun_mobs)
else if(closest_machine)
closest_machine.tesla_act(power)
closest_machine.tesla_act(power, melt)
else if(closest_structure)
closest_structure.tesla_act(power)
closest_structure.tesla_act(power, melt)