diff --git a/nsv13/code/__DEFINES/components.dm b/nsv13/code/__DEFINES/components.dm index 105ea218e06..df2ee8bd716 100644 --- a/nsv13/code/__DEFINES/components.dm +++ b/nsv13/code/__DEFINES/components.dm @@ -2,7 +2,11 @@ #define COMSIG_FTL_STATE_CHANGE "ftl_state_change" #define COMSIG_MOB_ITEM_EQUIPPED "mob_item_equipped" //Used for aiming component, tells you when a mob equips ANY item #define COMSIG_MOB_ITEM_DROPPED "mob_item_dropped" -#define COMSIG_LOCK_LOST "lock_lost" // When we lost lock on a ship + +// Ship targeting signals +#define COMSIG_TARGET_PAINTED "target_painted" //! from base of /obj/structure/overmap/proc/finish_lockon: (target, data_link_origin) +#define COMSIG_TARGET_LOCKED "target_locked" //! from base of /obj/structure/overmap/proc/select_target: (target) +#define COMSIG_LOCK_LOST "lock_lost" //! from base of /obj/structure/overmap/proc/dump_lock: (target) #define COMSIG_SHIP_RELEASE_BOARDING "release_boarding" #define COMSIG_SHIP_BLOCKS_RELEASE_BOARDING 1 diff --git a/nsv13/code/game/general_quarters/dropship.dm b/nsv13/code/game/general_quarters/dropship.dm index d075c2e01f7..54fa037683d 100644 --- a/nsv13/code/game/general_quarters/dropship.dm +++ b/nsv13/code/game/general_quarters/dropship.dm @@ -63,7 +63,7 @@ /area/dropship/get_virtual_z(turf/T) if(linked_dropship) - return linked_dropship.get_virtual_z_level() + return linked_dropship.get_interior_virtual_z() return ..() //If we ever want to let them build these things.. diff --git a/nsv13/code/game/general_quarters/dropship_types.dm b/nsv13/code/game/general_quarters/dropship_types.dm index 322745c3c05..679cdd261ad 100644 --- a/nsv13/code/game/general_quarters/dropship_types.dm +++ b/nsv13/code/game/general_quarters/dropship_types.dm @@ -73,7 +73,7 @@ Credit to TGMC for the interior sprites for all these! starmap.linked = src // Z override for transports. This returns our aircraft's unique Z. -/obj/structure/overmap/small_craft/transport/get_virtual_z_level() +/obj/structure/overmap/small_craft/transport/proc/get_interior_virtual_z() return linked_virtual_z != null ? linked_virtual_z : 0; /datum/map_template/dropship diff --git a/nsv13/code/modules/overmap/fighters/fuel_tank.dm b/nsv13/code/modules/overmap/fighters/fuel_tank.dm index 66ea57a952c..5b8aff2ac01 100644 --- a/nsv13/code/modules/overmap/fighters/fuel_tank.dm +++ b/nsv13/code/modules/overmap/fighters/fuel_tank.dm @@ -20,6 +20,13 @@ var/allow_refuel = FALSE var/units_per_second = 50 +/obj/structure/reagent_dispensers/fueltank/cryogenic_fuel/Destroy() + QDEL_NULL(current_beam) + QDEL_NULL(nozzle) + QDEL_NULL(soundloop) + fuel_target = null + . = ..() + /obj/structure/reagent_dispensers/fueltank/cryogenic_fuel/ui_act(action, params, datum/tgui/ui) if(..()) return diff --git a/nsv13/code/modules/overmap/fighters/modules/refueling_kit.dm b/nsv13/code/modules/overmap/fighters/modules/refueling_kit.dm index 3a46f9c21f6..f24081ded6d 100644 --- a/nsv13/code/modules/overmap/fighters/modules/refueling_kit.dm +++ b/nsv13/code/modules/overmap/fighters/modules/refueling_kit.dm @@ -4,13 +4,28 @@ icon_state = "resupply_tier1" overmap_firing_sounds = list( 'nsv13/sound/effects/fighters/refuel.ogg') - fire_delay = 6 SECONDS + fire_delay = 4 SECONDS bypass_safety = TRUE var/datum/beam/current_beam var/next_fuel = 0 + var/is_fuelling = TRUE + var/is_charging = TRUE var/battery_recharge_amount = 500 - var/minimum_fuel_to_keep = 200 - var/fuel_transfer_rate = 100 + var/minimum_fuel_to_keep = 250 + var/fuel_transfer_rate = 50 + var/refuel_range = 10 + +/obj/item/fighter_component/primary/utility/refuel/on_install(obj/structure/overmap/target) + . = ..() + RegisterSignal(target, COMSIG_TARGET_LOCKED, PROC_REF(on_target_lock)) + +/obj/item/fighter_component/primary/utility/refuel/remove_from(obj/structure/overmap/target) + . = ..() + UnregisterSignal(target, COMSIG_TARGET_LOCKED) + +/obj/item/fighter_component/primary/utility/refuel/proc/on_target_lock(obj/structure/overmap/us, obj/structure/overmap/target) + is_fuelling = TRUE + is_charging = TRUE /obj/item/fighter_component/primary/utility/refuel/get_ammo() var/obj/structure/overmap/small_craft/F = loc @@ -27,13 +42,13 @@ /obj/item/fighter_component/primary/utility/refuel/tier2 name = "upgraded air to air resupply kit" icon_state = "resupply_tier2" - fire_delay = 5 SECONDS + fire_delay = 3 SECONDS tier = 2 /obj/item/fighter_component/primary/utility/refuel/tier3 name = "super air to air resupply kit" icon_state = "resupply_tier3" - fire_delay = 3 SECONDS + fire_delay = 2 SECONDS tier = 3 /obj/item/fighter_component/primary/utility/refuel/proc/cancel_action(obj/structure/overmap/us, obj/structure/overmap/them, message) @@ -41,7 +56,7 @@ QDEL_NULL(current_beam) // Remove targeting if(us && LAZYFIND(us.target_painted, them)) - us.start_lockon(them) + us.dump_lock(them) if(us && us.gunner && message) to_chat(us.gunner, message) @@ -53,54 +68,66 @@ // The component isn't installed, we're not on that mode, or we have no potential targets var/obj/structure/overmap/small_craft/us = loc if(!us || !istype(us) || (us.fire_mode != fire_mode) || !length(us.target_painted)) - cancel_action(us) return // The target isn't an overmap somehow, we're targeting ourselves, or they're an enemy var/obj/structure/overmap/small_craft/them = us.target_lock if(!them || !istype(them) || (them == us) || (them.faction != us.faction)) cancel_action(us, them) return + // We're out of range + if(overmap_dist(us, them) > refuel_range) + cancel_action(us, them, "Target out of range.") + return // Getting here means we should actually try refueling them next_fuel = world.time + fire_delay - if(!transfer_fuel(us, them) || jump_battery(us, them)) + if(is_fuelling) + var/fuel_message = transfer_fuel(us, them) + if(fuel_message) + to_chat(us.gunner, fuel_message) + is_fuelling = FALSE + + if(is_charging) + var/charge_message = jump_battery(us, them) + if(charge_message) + to_chat(us.gunner, charge_message) + is_charging = FALSE + + if(!is_fuelling && !is_charging) + cancel_action(us, them, "All operations complete. Disconnecting transfer equipment.") return + // See if we need to make a new beam. Comes after the refuel so we can not do this if we fail any checks. if(QDELETED(current_beam)) current_beam = new(us,them,beam_icon='nsv13/icons/effects/beam.dmi',time=INFINITY,maxdistance = INFINITY,beam_icon_state="hose",btype=/obj/effect/ebeam/fuel_hose) INVOKE_ASYNC(current_beam, TYPE_PROC_REF(/datum/beam, Start)) +// These procs handle transferring fuel/charge. If a string is returned, it means we're done. If FALSE is returned, we're not done. /obj/item/fighter_component/primary/utility/refuel/proc/transfer_fuel(obj/structure/overmap/small_craft/us, obj/structure/overmap/small_craft/them) var/transfer_amount = CLAMP((them.get_max_fuel() - them.get_fuel()), 0, fuel_transfer_rate) if(transfer_amount <= 0) - cancel_action(us, them, "Fuel tank is full.") - return - if(them.get_fuel() <= minimum_fuel_to_keep) // Don't give away ALL our fuel - cancel_action(us, them, "Fuel is below minimum safe transfer level.") - return + return "Target craft is fully fueled." + if(us.get_fuel() <= minimum_fuel_to_keep) // Don't give away ALL our fuel + return "Fuel levels below minimum safe transfer level." var/obj/item/fighter_component/fuel_tank/ourTank = us.loadout.get_slot(HARDPOINT_SLOT_FUEL) var/obj/item/fighter_component/fuel_tank/theirTank = them.loadout.get_slot(HARDPOINT_SLOT_FUEL) us.relay('nsv13/sound/effects/fighters/refuel.ogg') them.relay('nsv13/sound/effects/fighters/refuel.ogg') ourTank.reagents.trans_to(theirTank, transfer_amount) - return TRUE + return /obj/item/fighter_component/primary/utility/refuel/proc/jump_battery(obj/structure/overmap/small_craft/us, obj/structure/overmap/small_craft/them) var/obj/item/fighter_component/battery/ourBattery = us.loadout.get_slot(HARDPOINT_SLOT_BATTERY) if(!ourBattery || !istype(ourBattery)) - cancel_action(us, them, "This craft has no battery installed!") - return + return "This craft has no battery installed!" var/obj/item/fighter_component/battery/theirBattery = them.loadout.get_slot(HARDPOINT_SLOT_BATTERY) if(!theirBattery || !istype(theirBattery)) - cancel_action(us, them, "The target has no battery installed!") - return - if(!ourBattery.charge < (battery_recharge_amount * 2)) - cancel_action(us, them, "Battery charge is below minimum safe transfer level.") - return - if(!(theirBattery.charge < battery_recharge_amount)) - cancel_action(us, them, "Battery levels nominal.") - return + return "The target has no battery installed!" + if(ourBattery.charge < (battery_recharge_amount * 2)) + return "Battery charge is below minimum safe transfer level." + if(!(theirBattery.charge < theirBattery.maxcharge)) + return "Target craft is fully charged." theirBattery.give(battery_recharge_amount) //Jumpstart their battery ourBattery.use_power(battery_recharge_amount) - return TRUE + return diff --git a/nsv13/code/modules/overmap/fighters/modules/repair_kit.dm b/nsv13/code/modules/overmap/fighters/modules/repair_kit.dm index 2646696e82b..7bfb7d3f063 100644 --- a/nsv13/code/modules/overmap/fighters/modules/repair_kit.dm +++ b/nsv13/code/modules/overmap/fighters/modules/repair_kit.dm @@ -8,6 +8,8 @@ bypass_safety = TRUE var/datum/beam/current_beam = null var/next_repair = 0 + var/foam_consumption = 20 + var/repair_range = 10 /obj/item/fighter_component/primary/utility/repairer/get_ammo() return magazine?.reagents.total_volume @@ -20,12 +22,14 @@ icon_state = "repairer_tier2" tier = 2 fire_delay = 4 SECONDS + foam_consumption = 15 /obj/item/fighter_component/primary/utility/repairer/tier3 name = "super air to air repair kit" icon_state = "repairer_tier3" tier = 3 fire_delay = 3 SECONDS + foam_consumption = 10 /obj/item/fighter_component/primary/utility/repairer/load(obj/structure/overmap/target, atom/movable/AM) if(!istype(AM, accepted_ammo)) @@ -43,7 +47,7 @@ QDEL_NULL(current_beam) // Remove targeting if(us && LAZYFIND(us.target_painted, them)) - us.start_lockon(them) + us.dump_lock(them) if(us && us.gunner && message) to_chat(us.gunner, message) @@ -55,13 +59,16 @@ // The component isn't installed, we're not on that mode, or we have no potential targets var/obj/structure/overmap/small_craft/us = loc if(!us || !istype(us) || (us.fire_mode != fire_mode) || !length(us.target_painted)) - cancel_action(us) return // The target isn't an overmap somehow, we're targeting ourselves, or they're an enemy var/obj/structure/overmap/small_craft/them = us.target_lock if(!them || !istype(them) || (them == us) || (them.faction != us.faction)) cancel_action(us, them) return + // We're out of range + if(overmap_dist(us, them) > repair_range) + cancel_action(us, them, "Target out of range.") + return // We don't have a hull foam tank var/obj/structure/reagent_dispensers/foamtank/hull_repair_juice/tank = magazine if(!tank || !istype(tank)) @@ -69,7 +76,7 @@ return // We're out of juice if(tank.reagents.get_reagent_amount(/datum/reagent/hull_repair_juice) <= 0) - cancel_action(us, them, "Out of repair foam.") + cancel_action(us, them, "Repair foam reserves depleted.") return // They're fixed var/obj/item/fighter_component/armour_plating/theirArmour = them.loadout.get_slot(HARDPOINT_SLOT_ARMOUR) @@ -85,8 +92,9 @@ INVOKE_ASYNC(current_beam, TYPE_PROC_REF(/datum/beam, Start)) new /obj/effect/temp_visual/heal(get_turf(them), COLOR_CYAN) // Use some juice - tank.reagents.remove_reagent(/datum/reagent/hull_repair_juice, 5) - //You can repair the main ship too! However at a painfully slow rate. Higher tiers give you vastly better repairs, and bigger ships repair smaller ships way faster. - them.try_repair(0.5+tier-(them.mass-us.mass)) + tank.reagents.remove_reagent(/datum/reagent/hull_repair_juice, foam_consumption) + // You can repair the main ship too, but at a much slower rate than normal due to the increased mass. + // For reference: Fighters are repaired at a speed of 25 damage per second if done by hand. + them.try_repair(CEILING(10 * tier - (them.mass - us.mass), 5)) us.relay('sound/items/welder.ogg') them.relay('sound/items/welder2.ogg') diff --git a/nsv13/code/modules/overmap/overmap.dm b/nsv13/code/modules/overmap/overmap.dm index 86da1c84a30..e43a5e7c8f5 100644 --- a/nsv13/code/modules/overmap/overmap.dm +++ b/nsv13/code/modules/overmap/overmap.dm @@ -638,6 +638,7 @@ Proc to spool up a new Z-level for a player ship and assign it a treadmill. to_chat(gunner, "Target painted.") relay('nsv13/sound/effects/fighters/locked.ogg', message=null, loop=FALSE, channel=CHANNEL_IMPORTANT_SHIP_ALERT) RegisterSignal(target, list(COMSIG_PARENT_QDELETING, COMSIG_FTL_STATE_CHANGE), PROC_REF(dump_lock)) + SEND_SIGNAL(src, COMSIG_TARGET_PAINTED, target) if(autotarget) select_target(target) //autopaint our target @@ -652,13 +653,14 @@ Proc to spool up a new Z-level for a player ship and assign it a treadmill. update_gunner_cam() return target_lock = target + SEND_SIGNAL(src, COMSIG_TARGET_LOCKED, target) /obj/structure/overmap/proc/dump_lock(obj/structure/overmap/target) // Our locked target got destroyed/moved, dump the lock SIGNAL_HANDLER SEND_SIGNAL(src, COMSIG_LOCK_LOST, target) target_painted -= target target_last_tracked -= target - UnregisterSignal(target, COMSIG_PARENT_QDELETING) + UnregisterSignal(target, list(COMSIG_PARENT_QDELETING, COMSIG_FTL_STATE_CHANGE)) if(target_lock == target) update_gunner_cam() target_lock = null diff --git a/nsv13/code/modules/overmap/radar.dm b/nsv13/code/modules/overmap/radar.dm index b619f4bda09..23a7217a028 100644 --- a/nsv13/code/modules/overmap/radar.dm +++ b/nsv13/code/modules/overmap/radar.dm @@ -282,7 +282,7 @@ Called by add_sensor_profile_penalty if remove_in is used. if(!target) //Anomalies don't count. return if(dradis_targeting && (linked.gunner == usr || linked.pilot == usr)) - if(target.faction != linked.faction) + if(target.faction != linked.faction || (linked.can_friendly_fire() && !linked.target_lock)) linked.start_lockon(target) return linked.datalink_transmit(target)