Skip to content

Commit

Permalink
BRUUUUH, still badddd, this need full rework, and where my HVH gamemo…
Browse files Browse the repository at this point in the history
…de with full functionality???? I want warthunder in SS13 and TANK BATTLES OVER 2k tiles away from each other...
  • Loading branch information
blackcrystall committed Jun 28, 2024
1 parent 31e1ffb commit 6b2a911
Show file tree
Hide file tree
Showing 13 changed files with 425 additions and 643 deletions.
20 changes: 13 additions & 7 deletions code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@
malfunction()
return

/obj/structure/machinery/cm_vending/gear/vehicle_crew/proc/populate_products(datum/source, obj/vehicle/multitile/V)
/obj/structure/machinery/cm_vending/gear/vehicle_crew/proc/populate_products(datum/source, obj/vehicle/multitile/ordered)
SIGNAL_HANDLER
UnregisterSignal(SSdcs, COMSIG_GLOB_VEHICLE_ORDERED)

if(!selected_vehicle)
selected_vehicle = "TANK" // The whole thing seems to be based upon the assumption you unlock tank as an override, defaulting to APC
if(selected_vehicle == "TANK")
available_categories &= ~(VEHICLE_INTEGRAL_AVAILABLE) //APC lacks these, so we need to remove these flags to be able to access spare parts section
marine_announcement("A tank is being sent up to reinforce this operation.")
if(istype(ordered, /obj/vehicle/multitile/tank))
selected_vehicle = "TANK"
available_categories = VEHICLE_ALL_AVAILABLE

else if(istype(ordered, /obj/vehicle/multitile/arc))
selected_vehicle = "ARC"
available_categories = VEHICLE_ALL_AVAILABLE

else if(istype(ordered, /obj/vehicle/multitile/apc))
selected_vehicle = "APC"
available_categories = VEHICLE_PRIMARY_AVAILABLE|VEHICLE_SECONDARY_AVAILABLE|VEHICLE_SUPPORT_AVAILABLE|VEHICLE_TREADS_AVAILABLE

/obj/structure/machinery/cm_vending/gear/vehicle_crew/get_listed_products(mob/user)
var/list/display_list = list()
Expand All @@ -76,7 +82,7 @@
else if(selected_vehicle == "ARC")
display_list = GLOB.cm_vending_vehicle_crew_arc

else if(selected_vehicle == "TANK")
else if(selected_vehicle == "APC")
if(available_categories)
display_list = GLOB.cm_vending_vehicle_crew_apc
else //APC stuff costs more to prevent 4000 points spent on shitton of ammunition
Expand Down
12 changes: 0 additions & 12 deletions code/game/objects/items/circuitboards/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,6 @@
/obj/item/circuitboard/computer/supplycomp/vehicle
name = "Circuit board (vehicle ASRS console)"
build_path = /obj/structure/machinery/computer/supplycomp/vehicle
var/spent = FALSE //so that they can't just reconstruct the console to get another APC
var/tank_unlocked = FALSE

/obj/item/circuitboard/computer/supplycomp/vehicle/construct(obj/structure/machinery/computer/supplycomp/vehicle/SCV)
if (..(SCV))
SCV.spent = spent
SCV.tank_unlocked = tank_unlocked

/obj/item/circuitboard/computer/supplycomp/vehicle/disassemble(obj/structure/machinery/computer/supplycomp/vehicle/SCV)
if (..(SCV))
spent = SCV.spent
tank_unlocked = SCV.tank_unlocked

/obj/item/circuitboard/computer/operating
name = "Circuit board (Operating Computer)"
Expand Down
105 changes: 43 additions & 62 deletions code/game/supplyshuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1322,12 +1322,9 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
desc = "A console for an Automated Storage and Retrieval System. This one is tied to a deep storage unit for vehicles."
req_access = list(ACCESS_MARINE_CREWMAN)
circuit = /obj/item/circuitboard/computer/supplycomp/vehicle
// Can only retrieve one vehicle per round
var/spent = FALSE
var/tank_unlocked = TRUE
var/list/allowed_roles = list(JOB_TANK_CREW)

var/list/vehicles
var/list/allowed_roles = list(JOB_TANK_CREW)
var/list/in_stock

/datum/vehicle_order
var/name = "vehicle order"
Expand All @@ -1337,18 +1334,15 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
var/failure_message = "<font color=\"red\"><b>Not enough resources were allocated to repair this vehicle during this operation.</b></font><br>"

/datum/vehicle_order/proc/has_vehicle_lock()
return FALSE
return !unlocked

