Tesla tweak update to previous update and re-haul[buff] (#5994)

This Pr tweaks previous update

Grounding rods now are vital for how many miniballs of Tesla can be contained without it going nuts and melt stuff. 1 rod = 4 miniballs. So with standard setup 4 rods = 16 miniballs max and that is around 4 million W energy.

Each time Tesla melts coil/rod/emitter it will loose a single miniball and drop in energy.

Tesla miniballs no longer shoot beams, instead they shoot main ball which shoot coils, accounting for energy produced by all miniballs.

Tesla miniballs no longer zap. Instead they shoot main Tesla ball which shoots one single beamn, which accounts how much power each miniball produces.

Tesla now looses more and faster energy with number of miniballs it has. Energy loss changes after 12 balls and after 16 miniballs.

Each miniball produces 156250W

Tesla Engine room is reduced in size, field is now 5x5.

Tesla now moves smoothly tile-by-tile. No more jumps
This commit is contained in:
Mykhailo Bykhovtsev
2019-03-01 20:27:52 +02:00
committed by Erki
parent e81c4275cf
commit 2c4011dde4
5 changed files with 447 additions and 442 deletions
-1
View File
@@ -83,7 +83,6 @@
/obj/machinery/power/grounding_rod/tesla_act(var/power, var/melt = FALSE)
flick("coil_shock_1", src)
..()
/obj/item/weapon/circuitboard/tesla_coil
name = "tesla coil circuitry"
+53 -24
View File
@@ -1,5 +1,5 @@
#define TESLA_DEFAULT_POWER 1738260
#define TESLA_MINI_POWER 869130
#define TESLA_MINI_POWER 156250
/obj/singularity/energy_ball
name = "energy ball"
@@ -15,7 +15,7 @@
density = 1
energy = 0
dissipate = 1
dissipate_delay = 5
dissipate_delay = 10
dissipate_strength = 1
layer = LIGHTING_LAYER + 0.1
blend_mode = BLEND_ADD
@@ -29,6 +29,7 @@
return
/obj/singularity/energy_ball/Destroy()
walk(src, 0) // Stop walking
if(orbiting && istype(orbiting.orbiting, /obj/singularity/energy_ball))
var/obj/singularity/energy_ball/EB = orbiting.orbiting
EB.orbiting_balls -= src
@@ -43,20 +44,23 @@
if(!orbiting)
handle_energy()
move_the_basket_ball(rand(1,4 + orbiting_balls.len * 1.5))
move_the_basket_ball(rand(1, 6) - orbiting_balls.len * 0.25)
playsound(src.loc, 'sound/magic/lightningbolt.ogg', 100, 1, extrarange = 30)
pixel_x = 0
pixel_y = 0
dir = tesla_zap(src, 7, TESLA_DEFAULT_POWER, TRUE)
// This now does just the animation of all balls shooting main ball
for (var/obj/singularity/energy_ball/ball in orbiting_balls)
ball.Beam(src, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=2)
// Instead of miniballs shooting stuff, decided to make it just count the power produced.
dir = tesla_zap(src, 10, TESLA_DEFAULT_POWER + orbiting_balls.len * TESLA_MINI_POWER, TRUE)
pixel_x = -32
pixel_y = -32
for (var/ball in orbiting_balls)
var/range = rand(1, Clamp(orbiting_balls.len, 3, 7))
tesla_zap(ball, range, TESLA_MINI_POWER/7*range, TRUE)
else
energy = 0 // ensure we dont have miniballs of miniballs
if(energy < 0)
@@ -65,7 +69,7 @@
/obj/singularity/energy_ball/examine(mob/user)
..()
if(orbiting_balls.len)
user << "There are [orbiting_balls.len] energy balls orbiting \the [src]."
to_chat(user, "There are [orbiting_balls.len] energy balls orbiting \the [src].")
/obj/singularity/energy_ball/proc/move_the_basket_ball(var/move_amount)
@@ -81,7 +85,7 @@
var/move_dir = 0
if(target && prob(75))
move_dir = get_dir(src,target)
move_dir = get_dir(src, target)
else
valid_directions.Remove(dir)
move_dir = (prob(50) && (dir != failed_direction)) ? dir : pick(valid_directions)
@@ -90,9 +94,9 @@
move_amount = 0
for(var/i in 0 to move_amount)
do_single_move(move_dir)
do_single_move(move_dir, move_amount)
/obj/singularity/energy_ball/proc/do_single_move(var/move_dir)
/obj/singularity/energy_ball/proc/do_single_move(var/move_dir, var/speed)
var/z_move = 0
var/turf/T
switch(move_dir)
@@ -109,13 +113,13 @@
switch(z_move)
if(1)
visible_message(span("danger","\The [src] gravitates upwards!"))
forceMove(T)
zMove(UP)
visible_message(span("danger","\The [src] gravitates from below!"))
if(0)
forceMove(T)
walk_to(src, T, 0, speed)
if(-1)
visible_message(span("danger","\The [src] gravitates downwards!"))
forceMove(T)
zMove(DOWN)
visible_message(span("danger","\The [src] gravitates from above!"))
if(dir in alldirs)
@@ -158,6 +162,18 @@
qdel(Orchiectomy_target)
else if(orbiting_balls.len)
// Basically the more balls we have the faster Tesla looses energy.
if(orbiting_balls.len > 16)
dissipate_delay = 3
dissipate_strength = 5
if(orbiting_balls.len > 12)
dissipate_delay = 5
dissipate_strength = 2
if(orbiting_balls.len <= 12)
dissipate_delay = 10
dissipate_strength = 1
dissipate() //sing code has a much better system.
else // that is when we have no balls but our energy is less
energy_to_raise = energy_to_raise / 1.25
@@ -222,10 +238,9 @@
var/mob/living/closest_mob
var/obj/machinery/closest_machine
var/obj/structure/closest_structure
var/obj/machinery/power/emitter/closest_emitter // Use only if Tesla is too grown with 10 ore more balls. Will escape.
var/obj/machinery/power/emitter/closest_emitter // Use only if Tesla is too grown. Will escape.
var/static/list/blacklisted_types = typecacheof(list(
/obj/machinery/atmospherics,
/obj/machinery/power/emitter,
/obj/machinery/field_generator,
/mob/living/simple_animal,
/obj/machinery/particle_accelerator/control_box,
@@ -249,12 +264,8 @@
/mob/living,
/obj/structure
))
var/melt = FALSE
if(istype(source, /obj/singularity/energy_ball))
var/obj/singularity/energy_ball/E = source
melt = (E.orbiting_balls.len >= 9)
if(E.orbiting_balls.len >= 10)
blacklisted_types -= /obj/machinery/power/emitter
var/rods_count = 0
for(var/A in typecache_filter_multi_list_exclusion(oview(source, zap_range+2), things_to_shock, blacklisted_types))
@@ -270,9 +281,12 @@
closest_atom = C
else if(closest_tesla_coil)
if(istype(A, /obj/machinery/power/grounding_rod)) // to count number of rods
rods_count += 1
continue //no need checking these other things
else if(istype(A, /obj/machinery/power/grounding_rod))
rods_count += 1
var/dist = get_dist(source, A)-2
if(dist <= zap_range && (dist < closest_dist || !closest_grounding_rod))
closest_grounding_rod = A
@@ -282,7 +296,7 @@
else if(closest_grounding_rod)
continue
else if(melt && istype(A, /obj/machinery/power/emitter))
else if(istype(A, /obj/machinery/power/emitter))
var/obj/machinery/power/emitter/e = A
closest_emitter = e
@@ -319,10 +333,25 @@
closest_atom = A
closest_dist = dist
var/melt = FALSE
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
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! Sacraficing 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
var/Orchiectomy_target = pick(E.orbiting_balls)
qdel(Orchiectomy_target)
//Alright, we've done our loop, now lets see if was anything interesting in range
if(closest_atom)
//common stuff
source.Beam(closest_atom, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=5)
source.Beam(closest_atom, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time= 5)
var/zapdir = get_dir(source, closest_atom)
if(zapdir)
. = zapdir