From 698a9cde27ecc87afaaed640b408385adbbfae32 Mon Sep 17 00:00:00 2001 From: Julian56 <117036822+Huffie56@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:34:31 +0100 Subject: [PATCH] refactor creating it's own file for souto mobile code instead of it being in vehicle.dm. (#5498) # About the pull request Also changed some comment to be to doc stuff standard while i was modifying vehicle... # Explain why it's good for the game # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: refactor: creating it's own file for souto mobile code instead of it being in vehicle.dm. /:cl: --------- Co-authored-by: Julien Co-authored-by: Birdtalon --- code/modules/vehicles/souto_mobile.dm | 43 ++++++++++++++++++++ code/modules/vehicles/vehicle.dm | 57 ++++----------------------- colonialmarines.dme | 1 + 3 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 code/modules/vehicles/souto_mobile.dm diff --git a/code/modules/vehicles/souto_mobile.dm b/code/modules/vehicles/souto_mobile.dm new file mode 100644 index 000000000000..fa559983d0a4 --- /dev/null +++ b/code/modules/vehicles/souto_mobile.dm @@ -0,0 +1,43 @@ +/obj/vehicle/souto + name = "\improper Soutomobile" + icon_state = "soutomobile" + desc = "Almost, but not quite, the best ride in the universe." + move_delay = 3 //The speed of a fed but shoeless pajamarine, or a bit slower than a heavy-armor marine. + buckling_y = 4 + layer = ABOVE_LYING_MOB_LAYER //Allows it to drive over people, but is below the driver. + +/obj/vehicle/souto/Initialize() + . = ..() + var/image/I = new(icon = 'icons/obj/vehicles/vehicles.dmi', icon_state = "soutomobile_overlay", layer = ABOVE_MOB_LAYER) //over mobs + overlays += I + +/obj/vehicle/souto/manual_unbuckle(mob/user) + if(buckled_mob && buckled_mob != user) + if(do_after(user, 20, INTERRUPT_ALL, BUSY_ICON_GENERIC)) + ..() + else ..() + +/obj/vehicle/souto/relaymove(mob/user, direction) + if(user.is_mob_incapacitated()) return + if(world.time > l_move_time + move_delay) + . = step(src, direction) + +/obj/vehicle/souto/super + desc = "The best ride in the universe, for the one-and-only Souto Man!" + health = 1000 + locked = FALSE + unacidable = TRUE + indestructible = TRUE + +/obj/vehicle/souto/super/explode() + for(var/mob/M as anything in viewers(7, src)) + M.show_message("Somehow, [src] still looks as bright and shiny as a new can of Souto Classic.", SHOW_MESSAGE_VISIBLE) + health = initial(health) //Souto Man never dies, and neither does his bike. + +/obj/vehicle/souto/super/buckle_mob(mob/M, mob/user) + if(!locked) //Vehicle is unlocked until first being mounted, since the Soutomobile is faction-locked and otherwise Souto Man cannot automatically buckle in on spawn as his equipment is spawned before his ID. + locked = TRUE + else if(M == user && M.faction != FACTION_SOUTO && locked == TRUE) //Are you a cool enough dude to drive this bike? Nah, nobody's THAT cool. + to_chat(user, SPAN_WARNING("Somehow, as you take hold of the handlebars, [src] manages to glare at you. You back off. We didn't sign up for haunted motorbikes, man.")) + return + ..() diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 2239329d3e44..014452426a3c 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -18,15 +18,19 @@ var/maxhealth = 100 var/fire_dam_coeff = 1 var/brute_dam_coeff = 1 - var/open = 0 //Maint panel + ///Maint panel + var/open = 0 var/locked = TRUE var/stat = 0 - var/powered = 0 //set if vehicle is powered and should use fuel when moving - var/move_delay = 1 //set this to limit the speed of the vehicle + ///set if vehicle is powered and should use fuel when moving + var/powered = 0 + ///set this to limit the speed of the vehicle + var/move_delay = 1 var/buckling_y = 0 var/obj/item/cell/cell - var/charge_use = 5 //set this to adjust the amount of power the vehicle uses per move + ///set this to adjust the amount of power the vehicle uses per move + var/charge_use = 5 can_block_movement = TRUE //------------------------------------------- @@ -267,48 +271,3 @@ //------------------------------------------------------- /obj/vehicle/proc/update_stats() return - -/obj/vehicle/souto - name = "\improper Soutomobile" - icon_state = "soutomobile" - desc = "Almost, but not quite, the best ride in the universe." - move_delay = 3 //The speed of a fed but shoeless pajamarine, or a bit slower than a heavy-armor marine. - buckling_y = 4 - layer = ABOVE_LYING_MOB_LAYER //Allows it to drive over people, but is below the driver. - -/obj/vehicle/souto/Initialize() - . = ..() - var/image/I = new(icon = 'icons/obj/vehicles/vehicles.dmi', icon_state = "soutomobile_overlay", layer = ABOVE_MOB_LAYER) //over mobs - overlays += I - -/obj/vehicle/souto/manual_unbuckle(mob/user) - if(buckled_mob && buckled_mob != user) - if(do_after(user, 20, INTERRUPT_ALL, BUSY_ICON_GENERIC)) - ..() - else ..() - -/obj/vehicle/souto/relaymove(mob/user, direction) - if(user.is_mob_incapacitated()) return - if(world.time > l_move_time + move_delay) - . = step(src, direction) - - -/obj/vehicle/souto/super - desc = "The best ride in the universe, for the one-and-only Souto Man!" - health = 1000 - locked = FALSE - unacidable = TRUE - indestructible = TRUE - -/obj/vehicle/souto/super/explode() - for(var/mob/M as anything in viewers(7, src)) - M.show_message("Somehow, [src] still looks as bright and shiny as a new can of Souto Classic.", SHOW_MESSAGE_VISIBLE) - health = initial(health) //Souto Man never dies, and neither does his bike. - -/obj/vehicle/souto/super/buckle_mob(mob/M, mob/user) - if(!locked) //Vehicle is unlocked until first being mounted, since the Soutomobile is faction-locked and otherwise Souto Man cannot automatically buckle in on spawn as his equipment is spawned before his ID. - locked = TRUE - else if(M == user && M.faction != FACTION_SOUTO && locked == TRUE) //Are you a cool enough dude to drive this bike? Nah, nobody's THAT cool. - to_chat(user, SPAN_WARNING("Somehow, as you take hold of the handlebars, [src] manages to glare at you. You back off. We didn't sign up for haunted motorbikes, man.")) - return - ..() diff --git a/colonialmarines.dme b/colonialmarines.dme index c10b77938115..0ad186e331cc 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -2355,6 +2355,7 @@ #include "code\modules\unit_tests\_unit_tests.dm" #include "code\modules\vehicles\cargo_train.dm" #include "code\modules\vehicles\powerloader.dm" +#include "code\modules\vehicles\souto_mobile.dm" #include "code\modules\vehicles\train.dm" #include "code\modules\vehicles\vehicle.dm" #include "code\modules\vehicles\vehicle_misc_objects.dm"