/datum/vehicle_order/proc/on_created(obj/vehicle/V)
/datum/vehicle_order/proc/on_created(obj/vehicle/order)
return

/datum/vehicle_order/tank
name = "M34A2 Longstreet Light Tank"
ordered_vehicle = /obj/effect/vehicle_spawner/tank/decrepit

/datum/vehicle_order/tank/has_vehicle_lock()
return

/datum/vehicle_order/tank/broken
name = "Smashed M34A2 Longstreet Light Tank"
ordered_vehicle = /obj/effect/vehicle_spawner/tank/hull/broken
Expand All @@ -1359,34 +1353,27 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())

/datum/vehicle_order/apc
name = "M577 Armored Personnel Carrier"
ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit
ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/fpw

/datum/vehicle_order/apc/med
name = "M577-MED Armored Personnel Carrier"
ordered_vehicle = /obj/effect/vehicle_spawner/apc_med/decrepit
ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/med

/datum/vehicle_order/apc/cmd
name = "M577-CMD Armored Personnel Carrier"
ordered_vehicle = /obj/effect/vehicle_spawner/apc_cmd/decrepit
ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/cmd

/datum/vehicle_order/apc/empty
name = "Barebones M577 Armored Personal Carrier"
ordered_vehicle = /obj/effect/vehicle_spawner/apc/unarmed/broken
ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/empty

/datum/vehicle_order/arc
name = "M540-B Armored Recon Carrier"
ordered_vehicle = /obj/effect/vehicle_spawner/arc

/datum/vehicle_order/arc/has_vehicle_lock()
return

/obj/structure/machinery/computer/supplycomp/vehicle/Initialize()
. = ..()

vehicles = list(
new /datum/vehicle_order/tank/plain
)

if(!GLOB.VehicleElevatorConsole)
GLOB.VehicleElevatorConsole = src

Expand All @@ -1398,7 +1385,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
if(inoperable())
return

if(LAZYLEN(allowed_roles) && !allowed_roles.Find(H.job)) //replaced Z-level restriction with role restriction.
if(length(allowed_roles) && !allowed_roles.Find(H.job))
to_chat(H, SPAN_WARNING("This console isn't for you."))
return

Expand All @@ -1415,79 +1402,73 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new())
return

dat += "Platform position: "
if (SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE)
if(SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE)
dat += "Moving"
else
if(is_mainship_level(SSshuttle.vehicle_elevator.z))
dat += "Raised"
if(!spent)
dat += "<br>\[<a href='?src=\ref[src];lower_elevator=1'>Lower</a>\]"
dat += "Raised<br>"
dat += "<a href='?src=\ref[src];lower_platform=1'>Lower platform</a><br>"
else
dat += "Lowered"
dat += "<br><hr>"

if(spent)
dat += "No vehicles are available for retrieval."
else
dat += "Available vehicles:<br>"

for(var/d in vehicles)
var/datum/vehicle_order/VO = d
dat += "<br><hr>"

if(VO.has_vehicle_lock())
dat += VO.failure_message
if(in_stock)
dat += "Available vehicles:<br>"
for(var/datum/vehicle_order/order as anything in in_stock)
if(order.has_vehicle_lock())
dat += order.failure_message
else
dat += "<a href='?src=\ref[src];get_vehicle=\ref[order]'>[order.name]</a><br>"
else
dat += "<a href='?src=\ref[src];get_vehicle=\ref[VO]'>[VO.name]</a><br>"
dat += "No vehicles are available for retrieval."

show_browser(H, dat, "Automated Storage and Retrieval System", "computer", "size=575x450")

/obj/structure/machinery/computer/supplycomp/vehicle/Topic(href, href_list)
. = ..()
if(.)
return
if(!is_mainship_level(z))
return
if(spent)
return

if(!GLOB.supply_controller)
world.log << "## ERROR: Eek. The GLOB.supply_controller controller datum is missing somehow."
return

if (!SSshuttle.vehicle_elevator)
if(!SSshuttle.vehicle_elevator)
world.log << "## ERROR: Eek. The supply/elevator datum is missing somehow."
return

if(isturf(loc) && ( in_range(src, usr) || isSilicon(usr) ) )
if(isturf(loc) && (in_range(src, usr) || isSilicon(usr)))
usr.set_interaction(src)

