Merge pull request #3135 from Fox-McCloud/timestop

Timestop Spell Port and Sepia Slimes
This commit is contained in:
TheDZD
2016-01-07 19:56:45 -05:00
8 changed files with 200 additions and 76 deletions
+77 -74
View File
@@ -31,6 +31,7 @@
var/atom/original = null // the original target clicked
var/turf/starting = null // the projectile's starting turf
var/list/permutated = list() // we've passed through these atoms, don't try to hit them again
var/paused = FALSE //for suspending the projectile midair
var/p_x = 16
var/p_y = 16 // the pixel location of the tile that the player clicked. Default is the center
@@ -202,73 +203,74 @@
if(kill_count < 1)
del(src)
return
kill_count--
if((!( current ) || loc == current))
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
if(!paused)
kill_count--
if((!( current ) || loc == current))
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
if(!Angle)
Angle=round(Get_Angle(src,current))
//world << "[Angle] angle"
//overlays.Cut()
//var/icon/I=new(initial(icon),icon_state) //using initial(icon) makes sure that the angle for that is reset as well
//I.Turn(Angle)
//I.DrawBox(rgb(255,0,0,50),1,1,32,32)
//icon = I
if(spread) //Chaotic spread
Angle += (rand() - 0.5) * spread
var/matrix/M = new//matrix(transform)
M.Turn(Angle)
transform = M
if(!Angle)
Angle=round(Get_Angle(src,current))
//world << "[Angle] angle"
//overlays.Cut()
//var/icon/I=new(initial(icon),icon_state) //using initial(icon) makes sure that the angle for that is reset as well
//I.Turn(Angle)
//I.DrawBox(rgb(255,0,0,50),1,1,32,32)
//icon = I
if(spread) //Chaotic spread
Angle += (rand() - 0.5) * spread
var/matrix/M = new//matrix(transform)
M.Turn(Angle)
transform = M
var/Pixel_x=round(sin(Angle)+16*sin(Angle)*2)
var/Pixel_y=round(cos(Angle)+16*cos(Angle)*2)
var/pixel_x_offset = pixel_x + Pixel_x
var/pixel_y_offset = pixel_y + Pixel_y
var/new_x = x
var/new_y = y
//Not sure if using whiles for this is good
while(pixel_x_offset > 16)
//world << "Pre-adjust coords (x++): xy [pixel_x] xy offset [pixel_x_offset]"
pixel_x_offset -= 32
pixel_x -= 32
new_x++// x++
while(pixel_x_offset < -16)
//world << "Pre-adjust coords (x--): xy [pixel_x] xy offset [pixel_x_offset]"
pixel_x_offset += 32
pixel_x += 32
new_x--
var/Pixel_x=round(sin(Angle)+16*sin(Angle)*2)
var/Pixel_y=round(cos(Angle)+16*cos(Angle)*2)
var/pixel_x_offset = pixel_x + Pixel_x
var/pixel_y_offset = pixel_y + Pixel_y
var/new_x = x
var/new_y = y
//Not sure if using whiles for this is good
while(pixel_x_offset > 16)
//world << "Pre-adjust coords (x++): xy [pixel_x] xy offset [pixel_x_offset]"
pixel_x_offset -= 32
pixel_x -= 32
new_x++// x++
while(pixel_x_offset < -16)
//world << "Pre-adjust coords (x--): xy [pixel_x] xy offset [pixel_x_offset]"
pixel_x_offset += 32
pixel_x += 32
new_x--
while(pixel_y_offset > 16)
//world << "Pre-adjust coords (y++): py [pixel_y] py offset [pixel_y_offset]"
pixel_y_offset -= 32
pixel_y -= 32
new_y++
while(pixel_y_offset < -16)
//world << "Pre-adjust coords (y--): py [pixel_y] py offset [pixel_y_offset]"
pixel_y_offset += 32
pixel_y += 32
new_y--
while(pixel_y_offset > 16)
//world << "Pre-adjust coords (y++): py [pixel_y] py offset [pixel_y_offset]"
pixel_y_offset -= 32
pixel_y -= 32
new_y++
while(pixel_y_offset < -16)
//world << "Pre-adjust coords (y--): py [pixel_y] py offset [pixel_y_offset]"
pixel_y_offset += 32
pixel_y += 32
new_y--
speed = round(speed) //Just in case.
step_towards(src, locate(new_x, new_y, z)) //Original projectiles stepped towards 'current'
if(speed <= 1) //We should really only animate at speed 2
pixel_x = pixel_x_offset
pixel_y = pixel_y_offset
else
animate(src, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset, time = max(1, (speed <= 3 ? speed - 1 : speed)))
speed = round(speed) //Just in case.
step_towards(src, locate(new_x, new_y, z)) //Original projectiles stepped towards 'current'
if(speed <= 1) //We should really only animate at speed 2
pixel_x = pixel_x_offset
pixel_y = pixel_y_offset
else
animate(src, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset, time = max(1, (speed <= 3 ? speed - 1 : speed)))
/*
var/turf/T = get_turf(src)
if(T)
T.color = "#6666FF"
spawn(10)
T.color = initial(T.color)
*/
/*
var/turf/T = get_turf(src)
if(T)
T.color = "#6666FF"
spawn(10)
T.color = initial(T.color)
*/
if(!bumped && ((original && original.layer>=2.75) || ismob(original)))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
if(!bumped && ((original && original.layer>=2.75) || ismob(original)))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
Range()
sleep(max(1, speed))
else
@@ -277,19 +279,20 @@
if(kill_count < 1)
del(src)
return
kill_count--
if((!( current ) || loc == current))
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
if(!Angle)
Angle=round(Get_Angle(src,current))
var/matrix/M = new//matrix(transform)
M.Turn(Angle)
transform = M //So there's no need to give icons directions again
step_towards(src, current)
if(!bumped && ((original && original.layer>=2.75) || ismob(original)))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
if(!paused)
kill_count--
if((!( current ) || loc == current))
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
if(!Angle)
Angle=round(Get_Angle(src,current))
var/matrix/M = new//matrix(transform)
M.Turn(Angle)
transform = M //So there's no need to give icons directions again
step_towards(src, current)
if(!bumped && ((original && original.layer>=2.75) || ismob(original)))
if(loc == get_turf(original))
if(!(original in permutated))
Bump(original)
Range()
sleep(1)
@@ -491,11 +491,28 @@
var/obj/item/weapon/slimesteroid2/P = new /obj/item/weapon/slimesteroid2
P.loc = get_turf(holder.my_atom)
//Sepia
slimestop
name = "Slime Stop"
id = "m_stop"
result = null
required_reagents = list("plasma" = 1)
result_amount = 1
required_container = /obj/item/slime_extract/sepia
required_other = 1
on_reaction(datum/reagents/holder)
feedback_add_details("slime_cores_used","[type]")
spawn(0) //otherwise the reagent won't be used up until after the full timstop is gone through.
var/mob/mob = get_mob_by_key(holder.my_atom.fingerprintslast)
var/obj/effect/timestop/T = new (get_turf(holder.my_atom))
T.immune += mob
T.timestop()
slimecamera
name = "Slime Camera"
id = "m_camera"
result = null
required_reagents = list("plasma" = 1)
required_reagents = list("water" = 1)
result_amount = 1
required_container = /obj/item/slime_extract/sepia
required_other = 1
@@ -205,7 +205,7 @@
/obj/item/weapon/sentience_potion/afterattack(mob/living/M, mob/user)
if(being_used || !ismob(M))
return
if(!isslime(M) && !isanimal(M) || M.ckey) //only works on animals that aren't player controlled
if(!isanimal(M) || M.ckey) //only works on animals that aren't player controlled
user << "<span class='warning'>[M] is already too intelligent for this to work!</span>"
return ..()
if(M.stat)
@@ -351,6 +351,81 @@
if(!uses)
qdel(src)
/obj/effect/timestop
anchored = 1
name = "chronofield"
desc = "ZA WARUDO"
icon = 'icons/effects/160x160.dmi'
icon_state = "time"
layer = FLY_LAYER
pixel_x = -64
pixel_y = -64
unacidable = 1
mouse_opacity = 0
var/mob/living/immune = list() // the one who creates the timestop is immune
var/list/stopped_atoms = list()
var/freezerange = 2
var/duration = 140
alpha = 125
/obj/effect/timestop/New()
..()
for(var/mob/living/M in player_list)
for(var/obj/effect/proc_holder/spell/aoe_turf/conjure/timestop/T in M.mind.spell_list) //People who can stop time are immune to timestop
immune |= M
/obj/effect/timestop/proc/timestop()
playsound(get_turf(src), 'sound/magic/TIMEPARADOX2.ogg', 100, 1, -1)
for(var/i in 1 to duration-1)
for(var/A in orange (freezerange, src.loc))
if(istype(A, /mob/living))
var/mob/living/M = A
if(M in immune)
continue
M.stunned = 10
M.anchored = 1
if(istype(M, /mob/living/simple_animal/hostile))
var/mob/living/simple_animal/hostile/H = M
H.AIStatus = AI_OFF
H.LoseTarget()
stopped_atoms |= M
else if(istype(A, /obj/item/projectile))
var/obj/item/projectile/P = A
P.paused = TRUE
stopped_atoms |= P
for(var/mob/living/M in stopped_atoms)
if(get_dist(get_turf(M),get_turf(src)) > freezerange) //If they lagged/ran past the timestop somehow, just ignore them
unfreeze_mob(M)
stopped_atoms -= M
sleep(1)
//End
for(var/mob/living/M in stopped_atoms)
unfreeze_mob(M)
for(var/obj/item/projectile/P in stopped_atoms)
P.paused = FALSE
qdel(src)
return
/obj/effect/timestop/proc/unfreeze_mob(mob/living/M)
M.stunned = 0
M.anchored = 0
if(istype(M, /mob/living/simple_animal/hostile))
var/mob/living/simple_animal/hostile/H = M
H.AIStatus = initial(H.AIStatus)
/obj/effect/timestop/wizard
duration = 100
/obj/effect/timestop/wizard/New()
..()
timestop()
/obj/item/stack/tile/bluespace
name = "bluespace floor tile"
singular_name = "floor tile"