From 1b9a8b7843fe8ce9cfa8dbf27f225534001ee041 Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 28 Jan 2016 11:57:59 -0500 Subject: [PATCH 1/4] Updates mech gun code to current projectile code. --- code/game/mecha/equipment/weapons/weapons.dm | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 6b43943d53..03234e968e 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -37,7 +37,7 @@ playsound(chassis, fire_sound, fire_volume, 1) projectiles-- var/P = new projectile(curloc) - Fire(P, target, aimloc) + Fire(P, target) if(fire_cooldown) sleep(fire_cooldown) if(auto_rearm) @@ -46,16 +46,9 @@ do_after_cooldown() return -/obj/item/mecha_parts/mecha_equipment/weapon/proc/Fire(atom/A, atom/target, turf/aimloc) +/obj/item/mecha_parts/mecha_equipment/weapon/proc/Fire(atom/A, atom/target) var/obj/item/projectile/P = A - P.shot_from = src.name - P.original = target - P.starting = P.loc - P.current = P.loc - P.firer = chassis.occupant - P.yo = aimloc.y - P.loc.y - P.xo = aimloc.x - P.loc.x - P.process() + P.launch(target) /obj/item/mecha_parts/mecha_equipment/weapon/energy name = "general energy weapon" @@ -235,7 +228,7 @@ projectile_energy_cost = 1000 equip_cooldown = 60 -/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/explosive/Fire(atom/movable/AM, atom/target, turf/aimloc) +/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/explosive/Fire(atom/movable/AM, atom/target) var/obj/item/missile/M = AM M.primed = 1 ..() From 3ee1882b7924c3fcd088bff5551cb395b42501eb Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 28 Jan 2016 12:33:22 -0500 Subject: [PATCH 2/4] Replaces old projectile code with new projectile code. --- code/game/machinery/turrets.dm | 28 ++++++++----------- code/modules/mob/living/bot/ed209bot.dm | 8 +----- .../living/simple_animal/hostile/hostile.dm | 8 +----- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index 6254e2bb9d..2575ec4d6e 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -385,14 +385,14 @@ icon = 'icons/obj/turrets.dmi' icon_state = "gun_turret" - proc/take_damage(damage) +/obj/structure/turret/gun_turret/proc/take_damage(damage) src.health -= damage if(src.health<=0) qdel(src) return - bullet_act(var/obj/item/projectile/Proj) +/obj/structure/turret/gun_turret/bullet_act(var/obj/item/projectile/Proj) if(Proj.damage_type == HALLOSS) return take_damage(Proj.damage) @@ -400,15 +400,15 @@ return - ex_act() +/obj/structure/turret/gun_turret/ex_act() qdel(src) return - emp_act() +/obj/structure/turret/gun_turret/emp_act() qdel(src) return - attack_hand(mob/user as mob) +/obj/structure/turret/gun_turret/attack_hand(mob/user as mob) user.set_machine(src) var/dat = {" [src] Control @@ -426,10 +426,10 @@ onclose(user, "turret") return - attack_ai(mob/user as mob) +/obj/structure/turret/gun_turret/attack_ai(mob/user as mob) return attack_hand(user) - Topic(href, href_list) +/obj/structure/turret/gun_turret/Topic(href, href_list) if(href_list["power"]) src.on = !src.on if(src.on) @@ -445,7 +445,7 @@ return - proc/validate_target(atom/target) +/obj/structure/turret/gun_turret/proc/validate_target(atom/target) if(get_dist(target, src)>scan_range) return 0 if(istype(target, /mob)) @@ -457,7 +457,7 @@ return 0 - process() +/obj/structure/turret/gun_turret/process() spawn while(on) if(projectiles<=0) on = 0 @@ -470,7 +470,7 @@ sleep(cooldown) return - proc/get_target() +/obj/structure/turret/gun_turret/proc/get_target() var/list/pos_targets = list() var/target = null if(scan_for["human"]) @@ -498,7 +498,7 @@ return target - proc/fire(atom/target) +/obj/structure/turret/gun_turret/proc/fire(atom/target) if(!target) cur_target = null return @@ -519,9 +519,5 @@ playsound(src, 'sound/weapons/Gunshot.ogg', 50, 1) var/obj/item/projectile/A = new /obj/item/projectile(curloc) src.projectiles-- - A.current = curloc - A.yo = targloc.y - curloc.y - A.xo = targloc.x - curloc.x - A.process() - sleep(2) + A.launch(target) return diff --git a/code/modules/mob/living/bot/ed209bot.dm b/code/modules/mob/living/bot/ed209bot.dm index 570e58ec2e..00d9e2a507 100644 --- a/code/modules/mob/living/bot/ed209bot.dm +++ b/code/modules/mob/living/bot/ed209bot.dm @@ -66,13 +66,7 @@ playsound(loc, emagged ? 'sound/weapons/Laser.ogg' : 'sound/weapons/Taser.ogg', 50, 1) var/obj/item/projectile/P = new projectile(loc) - P.original = A - P.starting = T - P.current = T - P.yo = U.y - T.y - P.xo = U.x - T.x - spawn() - P.process() + P.launch(A) return // Assembly diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 899a01c3fa..e80c1becff 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -191,13 +191,7 @@ if (!istype(target, /turf)) qdel(A) return - A.current = target - A.starting = get_turf(src) - A.original = get_turf(target) - A.yo = target:y - start:y - A.xo = target:x - start:x - spawn( 0 ) - A.process() + A.launch(target) return /mob/living/simple_animal/hostile/proc/DestroySurroundings() From 03152c3567126bf9a1d8775f337e41519f0a4d6a Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 28 Jan 2016 12:37:16 -0500 Subject: [PATCH 3/4] Returns turrets to "consistent" indenting. --- code/game/machinery/turrets.dm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index 2575ec4d6e..d324f3dd9c 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -385,14 +385,14 @@ icon = 'icons/obj/turrets.dmi' icon_state = "gun_turret" -/obj/structure/turret/gun_turret/proc/take_damage(damage) + proc/take_damage(damage) src.health -= damage if(src.health<=0) qdel(src) return -/obj/structure/turret/gun_turret/bullet_act(var/obj/item/projectile/Proj) + bullet_act(var/obj/item/projectile/Proj) if(Proj.damage_type == HALLOSS) return take_damage(Proj.damage) @@ -400,15 +400,15 @@ return -/obj/structure/turret/gun_turret/ex_act() + ex_act() qdel(src) return -/obj/structure/turret/gun_turret/emp_act() + emp_act() qdel(src) return -/obj/structure/turret/gun_turret/attack_hand(mob/user as mob) + attack_hand(mob/user as mob) user.set_machine(src) var/dat = {" [src] Control @@ -426,10 +426,10 @@ onclose(user, "turret") return -/obj/structure/turret/gun_turret/attack_ai(mob/user as mob) + attack_ai(mob/user as mob) return attack_hand(user) -/obj/structure/turret/gun_turret/Topic(href, href_list) + Topic(href, href_list) if(href_list["power"]) src.on = !src.on if(src.on) @@ -445,7 +445,7 @@ return -/obj/structure/turret/gun_turret/proc/validate_target(atom/target) + proc/validate_target(atom/target) if(get_dist(target, src)>scan_range) return 0 if(istype(target, /mob)) @@ -457,7 +457,7 @@ return 0 -/obj/structure/turret/gun_turret/process() + process() spawn while(on) if(projectiles<=0) on = 0 @@ -470,7 +470,7 @@ sleep(cooldown) return -/obj/structure/turret/gun_turret/proc/get_target() + proc/get_target() var/list/pos_targets = list() var/target = null if(scan_for["human"]) @@ -498,7 +498,7 @@ return target -/obj/structure/turret/gun_turret/proc/fire(atom/target) + proc/fire(atom/target) if(!target) cur_target = null return From 96db69d27e4adba9bfa22dc934bb8af404f4d3a3 Mon Sep 17 00:00:00 2001 From: Datraen Date: Thu, 28 Jan 2016 12:42:51 -0500 Subject: [PATCH 4/4] Tosses warnings out the window. --- code/modules/mob/living/bot/ed209bot.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/mob/living/bot/ed209bot.dm b/code/modules/mob/living/bot/ed209bot.dm index 00d9e2a507..ac15eca6ce 100644 --- a/code/modules/mob/living/bot/ed209bot.dm +++ b/code/modules/mob/living/bot/ed209bot.dm @@ -56,8 +56,6 @@ return last_shot = world.time - var/turf/T = get_turf(src) - var/turf/U = get_turf(A) var/projectile = /obj/item/projectile/beam/stun if(emagged)