From 604ad08f07589be2901327e6e7a7e17c24ca5216 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 22 Oct 2014 00:11:20 -0400 Subject: [PATCH 1/3] Fixes #6820 Readds missing check, makes hoverpods their own mech type and moves them to another folder. --- baystation12.dme | 2 +- code/game/mecha/equipment/mecha_equipment.dm | 3 + code/game/mecha/equipment/tools/tools.dm | 2 +- .../mecha/{working => hoverpod}/hoverpod.dm | 90 +++++++++++-------- .../structures/crates_lockers/largecrate.dm | 2 +- 5 files changed, 58 insertions(+), 41 deletions(-) rename code/game/mecha/{working => hoverpod}/hoverpod.dm (70%) diff --git a/baystation12.dme b/baystation12.dme index 35c47edeb64..38e54e0b4ea 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -432,9 +432,9 @@ #include "code\game\mecha\equipment\tools\medical_tools.dm" #include "code\game\mecha\equipment\tools\tools.dm" #include "code\game\mecha\equipment\weapons\weapons.dm" +#include "code\game\mecha\hoverpod\hoverpod.dm" #include "code\game\mecha\medical\medical.dm" #include "code\game\mecha\medical\odysseus.dm" -#include "code\game\mecha\working\hoverpod.dm" #include "code\game\mecha\working\ripley.dm" #include "code\game\mecha\working\working.dm" #include "code\game\objects\empulse.dm" diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index 7e19e787a92..2a6e2b62144 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -95,6 +95,9 @@ return /obj/item/mecha_parts/mecha_equipment/proc/can_attach(obj/mecha/M as obj) + if(M.equipment.len >= M.max_equip) + return 0 + if (ispath(required_type)) return istype(M, required_type) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index 2adf280a6ba..d7783b351c9 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -5,7 +5,7 @@ energy_drain = 10 var/dam_force = 20 var/obj/mecha/working/ripley/cargo_holder - required_type = /obj/mecha/working + required_type = list(/obj/mecha/working, /obj/mecha/hoverpod) //so that hoverpods are a bit more useful as space transportation attach(obj/mecha/M as obj) ..() diff --git a/code/game/mecha/working/hoverpod.dm b/code/game/mecha/hoverpod/hoverpod.dm similarity index 70% rename from code/game/mecha/working/hoverpod.dm rename to code/game/mecha/hoverpod/hoverpod.dm index 38b2815ca23..4d8c2d77b01 100644 --- a/code/game/mecha/working/hoverpod.dm +++ b/code/game/mecha/hoverpod/hoverpod.dm @@ -1,8 +1,9 @@ -/obj/mecha/working/hoverpod +/obj/mecha/hoverpod desc = "Stubby and round, this space-capable craft is an ancient favorite." name = "Hover Pod" icon_state = "engineering_pod" initial_icon = "engineering_pod" + internal_damage_threshold = 80 step_in = 4 step_energy_drain = 5 max_temperature = 20000 @@ -11,10 +12,21 @@ wreckage = /obj/effect/decal/mecha_wreckage/hoverpod var/list/cargo = new var/cargo_capacity = 3 - max_equip = 3 + max_equip = 2 + var/ion_trail = new /datum/effect/effect/system/ion_trail_follow() -//duplicate of parent proc, but without space drifting -/obj/mecha/working/hoverpod/dyndomove(direction) +/obj/mecha/hoverpod/New() + ..() + var/turf/T = get_turf(src) + if(T.z != 2) + new /obj/item/mecha_parts/mecha_tracking(src) + return + +/obj/mecha/hoverpod/range_action(atom/target as obj|mob|turf) + return + +//No space drifting +/obj/mecha/hoverpod/dyndomove(direction) if(!can_move) return 0 if(src.pr_inertial_movement.active()) @@ -41,56 +53,30 @@ return 0 //these three procs overriden to play different sounds -/obj/mecha/working/hoverpod/mechturn(direction) +/obj/mecha/hoverpod/mechturn(direction) dir = direction //playsound(src,'sound/machines/hiss.ogg',40,1) return 1 -/obj/mecha/working/hoverpod/mechstep(direction) +/obj/mecha/hoverpod/mechstep(direction) var/result = step(src,direction) if(result) playsound(src,'sound/machines/hiss.ogg',40,1) return result -/obj/mecha/working/hoverpod/mechsteprand() +/obj/mecha/hoverpod/mechsteprand() var/result = step_rand(src) if(result) playsound(src,'sound/machines/hiss.ogg',40,1) return result -/* -/obj/mecha/working/hoverpod/New() - ..() - return -*/ - -/obj/mecha/working/hoverpod/combatpod - desc = "An ancient, ghetto fighter." // Ideally would have a seperate icon. - name = "Combat Hoverpod" - -/obj/mecha/working/hoverpod/combatpod/New() - ..() - var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/weapon/energy/laser - ME.attach(src) - ME = new /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/explosive - ME.attach(src) - -/obj/mecha/working/hoverpod/shuttlepod - desc = "Who knew a tiny ball could fit three people?" -/obj/mecha/working/hoverpod/shuttlepod/New() - ..() - var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/tool/passenger - ME.attach(src) - ME = new /obj/item/mecha_parts/mecha_equipment/tool/passenger - ME.attach(src) - -/obj/mecha/working/hoverpod/Exit(atom/movable/O) +/obj/mecha/hoverpod/Exit(atom/movable/O) if(O in cargo) return 0 return ..() -/obj/mecha/working/hoverpod/Topic(href, href_list) +/obj/mecha/hoverpod/Topic(href, href_list) ..() if(href_list["drop_from_cargo"]) var/obj/O = locate(href_list["drop_from_cargo"]) @@ -105,7 +91,7 @@ return -/obj/mecha/working/hoverpod/get_stats_part() +/obj/mecha/hoverpod/get_stats_part() var/output = ..() output += "Cargo Compartment Contents:
" if(src.cargo.len) @@ -116,7 +102,7 @@ output += "
" return output -/obj/mecha/working/hoverpod/Del() +/obj/mecha/hoverpod/Del() for(var/mob/M in src) if(M==src.occupant) continue @@ -130,4 +116,32 @@ T.Entered(A) step_rand(A) ..() - return \ No newline at end of file + return + +//Hoverpod variants + +/* Commented out the combatpod as they can't reattach their equipment if it ever gets dropped, + * and making a special exception for them seems lame. +/obj/mecha/hoverpod/combatpod + desc = "An ancient, run-down combat spacecraft." // Ideally would have a seperate icon. + name = "Combat Hoverpod" + health = 200 + internal_damage_threshold = 35 + +/obj/mecha/hoverpod/combatpod/New() + ..() + var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/weapon/energy/laser + ME.attach(src) + ME = new /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/explosive + ME.attach(src) +*/ + +/obj/mecha/hoverpod/shuttlepod + desc = "Who knew a tiny ball could fit three people?" + +/obj/mecha/hoverpod/shuttlepod/New() + ..() + var/obj/item/mecha_parts/mecha_equipment/ME = new /obj/item/mecha_parts/mecha_equipment/tool/passenger + ME.attach(src) + ME = new /obj/item/mecha_parts/mecha_equipment/tool/passenger + ME.attach(src) \ No newline at end of file diff --git a/code/game/objects/structures/crates_lockers/largecrate.dm b/code/game/objects/structures/crates_lockers/largecrate.dm index 51c0ec2baa8..2923ba2321b 100644 --- a/code/game/objects/structures/crates_lockers/largecrate.dm +++ b/code/game/objects/structures/crates_lockers/largecrate.dm @@ -70,5 +70,5 @@ /obj/structure/largecrate/hoverpod/attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/crowbar)) - new /obj/mecha/working/hoverpod(loc) + new /obj/mecha/hoverpod(loc) ..() \ No newline at end of file From e8f3524b11da17455ab2cbb1ac379150230c7e6a Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 22 Oct 2014 21:56:43 -0400 Subject: [PATCH 2/3] Fixes #6822 --- code/game/mecha/equipment/tools/tools.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index d7783b351c9..42f5debc622 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -1163,6 +1163,10 @@ if (!usr.Adjacent(src)) return + if (!isturf(usr.loc)) + usr << "\red You can't reach the passenger compartment from here." + return + if(iscarbon(usr)) var/mob/living/carbon/C = usr if(C.handcuffed) From a8a0d6f1cfae592d92ee2d4a0d9026518ed5588d Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 22 Oct 2014 23:50:51 -0400 Subject: [PATCH 3/3] Cleans up hovererpod move code, adds ion trails No need to duplicate the mecha move code when we're only interested in drifting. The hoverpod also starts drifting when it runs out of power, now. --- code/game/mecha/hoverpod/hoverpod.dm | 41 ++++++++++------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/code/game/mecha/hoverpod/hoverpod.dm b/code/game/mecha/hoverpod/hoverpod.dm index 4d8c2d77b01..e44feccca63 100644 --- a/code/game/mecha/hoverpod/hoverpod.dm +++ b/code/game/mecha/hoverpod/hoverpod.dm @@ -5,7 +5,7 @@ initial_icon = "engineering_pod" internal_damage_threshold = 80 step_in = 4 - step_energy_drain = 5 + step_energy_drain = 10 max_temperature = 20000 health = 150 infra_luminosity = 6 @@ -13,44 +13,31 @@ var/list/cargo = new var/cargo_capacity = 3 max_equip = 2 - var/ion_trail = new /datum/effect/effect/system/ion_trail_follow() + var/datum/effect/effect/system/ion_trail_follow/ion_trail /obj/mecha/hoverpod/New() ..() var/turf/T = get_turf(src) if(T.z != 2) new /obj/item/mecha_parts/mecha_tracking(src) - return + + ion_trail = new /datum/effect/effect/system/ion_trail_follow() + ion_trail.set_up(src) + ion_trail.start() /obj/mecha/hoverpod/range_action(atom/target as obj|mob|turf) return //No space drifting -/obj/mecha/hoverpod/dyndomove(direction) - if(!can_move) - return 0 - if(src.pr_inertial_movement.active()) - return 0 - if(!has_charge(step_energy_drain)) - return 0 - var/move_result = 0 - if(hasInternalDamage(MECHA_INT_CONTROL_LOST)) - move_result = mechsteprand() - else if(src.dir!=direction) - move_result = mechturn(direction) - else - move_result = mechstep(direction) - if(move_result) - can_move = 0 - use_power(step_energy_drain) - /*if(istype(src.loc, /turf/space)) - if(!src.check_for_support()) - src.pr_inertial_movement.start(list(src,direction)) - src.log_message("Movement control lost. Inertial movement started.")*/ - if(do_after(step_in)) - can_move = 1 +/obj/mecha/hoverpod/check_for_support() + //does the hoverpod have enough charge left to stabilize itself? + if (has_charge(step_energy_drain)) + if (!ion_trail.on) + ion_trail.start() return 1 - return 0 + + ion_trail.stop() + return ..() //these three procs overriden to play different sounds /obj/mecha/hoverpod/mechturn(direction)