From 046272d7f34b591ebda0be54b88d95e7ddab0c63 Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 12 Nov 2023 22:36:40 +0000 Subject: [PATCH 1/5] bah --- .../vending/vendor_types/crew/vehicle_crew.dm | 6 ++- code/game/supplyshuttle.dm | 18 ++++--- code/modules/cm_tech/implements/tank.dm | 49 +++++++------------ code/modules/vehicles/multitile/multitile.dm | 45 +++++++++-------- 4 files changed, 58 insertions(+), 60 deletions(-) diff --git a/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm b/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm index 891a2a907b39..d352936b5434 100644 --- a/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm +++ b/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm @@ -55,8 +55,10 @@ SIGNAL_HANDLER UnregisterSignal(SSdcs, COMSIG_GLOB_VEHICLE_ORDERED) - selected_vehicle = "APC" - available_categories &= ~(VEHICLE_ARMOR_AVAILABLE|VEHICLE_INTEGRAL_AVAILABLE) //APC lacks these, so we need to remove these flags to be able to access spare parts section + if(!selected_vehicle) + selected_vehicle = "APC" // The whole thing seems to be based upon the assumption you unlock tank as an override, defaulting to APC + if(selected_vehicle == "APC") + available_categories &= ~(VEHICLE_ARMOR_AVAILABLE|VEHICLE_INTEGRAL_AVAILABLE) //APC lacks these, so we need to remove these flags to be able to access spare parts section /obj/structure/machinery/cm_vending/gear/vehicle_crew/get_listed_products(mob/user) var/list/display_list = list() diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index e8f40c1d52b3..659369bef11b 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1315,6 +1315,10 @@ var/datum/controller/supply/supply_controller = new() /datum/vehicle_order/tank/has_vehicle_lock() return +/datum/vehicle_order/tank/empty + name = "Barebones M34A2 Longstreet Light Tank" + ordered_vehicle = /obj/effect/vehicle_spawner/tank + /datum/vehicle_order/apc name = "M577 Armored Personnel Carrier" ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit @@ -1327,18 +1331,19 @@ var/datum/controller/supply/supply_controller = new() name = "M577-CMD Armored Personnel Carrier" ordered_vehicle = /obj/effect/vehicle_spawner/apc_cmd/decrepit +/datum/vehicle_order/apc/empty + name = "Barebones M577 Armored Personal Carrier" + ordered_vehicle = /obj/effect/vehicle_spawner/apc + /obj/structure/machinery/computer/supplycomp/vehicle/Initialize() . = ..() vehicles = list( - /datum/vehicle_order/apc, - /datum/vehicle_order/apc/med, - /datum/vehicle_order/apc/cmd, + new /datum/vehicle_order/apc(), + new /datum/vehicle_order/apc/med(), + new /datum/vehicle_order/apc/cmd(), ) - for(var/order as anything in vehicles) - new order - if(!VehicleElevatorConsole) VehicleElevatorConsole = src @@ -1408,6 +1413,7 @@ var/datum/controller/supply/supply_controller = new() return if(!is_admin_level(SSshuttle.vehicle_elevator.z)) + to_chat(usr, SPAN_WARNING("The elevator needs to be in the crago bay dock to call a vehicle up. Ask someone to send it away.")) return if(ismaintdrone(usr)) diff --git a/code/modules/cm_tech/implements/tank.dm b/code/modules/cm_tech/implements/tank.dm index 1ce83c37eae3..17c2c00c1e6a 100644 --- a/code/modules/cm_tech/implements/tank.dm +++ b/code/modules/cm_tech/implements/tank.dm @@ -1,16 +1,3 @@ -/datum/supply_packs/vc_kit - name = "Vehicle Crewman Kits" - contains = list( - /obj/item/pamphlet/skill/vc, - /obj/item/pamphlet/skill/vc, - ) - cost = 0 - containertype = /obj/structure/closet/crate/supply - containername = "vehicle crewman kits crate" - buyable = 0 - group = "Operations" - iteration_needed = null - /obj/item/pamphlet/skill/vc name = "vehicle training manual" desc = "A manual used to quickly impart vital knowledge on driving vehicles." @@ -18,22 +5,30 @@ trait = /datum/character_trait/skills/vc bypass_pamphlet_limit = TRUE -/obj/item/tank_coupon - name = "tank coupon" - desc = "A coupon to be used for ASRS Vehicle Consoles to grant the wearer a TANK! One use only." +/obj/item/vehicle_coupon + name = "vehicle coupon" + desc = "A coupon to be used for ASRS Vehicle Consoles to grant the wearer an actual APC! Yeah baby, we're done walking! One use only. The ASRS elevator must be manually sent to lower level. Special restrictions may apply. No warranty." icon = 'icons/obj/items/pamphlets.dmi' icon_state = "pamphlet_written" item_state = "pamphlet_written" + var/vehicle_type = /datum/vehicle_order/apc + var/vehicle_category = "APC" -/obj/item/tank_coupon/attack_self(mob/user) +/obj/item/vehicle_coupon/tank + name = "tank coupon" + desc = "We're done playing! This coupon allows the ship crew to retrieve a complete Longstreet tank from Vehicle ASRS. Make sure to send the ASRS lift down so it can be retrieved. One use only. LTB not included. Comes with free friendly fire." + vehicle_type = /datum/vehicle_order/tank/empty + vehicle_category = "TANK" + +/obj/item/vehicle_coupon/attack_self(mob/user) if(QDELETED(src)) return - if(redeem_tank()) - to_chat(user, SPAN_WARNING("\The [src] catches fire as it is read, resetting the ASRS Vehicle system!")) + if(redeem_vehicle()) + to_chat(user, SPAN_WARNING("\The [src] catches fire as it is read and resets the ASRS Vehicle system! Send the lift down and haul your prize up.")) qdel(src) return ..() -/obj/item/tank_coupon/proc/redeem_tank(mob/user) +/obj/item/vehicle_coupon/proc/redeem_vehicle(mob/user) SHOULD_NOT_SLEEP(TRUE) . = FALSE var/obj/structure/machinery/computer/supplycomp/vehicle/comp = VehicleElevatorConsole @@ -46,7 +41,7 @@ comp.spent = FALSE QDEL_NULL_LIST(comp.vehicles) comp.vehicles = list( - new /datum/vehicle_order/tank() + new vehicle_type(), ) comp.allowed_roles = null comp.req_access = list() @@ -56,17 +51,7 @@ gearcomp.req_access = list() gearcomp.req_one_access = list() gearcomp.vendor_role = list() - gearcomp.selected_vehicle = "TANK" + gearcomp.selected_vehicle = vehicle_category gearcomp.available_categories = VEHICLE_ALL_AVAILABLE - var/datum/supply_packs/VK = /datum/supply_packs/vc_kit - var/pack = initial(VK.name) - var/datum/supply_order/O = new /datum/supply_order() - O.ordernum = supply_controller.ordernum - supply_controller.ordernum++ - O.object = supply_controller.supply_packs[pack] - O.orderedby = MAIN_AI_SYSTEM - O.approvedby = MAIN_AI_SYSTEM - supply_controller.shoppinglist += O - return TRUE diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 9e4d2c9d297b..6a79d34d9a1b 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -240,26 +240,31 @@ var/amt_hardpoints = LAZYLEN(hardpoints) if(amt_hardpoints) - var/list/hardpoint_images[amt_hardpoints] - var/list/C[HDPT_LAYER_MAX] - - // Counting sort the images into a list so we get the hardpoint images sorted by layer - for(var/obj/item/hardpoint/H in hardpoints) - C[H.hdpt_layer] += 1 - - for(var/i = 2 to HDPT_LAYER_MAX) - C[i] += C[i-1] - - for(var/obj/item/hardpoint/H in hardpoints) - hardpoint_images[C[H.hdpt_layer]] = H.get_hardpoint_image() - C[H.hdpt_layer] -= 1 - - for(var/i = 1 to amt_hardpoints) - var/image/I = hardpoint_images[i] - // get_hardpoint_image() can return a list of images - if(istype(I)) - I.layer = layer + (i*0.1) - overlays += I + var/list/image/hardpoint_images = list() + for(var/obj/item/hardpoint/hardpoint as anything in hardpoints) + var/image/hardpoint_image = hardpoint.get_hardpoint_image() + var/index = 1 + while(index <= hardpoint_images.len) + var/primaryval = hardpoint_images + + + hardpoint_images_to_layer[hardpoint_image] = hardpoint.hdpt_layer + + + hardpoint_images[hardpoint_image] = hardpoint.hdpt_layer + if(istype(hardpoint_image)) + log_debug("BEFORE - HARDPOINT IMAGE - ICON=[hardpoint_image.icon_state] LAYER=[hardpoint_image.layer] HDPT_LAYER=[hardpoint.hdpt_layer]") + else + log_debug("BEFORE - HARDPOINT LIST - LENGTH=[length(hardpoint_image)] HDPT_LAYER=[hardpoint.hdpt_layer]") + hardpoint_images = sortAssocEx(hardpoint_images, use_associated_value = TRUE, use_numeric_sort = TRUE) + log_debug("=======================") + for(var/image/hardpoint_image as anything in hardpoint_images) + if(istype(hardpoint_image)) // get_hardpoint_image() can return a list of images + log_debug("AFTER - HARDPOINT IMAGE - ICON=[hardpoint_image.icon_state] LAYER=[hardpoint_image.layer] HDPT_LAYER=[hardpoint_images[hardpoint_image]]") + hardpoint_image.layer = layer + hardpoint_images[hardpoint_image] * 0.1 // This is AWFUL + else + log_debug("AFTER - HARDPOINT LIST - LENGTH=[length(hardpoint_image)] HDPT_LAYER=[hardpoint_images[hardpoint_image]]") + overlays += hardpoint_image // No layering offset like above for hardpoint sub images ?? Huh? if(clamped) var/image/J = image(icon, icon_state = "vehicle_clamp", layer = layer+0.1) From d58c6cfa8382e602ea40f4fb3202936dbaeb8526 Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 12 Nov 2023 23:56:36 +0000 Subject: [PATCH 2/5] Fixes --- code/__DEFINES/vehicle.dm | 5 ++-- code/_globalvars/bitfields.dm | 8 ++++++ code/game/objects/structures/blocker.dm | 12 ++++++++ code/game/supplyshuttle.dm | 8 ++++-- code/modules/cm_tech/implements/tank.dm | 2 +- code/modules/vehicles/multitile/multitile.dm | 30 +++++--------------- code/modules/vehicles/tank/tank.dm | 8 ++++++ 7 files changed, 45 insertions(+), 28 deletions(-) diff --git a/code/__DEFINES/vehicle.dm b/code/__DEFINES/vehicle.dm index 9c6685085788..8a1617229926 100644 --- a/code/__DEFINES/vehicle.dm +++ b/code/__DEFINES/vehicle.dm @@ -53,5 +53,6 @@ #define VEHICLE_CLASS_LIGHT (1<<2) //light class armor (APC, tank) #define VEHICLE_CLASS_MEDIUM (1<<3) //medium class armor (tank) #define VEHICLE_CLASS_HEAVY (1<<4) //heavy class armor (tank) - -#define TANK_POPLOCK 90 +// Other vehicle flags +/// Vehicle can bypass vehicle blockers, typically going further into maps than intended +#define VEHICLE_BYPASS_BLOCKERS (1<<5) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 53dd40ff6035..7a1cba4719d8 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -462,3 +462,11 @@ DEFINE_BITFIELD(vend_flags, list( "VEND_FACTION_THEMES" = VEND_FACTION_THEMES, "VEND_USE_VENDOR_FLAGS" = VEND_USE_VENDOR_FLAGS, )) + +DEFINE_BITFIELD(vehicle_flags, list( + "VEHICLE_CLASS_WEAK" = VEHICLE_CLASS_WEAK, + "VEHICLE_CLASS_LIGHT" = VEHICLE_CLASS_LIGHT, + "VEHICLE_CLASS_MEDIUM" = VEHICLE_CLASS_MEDIUM, + "VEHICLE_CLASS_HEAVY" = VEHICLE_CLASS_HEAVY, + "VEHICLE_BYPASS_BLOCKERS" = VEHICLE_BYPASS_BLOCKERS, +)) diff --git a/code/game/objects/structures/blocker.dm b/code/game/objects/structures/blocker.dm index 284daf0028aa..f85b1e65fff5 100644 --- a/code/game/objects/structures/blocker.dm +++ b/code/game/objects/structures/blocker.dm @@ -105,9 +105,21 @@ /obj/structure/blocker/forcefield/vehicles types = list(/obj/vehicle/) + +/obj/structure/blocker/forcefield/vehicles/handle_vehicle_bump(obj/vehicle/multitile/multitile_vehicle) + if(multitile_vehicle.vehicle_flags & VEHICLE_BYPASS_BLOCKERS) + return TRUE + return FALSE + /obj/structure/blocker/forcefield/multitile_vehicles types = list(/obj/vehicle/multitile/) + +/obj/structure/blocker/forcefield/multitile_vehicles/handle_vehicle_bump(obj/vehicle/multitile/multitile_vehicle) + if(multitile_vehicle.vehicle_flags & VEHICLE_BYPASS_BLOCKERS) + return TRUE + return FALSE + /obj/structure/blocker/forcefield/human types = list(/mob/living/carbon/human) icon_state = "purple_line" diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 659369bef11b..92459725c50f 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1315,8 +1315,12 @@ var/datum/controller/supply/supply_controller = new() /datum/vehicle_order/tank/has_vehicle_lock() return -/datum/vehicle_order/tank/empty - name = "Barebones M34A2 Longstreet Light Tank" +/datum/vehicle_order/tank/broken + name = "Smashed M34A2 Longstreet Light Tank" + ordered_vehicle = /obj/effect/vehicle_spawner/tank/hull + +/datum/vehicle_order/tank/plain + name = "M34A2 Longstreet Light Tank" ordered_vehicle = /obj/effect/vehicle_spawner/tank /datum/vehicle_order/apc diff --git a/code/modules/cm_tech/implements/tank.dm b/code/modules/cm_tech/implements/tank.dm index 17c2c00c1e6a..8a8e8614b45c 100644 --- a/code/modules/cm_tech/implements/tank.dm +++ b/code/modules/cm_tech/implements/tank.dm @@ -17,7 +17,7 @@ /obj/item/vehicle_coupon/tank name = "tank coupon" desc = "We're done playing! This coupon allows the ship crew to retrieve a complete Longstreet tank from Vehicle ASRS. Make sure to send the ASRS lift down so it can be retrieved. One use only. LTB not included. Comes with free friendly fire." - vehicle_type = /datum/vehicle_order/tank/empty + vehicle_type = /datum/vehicle_order/tank/broken vehicle_category = "TANK" /obj/item/vehicle_coupon/attack_self(mob/user) diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 6a79d34d9a1b..c8138c5b8f86 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -240,31 +240,15 @@ var/amt_hardpoints = LAZYLEN(hardpoints) if(amt_hardpoints) - var/list/image/hardpoint_images = list() - for(var/obj/item/hardpoint/hardpoint as anything in hardpoints) + for(var/obj/item/hardpoint/hardpoint in hardpoints) var/image/hardpoint_image = hardpoint.get_hardpoint_image() - var/index = 1 - while(index <= hardpoint_images.len) - var/primaryval = hardpoint_images - - - hardpoint_images_to_layer[hardpoint_image] = hardpoint.hdpt_layer - - - hardpoint_images[hardpoint_image] = hardpoint.hdpt_layer if(istype(hardpoint_image)) - log_debug("BEFORE - HARDPOINT IMAGE - ICON=[hardpoint_image.icon_state] LAYER=[hardpoint_image.layer] HDPT_LAYER=[hardpoint.hdpt_layer]") - else - log_debug("BEFORE - HARDPOINT LIST - LENGTH=[length(hardpoint_image)] HDPT_LAYER=[hardpoint.hdpt_layer]") - hardpoint_images = sortAssocEx(hardpoint_images, use_associated_value = TRUE, use_numeric_sort = TRUE) - log_debug("=======================") - for(var/image/hardpoint_image as anything in hardpoint_images) - if(istype(hardpoint_image)) // get_hardpoint_image() can return a list of images - log_debug("AFTER - HARDPOINT IMAGE - ICON=[hardpoint_image.icon_state] LAYER=[hardpoint_image.layer] HDPT_LAYER=[hardpoint_images[hardpoint_image]]") - hardpoint_image.layer = layer + hardpoint_images[hardpoint_image] * 0.1 // This is AWFUL - else - log_debug("AFTER - HARDPOINT LIST - LENGTH=[length(hardpoint_image)] HDPT_LAYER=[hardpoint_images[hardpoint_image]]") - overlays += hardpoint_image // No layering offset like above for hardpoint sub images ?? Huh? + hardpoint_image.layer = layer + hardpoint.hdpt_layer * 0.1 + else if(islist(hardpoint_image)) + var/list/image/hardpoint_image_list = hardpoint_image // Linter will complain about iterating on "an image" otherwise + for(var/image/subimage in hardpoint_image_list) + subimage.layer = layer + hardpoint.hdpt_layer * 0.1 + overlays += hardpoint_image if(clamped) var/image/J = image(icon, icon_state = "vehicle_clamp", layer = layer+0.1) diff --git a/code/modules/vehicles/tank/tank.dm b/code/modules/vehicles/tank/tank.dm index ad69f80cdfb6..fd953b04100a 100644 --- a/code/modules/vehicles/tank/tank.dm +++ b/code/modules/vehicles/tank/tank.dm @@ -189,6 +189,8 @@ handle_direction(TANK) TANK.update_icon() + return TANK + /obj/effect/vehicle_spawner/tank/load_hardpoints(obj/vehicle/multitile/tank/V) V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) @@ -201,6 +203,12 @@ /obj/effect/vehicle_spawner/tank/hull/load_hardpoints(obj/vehicle/multitile/tank/V) return +//Just the hull and it's broken TOO, you get the full experience +/obj/effect/vehicle_spawner/tank/hull/broken/spawn_vehicle() + var/obj/vehicle/multitile/tank/tonk = ..() + load_damage(tonk) + tonk.update_icon() + //PRESET: default hardpoints, destroyed /obj/effect/vehicle_spawner/tank/decrepit/spawn_vehicle() var/obj/vehicle/multitile/tank/TANK = new (loc) From 146214eeebcd906b6c7645effc763256481ec80b Mon Sep 17 00:00:00 2001 From: Fira Date: Mon, 13 Nov 2023 00:07:11 +0000 Subject: [PATCH 3/5] loadout changes --- code/game/supplyshuttle.dm | 4 ++-- code/modules/vehicles/apc/apc.dm | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 92459725c50f..fdb3b52d9199 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1317,7 +1317,7 @@ var/datum/controller/supply/supply_controller = new() /datum/vehicle_order/tank/broken name = "Smashed M34A2 Longstreet Light Tank" - ordered_vehicle = /obj/effect/vehicle_spawner/tank/hull + ordered_vehicle = /obj/effect/vehicle_spawner/tank/hull/broken /datum/vehicle_order/tank/plain name = "M34A2 Longstreet Light Tank" @@ -1337,7 +1337,7 @@ var/datum/controller/supply/supply_controller = new() /datum/vehicle_order/apc/empty name = "Barebones M577 Armored Personal Carrier" - ordered_vehicle = /obj/effect/vehicle_spawner/apc + ordered_vehicle = /obj/effect/vehicle_spawner/apc/unarmed/broken /obj/structure/machinery/computer/supplycomp/vehicle/Initialize() . = ..() diff --git a/code/modules/vehicles/apc/apc.dm b/code/modules/vehicles/apc/apc.dm index d71db37074f1..24b137a6804a 100644 --- a/code/modules/vehicles/apc/apc.dm +++ b/code/modules/vehicles/apc/apc.dm @@ -256,9 +256,16 @@ GLOBAL_LIST_EMPTY(command_apc_list) handle_direction(APC) APC.update_icon() + return APC + /obj/effect/vehicle_spawner/apc/unarmed/load_hardpoints(obj/vehicle/multitile/apc/V) return +/obj/effect/vehicle_spawner/apc/unarmed/broken/spawn_vehicle() + var/obj/vehicle/multitile/apc/apc = ..() + load_damage(apc) + apc.update_icon() + //PRESET: default hardpoints, destroyed /obj/effect/vehicle_spawner/apc/unarmed/decrepit/spawn_vehicle() var/obj/vehicle/multitile/apc/unarmed/APC = new (loc) From 6fc5aa337ce4279366d64ad4a13d49c224878ebb Mon Sep 17 00:00:00 2001 From: Fira Date: Mon, 13 Nov 2023 00:14:30 +0000 Subject: [PATCH 4/5] oops --- code/modules/cm_tech/implements/tank.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/cm_tech/implements/tank.dm b/code/modules/cm_tech/implements/tank.dm index 8a8e8614b45c..ae7dfc580e38 100644 --- a/code/modules/cm_tech/implements/tank.dm +++ b/code/modules/cm_tech/implements/tank.dm @@ -11,7 +11,7 @@ icon = 'icons/obj/items/pamphlets.dmi' icon_state = "pamphlet_written" item_state = "pamphlet_written" - var/vehicle_type = /datum/vehicle_order/apc + var/vehicle_type = /datum/vehicle_order/apc/empty var/vehicle_category = "APC" /obj/item/vehicle_coupon/tank From 148cd0dae08fc8da40f4e4a3caa0b2c70b96344d Mon Sep 17 00:00:00 2001 From: fira Date: Mon, 13 Nov 2023 11:58:23 +0000 Subject: [PATCH 5/5] Update code/game/supplyshuttle.dm Co-authored-by: Doubleumc --- code/game/supplyshuttle.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index fdb3b52d9199..5e3911b726c3 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1417,7 +1417,7 @@ var/datum/controller/supply/supply_controller = new() return if(!is_admin_level(SSshuttle.vehicle_elevator.z)) - to_chat(usr, SPAN_WARNING("The elevator needs to be in the crago bay dock to call a vehicle up. Ask someone to send it away.")) + to_chat(usr, SPAN_WARNING("The elevator needs to be in the cargo bay dock to call a vehicle up. Ask someone to send it away.")) return if(ismaintdrone(usr))