if(href_list["get_vehicle"])
if(is_mainship_level(SSshuttle.vehicle_elevator.z) || SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE)
to_chat(usr, SPAN_WARNING("The elevator needs to be in the cargo bay dock to call a vehicle up!"))
if(href_list["lower_platform"])
if(!is_mainship_level(SSshuttle.vehicle_elevator.z))
return
// dunno why the +1 is needed but the vehicles spawn off-center
var/turf/middle_turf = get_turf(SSshuttle.vehicle_elevator)
SSshuttle.vehicle_elevator.request(SSshuttle.getDock("adminlevel vehicle"))

var/obj/vehicle/multitile/ordered_vehicle
if(!is_admin_level(SSshuttle.vehicle_elevator.z))
return

var/datum/vehicle_order/VO = locate(href_list["get_vehicle"])
if(!(VO in vehicles))
if(href_list["get_vehicle"])
if(!is_admin_level(SSshuttle.vehicle_elevator.z))
return

if(VO?.has_vehicle_lock())
var/turf/middle_turf = get_turf(SSshuttle.vehicle_elevator)
var/datum/vehicle_order/order = locate(href_list["get_vehicle"])
if(!order)
return
spent = TRUE
ordered_vehicle = new VO.ordered_vehicle(middle_turf)
SSshuttle.vehicle_elevator.request(SSshuttle.getDock("almayer vehicle"))

VO.on_created(ordered_vehicle)
if(order.has_vehicle_lock())
return

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VEHICLE_ORDERED, ordered_vehicle)
in_stock -= order

else if(href_list["lower_elevator"])
if(!is_mainship_level(SSshuttle.vehicle_elevator.z))
return
var/obj/effect/vehicle_spawner/vehicle_spawner = new order.ordered_vehicle(middle_turf)
var/obj/vehicle/multitile/ordered_vehicle = vehicle_spawner.spawn_vehicle()
SSshuttle.vehicle_elevator.request(SSshuttle.getDock("almayer vehicle"))

SSshuttle.vehicle_elevator.request(SSshuttle.getDock("adminlevel vehicle"))
order.on_created(ordered_vehicle)

SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VEHICLE_ORDERED, ordered_vehicle)

add_fingerprint(usr)
updateUsrDialog()
13 changes: 3 additions & 10 deletions code/modules/cm_tech/implements/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
icon_state = "pamphlet_written"
item_state = "pamphlet_written"
var/vehicle_type = /datum/vehicle_order/apc/empty
var/vehicle_category = "APC"

/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/broken
vehicle_category = "LONGSTREET"

/obj/item/vehicle_coupon/attack_self(mob/user)
if(QDELETED(src))
Expand All @@ -38,20 +36,15 @@
return

. = TRUE
comp.spent = FALSE
QDEL_NULL_LIST(comp.vehicles)
comp.vehicles = list(
new vehicle_type(),
)
comp.in_stock += new vehicle_type()

comp.allowed_roles = null

comp.req_access = list()
comp.req_one_access = list()
comp.spent = FALSE

gearcomp.req_access = list()
gearcomp.req_one_access = list()
gearcomp.vendor_role = list()
gearcomp.selected_vehicle = vehicle_category
gearcomp.available_categories = VEHICLE_ALL_AVAILABLE

return TRUE
22 changes: 1 addition & 21 deletions code/modules/cm_tech/techs/marine/tier1/arc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@

flags = TREE_FLAG_MARINE


/datum/tech/arc/can_unlock(mob/unlocking_mob)
. = ..()

var/obj/structure/machinery/cm_vending/gear/vehicle_crew/gearcomp = GLOB.VehicleGearConsole

if(gearcomp.selected_vehicle == "TANK")
to_chat(unlocking_mob, SPAN_WARNING ("A vehicle has already been selected for this operation."))
return FALSE

return TRUE


/datum/tech/arc/on_unlock()
. = ..()

Expand All @@ -34,20 +21,13 @@
if(!comp || !gearcomp)
return FALSE

comp.spent = FALSE
QDEL_NULL_LIST(comp.vehicles)
comp.vehicles = list(
new /datum/vehicle_order/arc()
)
comp.in_stock += new /datum/vehicle_order/arc()
comp.allowed_roles = list(JOB_SYNTH, JOB_SEA, JOB_SO, JOB_XO, JOB_CO, JOB_GENERAL)
comp.req_access = list(ACCESS_MARINE_COMMAND)
comp.req_one_access = list()
comp.spent = FALSE

gearcomp.req_access = list(ACCESS_MARINE_COMMAND)
gearcomp.req_one_access = list()
gearcomp.vendor_role = list()
gearcomp.selected_vehicle = "ARC"
gearcomp.available_categories = VEHICLE_ALL_AVAILABLE

return TRUE
Loading

0 comments on commit 6b2a911

Please sign in to comment.