diff --git a/code/__defines/ship_weapons.dm b/code/__defines/ship_weapons.dm index 8ffbc7d0484..1e3c6b5fbcb 100644 --- a/code/__defines/ship_weapons.dm +++ b/code/__defines/ship_weapons.dm @@ -10,8 +10,9 @@ #define NO_PROJECTILE "no projectile" #define SHIP_HAZARD_TARGET "Automatic Hazard Targeting" -#define SHIP_AMMO_CAN_HIT_HAZARDS 1 -#define SHIP_AMMO_CAN_HIT_SHIPS 2 +#define SHIP_AMMO_CAN_HIT_HAZARDS 1 +#define SHIP_AMMO_CAN_HIT_VISITABLES 2 +#define SHIP_AMMO_CAN_HIT_PLANETS 4 #define SHIP_AMMO_IMPACT_HE "high explosive" #define SHIP_AMMO_IMPACT_FMJ "full metal jacket" @@ -45,3 +46,7 @@ #define OVERMAP_PROJECTILE_RANGE_MEDIUMHIGH 15 #define OVERMAP_PROJECTILE_RANGE_HIGH 25 #define OVERMAP_PROJECTILE_RANGE_ULTRAHIGH 30 + +//Targeting flags for overmap effects. +#define TARGETING_FLAG_GENERIC_WAYPOINTS 1 +#define TARGETING_FLAG_ENTRYPOINTS 2 \ No newline at end of file diff --git a/code/modules/overmap/overmap_object.dm b/code/modules/overmap/overmap_object.dm index 5caa9266593..a01c2f18821 100644 --- a/code/modules/overmap/overmap_object.dm +++ b/code/modules/overmap/overmap_object.dm @@ -54,7 +54,7 @@ var/obj/machinery/computer/ship/targeting/GS = H.machine if(GS.targeting) return - if(!istype(GS.connected.loc, /turf/unsimulated/map)) + if(!istype(GS.linked.loc, /turf/unsimulated/map)) to_chat(H, SPAN_WARNING("The safeties won't let you target while you're not on the Overmap!")) return var/my_sector = map_sectors["[H.z]"] @@ -79,10 +79,16 @@ targeting = O O.targeted_overlay = icon('icons/obj/overmap_heads_up_display.dmi', "lock") O.add_overlay(O.targeted_overlay) - if(!O.maptext) - O.maptext = SMALL_FONTS(6, "[class] [designation]") + if(designation && class && !obfuscated) + if(!O.maptext) + O.maptext = SMALL_FONTS(6, "[class] [designation]") + else + O.maptext += SMALL_FONTS(6, " [class] [designation]") else - O.maptext += SMALL_FONTS(6, " [class] [designation]") + if(!O.maptext) + O.maptext = SMALL_FONTS(6, "[capitalize_first_letters(name)]") + else + O.maptext = SMALL_FONTS(6, " [capitalize_first_letters(name)]") O.maptext_y = 32 O.maptext_x = -10 O.maptext_width = 72 diff --git a/code/modules/overmap/sectors.dm b/code/modules/overmap/sectors.dm index e5f7811ab09..0b5ae320a67 100644 --- a/code/modules/overmap/sectors.dm +++ b/code/modules/overmap/sectors.dm @@ -27,6 +27,7 @@ var/global/area/overmap/map_overmap // Global object used to locate the overmap var/has_called_distress_beacon = FALSE var/image/applied_distress_overlay + var/targeting_flags = TARGETING_FLAG_ENTRYPOINTS|TARGETING_FLAG_GENERIC_WAYPOINTS var/list/obj/machinery/ship_weapon/ship_weapons var/list/obj/effect/landmark/entry_points var/obj/effect/overmap/targeting diff --git a/code/modules/overmap/ship_weaponry/_ship_ammunition.dm b/code/modules/overmap/ship_weaponry/_ship_ammunition.dm index 8cfb6b46461..1551d28a860 100644 --- a/code/modules/overmap/ship_weaponry/_ship_ammunition.dm +++ b/code/modules/overmap/ship_weaponry/_ship_ammunition.dm @@ -16,7 +16,7 @@ var/ammunition_status = SHIP_AMMO_STATUS_GOOD //Currently unused, but will be relevant for chemical ammo. var/ammunition_flags = SHIP_AMMO_FLAG_INFLAMMABLE|SHIP_AMMO_FLAG_VERY_HEAVY var/ammunition_behaviour = SHIP_AMMO_BEHAVIOUR_DUMBFIRE //Not a bitfield! - var/overmap_behaviour = SHIP_AMMO_CAN_HIT_HAZARDS|SHIP_AMMO_CAN_HIT_SHIPS //Whether or not the ammo can hit hazards or ships, or both. + var/overmap_behaviour = SHIP_AMMO_CAN_HIT_HAZARDS|SHIP_AMMO_CAN_HIT_VISITABLES|SHIP_AMMO_CAN_HIT_PLANETS //Whether or not the ammo can hit hazards or ships, and so on. var/overmap_icon_state = "cannon" var/obj/effect/overmap/origin var/atom/overmap_target diff --git a/code/modules/overmap/ship_weaponry/_ship_gun.dm b/code/modules/overmap/ship_weaponry/_ship_gun.dm index 5f4c2333bff..2aae42f43de 100644 --- a/code/modules/overmap/ship_weaponry/_ship_gun.dm +++ b/code/modules/overmap/ship_weaponry/_ship_gun.dm @@ -23,6 +23,7 @@ var/screenshake_type = SHIP_GUN_SCREENSHAKE_SCREEN var/firing = FALSE //Helper variable in case we need to track if we're firing or not. Must be set manually. Used for the Leviathan. var/load_time = 5 SECONDS + var/mobile_platform = FALSE //When toggled, targeting computers will be able to force ammunition heading direction. Used for guns on visitables. var/weapon_id //Used to identify a gun in the targeting consoles and connect weapon systems to the relevant ammunition loader. Must be unique! var/list/obj/structure/ship_weapon_dummy/connected_dummies = list() @@ -128,8 +129,8 @@ qdel(dummy) connected_dummies.Cut() -/obj/machinery/ship_weapon/proc/pre_fire(var/atom/target, var/obj/effect/landmark/landmark) //We can fire, so what do we do before that? Think like a laser charging up. - fire(target, landmark) +/obj/machinery/ship_weapon/proc/pre_fire(var/atom/target, var/obj/effect/landmark/landmark, var/direction_override) //We can fire, so what do we do before that? Think like a laser charging up. + fire(target, landmark, direction_override) on_fire() return TRUE @@ -204,16 +205,16 @@ else return FALSE -/obj/machinery/ship_weapon/proc/firing_command(var/atom/target, var/obj/landmark) +/obj/machinery/ship_weapon/proc/firing_command(var/atom/target, var/obj/landmark, var/direction_override) if(firing_checks()) - var/result = pre_fire(target, landmark) + var/result = pre_fire(target, landmark, direction_override) if(result) use_power_oneoff(active_power_usage) return SHIP_GUN_FIRING_SUCCESSFUL else return SHIP_GUN_ERROR_NO_AMMO -/obj/machinery/ship_weapon/proc/fire(var/atom/overmap_target, var/obj/landmark) +/obj/machinery/ship_weapon/proc/fire(var/atom/overmap_target, var/obj/landmark, var/direction_override) var/obj/item/ship_ammunition/SA = consume_ammo() if(!barrel) crash_with("No barrel found for [src] at [x] [y] [z]! Cannot fire!") @@ -231,7 +232,9 @@ SA.overmap_target = overmap_target SA.entry_point = landmark SA.origin = linked - if(istype(linked, /obj/effect/overmap/visitable/ship)) + if(direction_override) + SA.heading = direction_override + else if(istype(linked, /obj/effect/overmap/visitable/ship)) var/obj/effect/overmap/visitable/ship/SH = linked SA.heading = SH.dir else @@ -317,6 +320,7 @@ light_color = LIGHT_COLOR_CYAN var/obj/machinery/ship_weapon/cannon var/selected_entrypoint + var/platform_direction var/list/names_to_guns = list() var/list/names_to_entries = list() @@ -327,7 +331,7 @@ /obj/machinery/computer/ship/targeting/LateInitialize() if(current_map.use_overmap && !linked) var/my_sector = map_sectors["[z]"] - if(istype(my_sector, /obj/effect/overmap/visitable/ship)) + if(istype(my_sector, /obj/effect/overmap/visitable)) attempt_hook_up(my_sector) /obj/machinery/computer/ship/targeting/Destroy() @@ -344,7 +348,7 @@ ui.open() /obj/machinery/computer/ship/targeting/proc/build_gun_lists() - for(var/obj/machinery/ship_weapon/SW in connected.ship_weapons) + for(var/obj/machinery/ship_weapon/SW in linked.ship_weapons) if(!SW.special_firing_mechanism) var/gun_name = capitalize_first_letters(SW.weapon_id) names_to_guns[gun_name] = SW @@ -363,12 +367,14 @@ data["entry_points"] = list() data["entry_point"] = null data["show_z_list"] = FALSE + data["mobile_platform"] = FALSE + data["platform_direction"] = 0 data["selected_z"] = 0 data["power"] = stat & (NOPOWER|BROKEN) ? FALSE : TRUE - data["linked"] = connected ? TRUE : FALSE + data["linked"] = linked ? TRUE : FALSE - if(connected) - data["is_targeting"] = connected.targeting ? TRUE : FALSE + if(linked) + data["is_targeting"] = linked.targeting ? TRUE : FALSE data["ship_weapons"] = list() for(var/name in names_to_guns) data["ship_weapons"] += name //Literally do not even ask me why the FUCK this is needed. I have ZERO, **ZERO** FUCKING CLUE why @@ -385,22 +391,26 @@ ammunition_type = capitalize_first_letters(SA.impact_type) data["ammunition"] = length(cannon.ammunition) ? "[ammunition_type] Loaded, [length(cannon.ammunition)] shot(s) left" : "Unloaded" data["caliber"] = cannon.caliber - if(connected.targeting) + if(cannon.mobile_platform) + data["mobile_platform"] = TRUE + data["directions"] = list("NORTH", "NORTHEAST", "EAST", "SOUTHEAST", "SOUTH", "SOUTHWEST", "WEST", "NORTHWEST") + platform_direction = data["platform_direction"] + if(linked.targeting) data["target"] = "" - if(istype(connected.targeting, /obj/effect/overmap/visitable)) - var/obj/effect/overmap/visitable/V = connected.targeting + if(istype(linked.targeting, /obj/effect/overmap/visitable)) + var/obj/effect/overmap/visitable/V = linked.targeting if(V.class && V.designation) data["target"] = "[V.class] [V.designation]" else - data["target"] = capitalize_first_letters(connected.targeting.name) + data["target"] = capitalize_first_letters(linked.targeting.name) if(length(V.map_z) > 1) data["show_z_list"] = TRUE data["z_levels"] = V.map_z.Copy() else data["selected_z"] = 0 else - data["target"] = capitalize_first_letters(connected.targeting.name) - data["dist"] = get_dist(connected, connected.targeting) + data["target"] = capitalize_first_letters(linked.targeting.name) + data["dist"] = get_dist(linked, linked.targeting) data["entry_points"] = copy_entrypoints(data["selected_z"]) if(data["entry_point"]) selected_entrypoint = data["entry_point"] @@ -410,6 +420,8 @@ var/datum/vueui/ui = href_list["vueui"] if(!istype(ui)) return + if(..()) + return playsound(src, clicksound, clickvol) @@ -417,14 +429,14 @@ var/obj/effect/landmark/LM if(!selected_entrypoint) return - if(!istype(connected.loc, /turf/unsimulated/map)) + if(!istype(linked.loc, /turf/unsimulated/map)) to_chat(usr, SPAN_WARNING("The safeties are engaged! You need to be undocked in order to fire.")) return if(selected_entrypoint == SHIP_HAZARD_TARGET || !selected_entrypoint) LM = null else LM = names_to_entries[selected_entrypoint] - var/result = cannon.firing_command(linked.targeting, LM) + var/result = cannon.firing_command(linked.targeting, LM, platform_direction ? text2dir(platform_direction) : 0) if(isliving(usr) && !isAI(usr) && usr.Adjacent(src)) visible_message(SPAN_WARNING("[usr] presses the fire button!")) playsound(src, 'sound/machines/compbeep1.ogg') @@ -441,13 +453,14 @@ /obj/machinery/computer/ship/targeting/proc/copy_entrypoints(var/z_level_filter = 0) . = list() - if(istype(connected.targeting, /obj/effect/overmap/visitable)) + if(istype(linked.targeting, /obj/effect/overmap/visitable)) var/obj/effect/overmap/visitable/V = linked.targeting - for(var/obj/effect/O in V.entry_points) - if(!z_level_filter || (z_level_filter && O.z == z_level_filter)) - . += capitalize_first_letters(O.name) - names_to_entries[capitalize_first_letters(O.name)] = O - if(!istype(connected.targeting, /obj/effect/overmap/visitable/ship)) + if(V.targeting_flags & TARGETING_FLAG_ENTRYPOINTS) + for(var/obj/effect/O in V.entry_points) + if(!z_level_filter || (z_level_filter && O.z == z_level_filter)) + . += capitalize_first_letters(O.name) + names_to_entries[capitalize_first_letters(O.name)] = O + if(V.targeting_flags & TARGETING_FLAG_GENERIC_WAYPOINTS) for(var/obj/effect/O in V.generic_waypoints) . += capitalize_first_letters(O.name) names_to_entries[capitalize_first_letters(O.name)] = O diff --git a/code/modules/overmap/ship_weaponry/projectiles/_overmap_projectiles.dm b/code/modules/overmap/ship_weaponry/projectiles/_overmap_projectiles.dm index 65707fd9884..3749faeb528 100644 --- a/code/modules/overmap/ship_weaponry/projectiles/_overmap_projectiles.dm +++ b/code/modules/overmap/ship_weaponry/projectiles/_overmap_projectiles.dm @@ -78,7 +78,7 @@ if(istype(A, /obj/effect/overmap/visitable)) var/obj/effect/overmap/visitable/V = A if((V.check_ownership(entry_target)) || (V == target)) //Target spotted! - if(istype(V, /obj/effect/overmap/visitable/sector/exoplanet) && (ammunition.overmap_behaviour & SHIP_AMMO_CAN_HIT_SHIPS)) + if(istype(V, /obj/effect/overmap/visitable/sector/exoplanet) && (ammunition.overmap_behaviour & SHIP_AMMO_CAN_HIT_PLANETS)) . = TRUE //Manually stopping because this proc needs to sleep for a bit. prepare_for_entry() @@ -97,7 +97,7 @@ say_dead_direct("A projectile ([name]) has entered a z-level at [entry_target.name]!") qdel(widowmaker) qdel(src) - else if(istype(V, /obj/effect/overmap/visitable) && (ammunition.overmap_behaviour & SHIP_AMMO_CAN_HIT_SHIPS)) + else if(istype(V, /obj/effect/overmap/visitable) && (ammunition.overmap_behaviour & SHIP_AMMO_CAN_HIT_VISITABLES)) . = TRUE if(istype(V, /obj/effect/overmap/visitable/ship)) var/obj/effect/overmap/visitable/ship/VS = V @@ -105,6 +105,8 @@ var/naval_heading = SSatlas.headings_to_naval["[VS.dir]"]["[ammunition.heading]"] var/corrected_heading = SSatlas.naval_to_dir["[VS.fore_dir]"][naval_heading] ammunition.heading = corrected_heading + else //if it's not a ship it doesn't have a fore direction, so we need to autocorrect + ammunition.heading = entry_target.dir prepare_for_entry() var/obj/item/projectile/ship_ammo/widowmaker = new ammunition.original_projectile.type widowmaker.ammo = ammunition @@ -153,5 +155,5 @@ /obj/effect/overmap/projectile/Bump(var/atom/A) if(istype(A,/turf/unsimulated/map/edge)) - qdel(src) + handle_wraparound() ..() \ No newline at end of file diff --git a/html/changelogs/mattatlas-yetmorelarp.yml b/html/changelogs/mattatlas-yetmorelarp.yml new file mode 100644 index 00000000000..8f1567e1ffe --- /dev/null +++ b/html/changelogs/mattatlas-yetmorelarp.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Ship weapons can now be used on visitables that aren't ships." + - rscadd: "Added (currently unused) functionality that lets ship weapon targeting manually choose a direction." diff --git a/vueui/src/components/view/machinery/gunnery.vue b/vueui/src/components/view/machinery/gunnery.vue index b9cea0c9b35..5ca407c4c59 100644 --- a/vueui/src/components/view/machinery/gunnery.vue +++ b/vueui/src/components/view/machinery/gunnery.vue @@ -45,6 +45,13 @@
Status: {{status}}
Ammunition: {{ammunition}}
Caliber: {{caliber}}
+
+
Mobile Platform Direction: + +
+
FIRE