mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 05:27:01 +01:00
Tesla Update and Orbit Update
This commit is contained in:
+21
-12
@@ -3,15 +3,24 @@
|
||||
Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT
|
||||
|
||||
|
||||
/atom/proc/SpinAnimation(speed = 10, loops = -1)
|
||||
var/matrix/m120 = matrix(transform)
|
||||
m120.Turn(120)
|
||||
var/matrix/m240 = matrix(transform)
|
||||
m240.Turn(240)
|
||||
var/matrix/m360 = matrix(transform)
|
||||
speed /= 3 //Gives us 3 equal time segments for our three turns.
|
||||
//Why not one turn? Because byond will see that the start and finish are the same place and do nothing
|
||||
//Why not two turns? Because byond will do a flip instead of a turn
|
||||
animate(src, transform = m120, time = speed, loops)
|
||||
animate(transform = m240, time = speed)
|
||||
animate(transform = m360, time = speed)
|
||||
/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3)
|
||||
if(!segments)
|
||||
return
|
||||
var/segment = 360/segments
|
||||
if(!clockwise)
|
||||
segment = -segment
|
||||
var/list/matrices = list()
|
||||
for(var/i in 1 to segments-1)
|
||||
var/matrix/M = matrix(transform)
|
||||
M.Turn(segment*i)
|
||||
matrices += M
|
||||
var/matrix/last = matrix(transform)
|
||||
matrices += last
|
||||
|
||||
speed /= segments
|
||||
|
||||
animate(src, transform = matrices[1], time = speed, loops)
|
||||
for(var/i in 2 to segments) //2 because 1 is covered above
|
||||
animate(transform = matrices[i], time = speed)
|
||||
//doesn't have an object argument because this is "Stacking" with the animate call above
|
||||
//3 billion% intentional
|
||||
|
||||
+43
-20
@@ -1665,40 +1665,63 @@ var/mob/dview/dview_mob = new
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//ORBITS
|
||||
/atom/movable/var/atom/orbiting = null
|
||||
//This is just so you can stop an orbit.
|
||||
//orbit() can run without it (swap orbiting for A)
|
||||
//but then you can never stop it and that's just silly.
|
||||
/atom/movable/var/atom/orbiting = null
|
||||
|
||||
/atom/movable/proc/orbit(atom/A, radius = 10, clockwise = 1, angle_increment = 15)
|
||||
//A: atom to orbit
|
||||
//radius: range to orbit at, radius of the circle formed by orbiting
|
||||
//clockwise: whether you orbit clockwise or anti clockwise
|
||||
//rotation_speed: how fast to rotate
|
||||
//rotation_segments: the resolution of the orbit circle, less = a more block circle, this can be used to produce hexagons (6 segments) triangles (3 segments), and so on, 36 is the best default.
|
||||
//pre_rotation: Chooses to rotate src 90 degress towards the orbit dir (clockwise/anticlockwise), useful for things to go "head first" like ghosts
|
||||
//lockinorbit: Forces src to always be on A's turf, otherwise the orbit cancels when src gets too far away (eg: ghosts)
|
||||
|
||||
/atom/movable/proc/orbit(atom/A, radius = 10, clockwise = FALSE, rotation_speed = 20, rotation_segments = 36, pre_rotation = TRUE, lockinorbit = FALSE)
|
||||
if(!istype(A))
|
||||
return
|
||||
|
||||
if(orbiting)
|
||||
stop_orbit()
|
||||
|
||||
orbiting = A
|
||||
var/angle = 0
|
||||
var/matrix/initial_transform = matrix(transform)
|
||||
spawn
|
||||
while(orbiting)
|
||||
loc = orbiting.loc
|
||||
var/lastloc = loc
|
||||
|
||||
angle += angle_increment
|
||||
//Head first!
|
||||
if(pre_rotation)
|
||||
var/matrix/M = matrix(transform)
|
||||
var/pre_rot = 90
|
||||
if(!clockwise)
|
||||
pre_rot = -90
|
||||
M.Turn(pre_rot)
|
||||
transform = M
|
||||
|
||||
var/matrix/shift = matrix(initial_transform)
|
||||
shift.Translate(radius,0)
|
||||
if(clockwise)
|
||||
shift.Turn(angle)
|
||||
else
|
||||
shift.Turn(-angle)
|
||||
animate(src,transform = shift,2)
|
||||
var/matrix/shift = matrix(transform)
|
||||
shift.Translate(0,radius)
|
||||
transform = shift
|
||||
|
||||
SpinAnimation(rotation_speed, -1, clockwise, rotation_segments)
|
||||
|
||||
//we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit
|
||||
transform = initial_transform
|
||||
while(orbiting && orbiting == A && A.loc)
|
||||
var/targetloc = get_turf(A)
|
||||
if(!lockinorbit && loc != lastloc && loc != targetloc)
|
||||
break
|
||||
loc = targetloc
|
||||
lastloc = loc
|
||||
sleep(0.6)
|
||||
|
||||
if (orbiting == A) //make sure we haven't started orbiting something else.
|
||||
orbiting = null
|
||||
SpinAnimation(0,0)
|
||||
|
||||
sleep(0.6) //the effect breaks above 0.6 delay
|
||||
animate(src,transform = initial_transform,2)
|
||||
|
||||
|
||||
/atom/movable/proc/stop_orbit()
|
||||
if(orbiting)
|
||||
loc = get_turf(orbiting)
|
||||
orbiting = null
|
||||
orbiting = null
|
||||
|
||||
//Centers an image.
|
||||
//Requires:
|
||||
|
||||
@@ -264,7 +264,7 @@ a {
|
||||
|
||||
/obj/proc/tesla_act(var/power)
|
||||
being_shocked = 1
|
||||
var/power_bounced = power / 2
|
||||
var/power_bounced = power / 1.3
|
||||
tesla_zap(src, 5, power_bounced)
|
||||
spawn(10)
|
||||
being_shocked = 0
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
var/power_produced = power / power_loss
|
||||
add_avail(power_produced*input_power_multiplier)
|
||||
flick("coilhit", src)
|
||||
playsound(src.loc, 'sound/magic/LightningShock.ogg', 100, 1, extrarange = 5)
|
||||
tesla_zap(src, 5, power_produced)
|
||||
spawn(10)
|
||||
being_shocked = 0
|
||||
|
||||
@@ -40,15 +40,16 @@ var/list/blacklisted_tesla_types = list(/obj/machinery/atmospherics,
|
||||
if(!is_orbiting)
|
||||
handle_energy()
|
||||
var/amount_to_move = 2 + orbiting_balls.len * 2
|
||||
var/what_does_the_scouter_say_about_the_balls_power_level = (TESLA_DEFAULT_POWER + (TESLA_MINI_POWER * orbiting_balls.len))
|
||||
move_the_basket_ball(amount_to_move)
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
tesla_zap(src, 7, TESLA_DEFAULT_POWER)
|
||||
playsound(src.loc, 'sound/magic/lightningbolt.ogg', 100, 1, extrarange = 5)
|
||||
tesla_zap(src, 7, what_does_the_scouter_say_about_the_balls_power_level)
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
energy += rand(1,3) // ensure it generates energy without needing to be blasted by the PA too much due to its size, and that a tesla engine will always get bigger over time
|
||||
else
|
||||
tesla_zap(src, 7, TESLA_MINI_POWER)
|
||||
energy = 0 // ensure we dont have miniballs of miniballs
|
||||
return
|
||||
|
||||
@@ -67,17 +68,19 @@ var/list/blacklisted_tesla_types = list(/obj/machinery/atmospherics,
|
||||
|
||||
/obj/singularity/energy_ball/proc/handle_energy()
|
||||
if(energy >= 300)
|
||||
energy = 0
|
||||
var/obj/singularity/energy_ball/EB = new(loc)
|
||||
orbiting_balls.Add(EB)
|
||||
EB.transform *= pick(0.3,0.4,0.5,0.6,0.7)
|
||||
EB.is_orbiting = 1
|
||||
var/icon/I = icon(icon,icon_state,dir)
|
||||
energy -= 300
|
||||
playsound(src.loc, 'sound/magic/lightning_chargeup.ogg', 100, 1, extrarange = 5)
|
||||
spawn(100)
|
||||
var/obj/singularity/energy_ball/EB = new(loc)
|
||||
orbiting_balls.Add(EB)
|
||||
EB.transform *= pick(0.3,0.4,0.5,0.6,0.7)
|
||||
EB.is_orbiting = 1
|
||||
var/icon/I = icon(icon,icon_state,dir)
|
||||
|
||||
var/orbitsize = (I.Width()+I.Height())*pick(0.5,0.6,0.7)
|
||||
orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25)
|
||||
spawn(1)
|
||||
EB.orbit(src,orbitsize, pick(FALSE,TRUE), rand(10,25), pick(3,4,5,6,36))
|
||||
var/orbitsize = (I.Width()+I.Height())*pick(0.5,0.6,0.7)
|
||||
orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25)
|
||||
spawn(1)
|
||||
EB.orbit(src,orbitsize, pick(FALSE,TRUE), rand(10,25), pick(3,4,5,6,36))
|
||||
|
||||
|
||||
|
||||
@@ -110,7 +113,7 @@ var/list/blacklisted_tesla_types = list(/obj/machinery/atmospherics,
|
||||
return closest_atom
|
||||
|
||||
/proc/tesla_zap(var/atom/source, zap_range = 3, power)
|
||||
if(power < 1000)
|
||||
if(power < 500)
|
||||
return
|
||||
var/list/tesla_coils = list()
|
||||
var/list/grounding_rods = list()
|
||||
@@ -176,6 +179,9 @@ var/list/blacklisted_tesla_types = list(/obj/machinery/atmospherics,
|
||||
if(istype(L, /mob/living/silicon))
|
||||
var/mob/living/silicon/S = L
|
||||
S.emp_act(2)
|
||||
tesla_zap(S, 7, power / 1.5) // metallic folks bounce it further
|
||||
else
|
||||
tesla_zap(L, 5, power / 1.5)
|
||||
return
|
||||
if(!closest_atom)
|
||||
closest_atom = get_closest_atom(/obj/machinery, potential_machine_zaps, source)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user