Merge pull request #1036 from ZomgPonies/mech

Mechas breakthrough
This commit is contained in:
TheDZD
2015-05-14 19:44:20 -04:00
2 changed files with 74 additions and 0 deletions
+18
View File
@@ -1683,3 +1683,21 @@ atom/proc/GetTypeInAllContents(typepath)
temp_col = "0[temp_col]"
colour += temp_col
return colour
/proc/get_distant_turf(var/turf/T,var/direction,var/distance)
if(!T || !direction || !distance) return
var/dest_x = T.x
var/dest_y = T.y
var/dest_z = T.z
if(direction & NORTH)
dest_y = min(world.maxy, dest_y+distance)
if(direction & SOUTH)
dest_y = max(0, dest_y-distance)
if(direction & EAST)
dest_x = min(world.maxy, dest_x+distance)
if(direction & WEST)
dest_x = max(0, dest_x-distance)
return locate(dest_x,dest_y,dest_z)
+56
View File
@@ -69,6 +69,7 @@
var/obj/item/mecha_parts/mecha_equipment/selected
var/max_equip = 3
var/datum/events/events
var/turf/crashing = null
var/stepsound = 'sound/mecha/mechturn.ogg'
@@ -365,6 +366,61 @@
/obj/mecha/Bump(var/atom/obstacle)
// src.inertia_dir = null
if(src.throwing)//high velocity mechas in your face!
var/breakthrough = 0
if(istype(obstacle, /obj/structure/window/))
obstacle.Destroy(brokenup = 1)
breakthrough = 1
else if(istype(obstacle, /obj/structure/grille/))
var/obj/structure/grille/G = obstacle
G.health = (0.25*initial(G.health))
G.destroyed = 1
G.icon_state = "[initial(G.icon_state)]-b"
G.density = 0
getFromPool(/obj/item/stack/rods, get_turf(G.loc))
breakthrough = 1
else if(istype(obstacle, /obj/structure/table))
var/obj/structure/table/T = obstacle
T.destroy()
breakthrough = 1
else if(istype(obstacle, /obj/structure/rack))
new /obj/item/weapon/rack_parts(obstacle.loc)
qdel(obstacle)
breakthrough = 1
else if(istype(obstacle, /obj/structure/reagent_dispensers/fueltank))
obstacle.ex_act(1)
else if(istype(obstacle, /mob/living))
var/mob/living/L = obstacle
var/hit_sound = list('sound/weapons/genhit1.ogg','sound/weapons/genhit2.ogg','sound/weapons/genhit3.ogg')
if(L.flags & GODMODE)
return
L.take_overall_damage(5,0)
if(L.buckled)
L.buckled = 0
L.Stun(5)
L.Weaken(5)
L.apply_effect(STUTTER, 5)
playsound(src, pick(hit_sound), 50, 0, 0)
breakthrough = 1
else
src.throwing = 0//so mechas don't get stuck when landing after being sent by a Mass Driver
src.crashing = null
if(breakthrough)
if(crashing)
spawn(1)
src.throw_at(crashing, 50, src.throw_speed)
else
spawn(1)
crashing = get_distant_turf(get_turf(src), dir, 3)//don't use get_dir(src, obstacle) or the mech will stop if he bumps into a one-direction window on his tile.
src.throw_at(crashing, 50, src.throw_speed)
if(istype(obstacle, /obj))
var/obj/O = obstacle
if(istype(O, /obj/effect/portal)) //derpfix