Cargo tug new sprite and fixes vehicles. (#15474)

This commit is contained in:
Wowzewow (Wezzy)
2023-01-08 00:06:46 +01:00
committed by GitHub
parent c86e4bcb28
commit 7ca3aa325c
20 changed files with 212 additions and 234 deletions
+2
View File
@@ -3,6 +3,8 @@
desc = "Used to unlock things."
icon = 'icons/obj/items.dmi'
icon_state = "keys"
drop_sound = 'sound/items/drop/ring.ogg'
pickup_sound = 'sound/items/pickup/ring.ogg'
w_class = ITEMSIZE_TINY
var/key_data = ""
+1 -3
View File
@@ -548,7 +548,6 @@
/obj/vehicle/train/cargo/engine/mining
name = "mine cart engine"
desc = "A ridable electric minecart designed for pulling other mine carts."
icon = 'icons/obj/cart.dmi'
icon_state = "mining_engine"
on = FALSE
powered = TRUE
@@ -568,7 +567,7 @@
. = ..()
cell = new /obj/item/cell/high(src)
key = new /obj/item/key/minecarts(src)
var/image/I = new(icon = 'icons/obj/cart.dmi', icon_state = "[icon_state]_overlay", layer = src.layer + 0.2) //over mobs
var/image/I = new(icon = 'icons/obj/vehicles.dmi', icon_state = "[icon_state]_overlay", layer = src.layer + 0.2) //over mobs
add_overlay(I)
turn_off()
@@ -601,7 +600,6 @@
/obj/vehicle/train/cargo/trolley/mining
name = "mine-cart"
desc = "A modern day twist to an ancient classic."
icon = 'icons/obj/cart.dmi'
icon_state = "mining_trailer"
anchored = FALSE
passenger_allowed = FALSE
+18 -10
View File
@@ -1,7 +1,11 @@
/obj/vehicle/bike
name = "space-bike"
desc = "Space wheelies! Woo!"
desc_info = "Click on the bike, click resist, or type resist into the red bar below to get off. Drag yourself onto the bike to mount it, toggle the engine to be able to drive around. Deploy the kickstand to prevent movement by driving and dragging. Drag it onto yourself to access its mounted storage. Resist to get off. Use ctrl-click to quickly toggle the engine if you're adjacent (only when vehicle is stationary). Alt-click will similarly toggle the kickstand."
desc_info = "Click-drag yourself onto the bike to climb onto it.<br>\
- Click-drag it onto yourself to access its mounted storage.<br>\
- CTRL-click the bike to toggle the engine.<br>\
- ALT-click to toggle the kickstand which prevents movement by driving and dragging.<br>\
- Click the resist button or type \"resist\" in the command bar at the bottom of your screen to get off the bike."
icon = 'icons/obj/bike.dmi'
icon_state = "bike_off"
dir = SOUTH
@@ -47,7 +51,7 @@
if(!on)
turn_on()
src.visible_message("\The [src] rumbles to life.", "You hear something rumble deeply.")
playsound(src, 'sound/misc/bike_start.ogg', 100, 1)
playsound(src, 'sound/machines/vehicles/bike_start.ogg', 100, 1)
else
turn_off()
src.visible_message("\The [src] putters before turning off.", "You hear something putter slowly.")
@@ -64,19 +68,21 @@
if(kickstand)
user.visible_message("\The [user] puts up \the [src]'s kickstand.", "You put up \the [src]'s kickstand.", "You hear a thunk.")
playsound(src, 'sound/misc/bike_stand_up.ogg', 50, 1)
playsound(src, 'sound/machines/vehicles/bike_stand_up.ogg', 50, 1)
else
if(isturf(loc))
var/turf/T = loc
if (T.is_hole)
to_chat(user, "<span class='warning'>You don't think kickstands work here.</span>")
to_chat(user, SPAN_WARNING("You don't think kickstands work here."))
return
user.visible_message("\The [user] puts down \the [src]'s kickstand.", "You put down \the [src]'s kickstand.", "You hear a thunk.")
playsound(src, 'sound/misc/bike_stand_down.ogg', 50, 1)
playsound(src, 'sound/machines/vehicles/bike_stand_down.ogg', 50, 1)
if(ismob(pulledby))
var/mob/M = pulledby
M.stop_pulling()
kickstand = !kickstand
anchored = (kickstand || on)
@@ -94,7 +100,7 @@
/obj/vehicle/bike/MouseDrop_T(var/atom/movable/C, mob/user as mob)
if(!load(C))
to_chat(user, "<span class='warning'>You were unable to load \the [C] onto \the [src].</span>")
to_chat(user, SPAN_WARNING("You were unable to load \the [C] onto \the [src]."))
return
/obj/vehicle/bike/attack_hand(var/mob/user as mob)
@@ -121,7 +127,9 @@
return FALSE
/obj/vehicle/bike/Move(var/turf/destination)
if(kickstand) return
if(kickstand)
visible_message("The kickstand prevents the bike from moving!")
return
//these things like space, not turf. Dragging shouldn't weigh you down.
var/is_on_space = check_destination(destination)
@@ -218,7 +226,7 @@
M.attack_log += text("\[[time_stamp()]\] <span class='warning'>rammed[M.name] ([M.ckey]) rammed [H.name] ([H.ckey]) with the [src].</span>")
msg_admin_attack("[src] crashed into [key_name(H)] at (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[H.x];Y=[H.y];Z=[H.z]'>JMP</a>)" )
src.visible_message(SPAN_DANGER("\The [src] smashes into \the [H]!"))
playsound(src, 'sound/weapons/punch4.ogg', 50, 1)
playsound(src, /decl/sound_category/swing_hit_sound, 50, 1)
H.apply_damage(20, BRUTE)
H.throw_at(get_edge_target_turf(loc, loc.dir), 5, 1)
H.apply_effect(4, WEAKEN)
@@ -228,7 +236,7 @@
else
var/mob/living/L = AM
src.visible_message(SPAN_DANGER("\The [src] smashes into \the [L]!"))
playsound(src, 'sound/weapons/punch4.ogg', 50, 1)
playsound(src, /decl/sound_category/swing_hit_sound, 50, 1)
L.throw_at(get_edge_target_turf(loc, loc.dir), 5, 1)
L.apply_damage(20, BRUTE)
M.setMoveCooldown(10)
@@ -338,4 +346,4 @@
if(is_type_in_typecache(destination,types) || pulledby)
return TRUE
else
return FALSE
return FALSE
+53 -65
View File
@@ -1,7 +1,12 @@
/obj/vehicle/train/cargo/engine
name = "cargo train tug"
desc = "A ridable electric car designed for pulling cargo trolleys."
desc_info = "Click resist, or type resist into the red bar below to get off. Use ctrl-click to quickly toggle the engine if you're adjacent (only when vehicle is stationary). Alt-click will grab the keys, if present. If latched, you can use a wrench to unlatch."
desc_info = "Click-drag yourself onto the truck to climb onto it.<br>\
- CTRL-click the truck to open the ignition and controls menu.<br>\
- ALT-click the truck to remove the key from the ignition.<br>\
- Click the truck to open a UI menu.<br>\
- Click the resist button or type \"resist\" in the command bar at the bottom of your screen to get off the truck.<br>\
- If latched, you can use a wrench to unlatch."
icon = 'icons/obj/vehicles.dmi'
icon_state = "cargo_engine"
on = 0
@@ -10,13 +15,14 @@
load_item_visible = 1
load_offset_x = 0
mob_offset_y = 7
mob_offset_y = 10
var/vueui_template = "trainengine"
var/car_limit = 3 //how many cars an engine can pull before performance degrades
active_engines = 1
var/obj/item/key/key
var/key_type = /obj/item/key/cargo_train
/obj/item/key/cargo_train
name = "key"
@@ -36,7 +42,7 @@
load_item_visible = 1
load_offset_x = 0
load_offset_y = 4
load_offset_y = 5
mob_offset_y = 8
//-------------------------------------------
@@ -48,7 +54,8 @@
/obj/vehicle/train/cargo/engine/proc/setup_engine()
cell = new /obj/item/cell/high(src)
key = new /obj/item/key/cargo_train(src)
if(ispath(key_type))
key = new key_type(src)
var/image/I = new(icon = icon, icon_state = "[icon_state]_overlay", layer = src.layer + 0.2) //over mobs
add_overlay(I)
turn_off()
@@ -96,14 +103,12 @@
return TRUE
if(href_list["toggle_engine"])
if(!on)
start_engine(usr)
else
stop_engine(usr)
turn_on(usr)
if(href_list["key"])
remove_key(usr)
if(href_list["unlatch"])
tow.unattach(usr)
if(tow)
tow.unattach(usr)
SSvueui.check_uis_for_change(src)
/obj/vehicle/train/cargo/engine/Move(var/turf/destination)
@@ -125,18 +130,19 @@
/obj/vehicle/train/cargo/trolley/attackby(obj/item/W as obj, mob/user as mob)
if(open && W.iswirecutter())
passenger_allowed = !passenger_allowed
user.visible_message("<span class='notice'>[user] [passenger_allowed ? "cuts" : "mends"] a cable in [src].</span>","<span class='notice'>You [passenger_allowed ? "cut" : "mend"] the load limiter cable.</span>")
user.visible_message(SPAN_NOTICE("[user] [passenger_allowed ? "cuts" : "mends"] a cable in [src]."),SPAN_NOTICE("You [passenger_allowed ? "cut" : "mend"] the load limiter cable."))
else
..()
/obj/vehicle/train/cargo/engine/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/key/cargo_train))
if(istype(W, key_type))
if(!key)
user.drop_from_inventory(W, src)
key = W
to_chat(user, SPAN_NOTICE("You slide the key into the ignition."))
key = W // put the key in the ignition
to_chat(user, SPAN_NOTICE("You slide \the [W] into \the [src]\s ignition."))
playsound(src, 'sound/machines/vehicles/key_in.ogg', 50, FALSE)
else
to_chat(user, SPAN_WARNING("\The [src] already has a key inserted."))
to_chat(user, SPAN_NOTICE("There is already a key in \the [src]\s ignition."))
return
..()
@@ -181,13 +187,23 @@
//-------------------------------------------
// Train procs
//-------------------------------------------
/obj/vehicle/train/cargo/engine/turn_on()
/obj/vehicle/train/cargo/engine/turn_on(var/mob/user)
if(!key)
audible_message("\The [src] whirrs, but the lack of a key causes it to shut down.")
return
else
if(!on)
..()
update_stats()
to_chat(user, SPAN_NOTICE("You turn on \the [src]\s ignition."))
playsound(src, 'sound/machines/vehicles/button.ogg', 50, FALSE)
playsound_in(src, 'sound/machines/vehicles/start.ogg', 50, FALSE, time = 1 SECOND)
else
turn_off(user)
update_stats()
/obj/vehicle/train/cargo/engine/turn_off(var/mob/user)
..()
to_chat(user, SPAN_NOTICE("You turn off \the [src]\s ignition."))
playsound(src, 'sound/machines/vehicles/button.ogg', 50, FALSE)
/obj/vehicle/train/cargo/RunOver(var/mob/living/carbon/human/H)
var/list/parts = list(BP_HEAD, BP_CHEST, BP_L_LEG, BP_R_LEG, BP_L_ARM, BP_R_ARM)
@@ -243,14 +259,23 @@
to_chat(user, "The power light is [on ? "on" : "off"].\nThere are[key ? "" : " no"] keys in the ignition.")
to_chat(user, "The charge meter reads [cell? round(cell.percent(), 0.01) : 0]%")
/obj/vehicle/train/cargo/engine/CtrlClick(var/mob/user)
if(Adjacent(user))
if(on)
stop_engine(usr)
else
start_engine(usr)
else
return ..()
/obj/vehicle/train/cargo/engine/CtrlClick(mob/user)
if(load && load != user)
to_chat(user, SPAN_WARNING("You can't interact with \the [src] while it's in use."))
return
var/list/options = list(
"Toggle Ignition" = image(src, "train_keys"),
"Toggle Latching" = image(src, "cargo_trailer", NORTH)
)
var/chosen_option = show_radial_menu(user, src, options, radius = 42, require_near = TRUE, tooltips = TRUE)
if (!chosen_option)
return
switch(chosen_option)
if("Toggle Ignition")
turn_on(user)
if("Toggle Latching")
if(tow)
tow.unattach(user)
/obj/vehicle/train/cargo/engine/AltClick(var/mob/user)
if(Adjacent(user))
@@ -258,33 +283,16 @@
else
return ..()
/obj/vehicle/train/cargo/engine/proc/start_engine(var/mob/user)
if(on)
to_chat(user, SPAN_WARNING("The engine is already running."))
return
turn_on()
if(on)
to_chat(user, SPAN_NOTICE("You start \the [src]'s engine."))
else if(cell.charge < charge_use)
to_chat(user, SPAN_WARNING("\The [src] is out of power."))
/obj/vehicle/train/cargo/engine/proc/stop_engine(var/mob/user)
if(!on)
to_chat(user, SPAN_WARNING("The engine is already stopped."))
return
turn_off()
if(!on)
to_chat(user, SPAN_NOTICE("You stop [src]'s engine."))
/obj/vehicle/train/cargo/engine/proc/remove_key(var/mob/user)
if(!key)
to_chat(usr, SPAN_WARNING("\The [src] doesn't have a key inserted!"))
return
if(load && load != usr)
to_chat(usr, SPAN_WARNING("You can't remove \the [key] from \the [src] while it's in use."))
return
to_chat(user, SPAN_NOTICE("You take out \the [key] out of \the [src]\s ignition."))
playsound(src, 'sound/machines/vehicles/key_out.ogg', 50, FALSE)
if(on)
turn_off()
@@ -356,26 +364,6 @@
cut_overlays()
..()
//-------------------------------------------
// Latching/unlatching procs
//-------------------------------------------
/obj/vehicle/train/cargo/engine/latch(obj/vehicle/train/T, mob/user)
if(!istype(T) || !Adjacent(T))
return 0
//if we are attaching a trolley to an engine we don't care what direction
// it is in and it should probably be attached with the engine in the lead
if(istype(T, /obj/vehicle/train/cargo/trolley))
T.attach_to(src, user)
else
var/T_dir = get_dir(src, T) //figure out where T is wrt src
if(dir == T_dir) //if car is ahead
src.attach_to(T, user)
else if(reverse_direction(dir) == T_dir) //else if car is behind
T.attach_to(src, user)
//-------------------------------------------------------
// Stat update procs
//
+37 -100
View File
@@ -1,31 +1,16 @@
//
// Custodial Truck a.k.a. Pussy Wagon
//
//
/obj/vehicle/train/cargo/engine/pussywagon
name = "\improper C8000 deluxe custodial truck"
desc = "A C8000 deluxe custodial truck. The bread to the custodians' butter."
desc_info = "Click-drag yourself onto the truck to climb onto it.<br>\
- CTRL-click the truck to open the ignition and controls menu.<br>\
- ALT-click the truck to remove the key from the ignition.<br>\
- Click the truck to open a UI menu.<br>\
- Click the resist button or type \"resist\" in the command bar at the bottom of your screen to get off the truck."
icon = 'icons/obj/vehicles.dmi'
icon_state = "janicart_off"
icon_state = "janicart" // this will be update_icon'd away anyway.
light_range = 0 // Turn off the light inherited from the parent.
move_delay = 3
mob_offset_y = 7
load_offset_x = -13
vueui_template = "pussywagon"
// Unique Variables
var/cart_icon = "janicart"
var/ignition = FALSE
/obj/vehicle/train/cargo/engine/pussywagon/setup_engine()
cell = new /obj/item/cell/high(src)
key = null
update_icon()
toggle_ignition()
key_type = /obj/item/key/janicart
/obj/vehicle/train/cargo/engine/pussywagon/vueui_data_change(list/data, mob/user, datum/vueui/ui)
data = ..()
@@ -59,100 +44,50 @@
toggle_mop(usr)
SSvueui.check_uis_for_change(src)
/obj/vehicle/train/cargo/engine/pussywagon/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/key/janicart))
if(!key)
user.drop_from_inventory(W, src)
key = W
to_chat(user, SPAN_NOTICE("You slide \the [W] into \the [src]'s ignition."))
playsound(src, 'sound/machines/vehicles/pussywagon/key_in.ogg', 50, FALSE)
else
to_chat(user, SPAN_NOTICE("There is already a key in [src]'s ignition."))
return
..()
/obj/vehicle/train/cargo/engine/pussywagon/CtrlClick(mob/user)
if(load && load != user)
to_chat(user, SPAN_WARNING("You can't interact with \the [src] while its in use."))
return
var/list/options = list(
"Toggle Ignition" = image('icons/mob/screen/radial.dmi', "custodial_key"),
"Toggle Mopping" = image('icons/mob/screen/radial.dmi', "custodial_mop"),
"Toggle Vacuuming" = image('icons/mob/screen/radial.dmi', "custodial_vacuum")
"Toggle Ignition" = image(src, "keys"),
"Toggle Mopping" = image('icons/obj/janitor.dmi', "mop"),
"Toggle Vacuuming" = image('icons/obj/janitor.dmi', "trashbag3"),
"Toggle Latching" = image(src, "jantrolley", NORTH)
)
var/chosen_option = show_radial_menu(user, src, options, radius = 42, require_near = TRUE, tooltips = TRUE)
if (!chosen_option)
return
switch(chosen_option)
if("Toggle Ignition")
toggle_ignition(user)
turn_on(user)
if("Toggle Mopping")
toggle_mop(user)
if("Toggle Vacuuming")
toggle_hoover(user)
if("Toggle Latching")
if(tow)
tow.unattach(user)
/obj/vehicle/train/cargo/engine/pussywagon/AltClick(mob/user)
if(Adjacent(user))
remove_key(user)
else
return ..()
/obj/vehicle/train/cargo/engine/pussywagon/remove_key(mob/user)
if(!key)
to_chat(user, SPAN_NOTICE("There is no key in \the [src]'s ignition."))
return
if(load && load != user)
to_chat(usr, SPAN_WARNING("You can't remove \the [key] from \the [src] while its in use."))
return
to_chat(user, SPAN_NOTICE("You take out \the [key] out of \the [src]'s ignition."))
playsound(src, 'sound/machines/vehicles/pussywagon/key_out.ogg', 50, FALSE)
user.put_in_hands(key)
key = null
if(ignition)
toggle_ignition()
/obj/vehicle/train/cargo/engine/pussywagon/proc/toggle_ignition(mob/user)
if(!ignition)
if(!key)
to_chat(user, SPAN_NOTICE("There is no key in \the [src]'s ignition."))
return
else
if(stat)
return FALSE
if(powered && cell.charge < charge_use)
return FALSE
to_chat(user, SPAN_NOTICE("You turn on \the [src]'s ignition."))
playsound(src, 'sound/machines/vehicles/pussywagon/button.ogg', 50, FALSE)
playsound_in(src, 'sound/machines/vehicles/pussywagon/start.ogg', 50, FALSE, time = 1 SECOND)
on = TRUE
ignition = TRUE
update_stats()
update_icon()
return TRUE
else
to_chat(user, SPAN_NOTICE("You turn off \the [src]'s ignition."))
if(key)
playsound(src, 'sound/machines/vehicles/pussywagon/button.ogg', 50, FALSE)
on = FALSE
ignition = FALSE
update_icon()
if(tow)
if(istype(tow, /obj/vehicle/train/cargo/trolley/pussywagon))
var/obj/vehicle/train/cargo/trolley/pussywagon/PW = tow
PW.trolley_off()
/obj/vehicle/train/cargo/engine/pussywagon/turn_off()
..()
if(tow)
if(istype(tow, /obj/vehicle/train/cargo/trolley/pussywagon))
var/obj/vehicle/train/cargo/trolley/pussywagon/PW = tow
PW.trolley_off()
/obj/vehicle/train/cargo/engine/pussywagon/proc/toggle_mop(mob/user)
if(use_check_and_message(user))
return
if(!tow)
to_chat(user, SPAN_NOTICE("You must hitch the trolley first."))
return
if(on && tow)
if(istype(tow, /obj/vehicle/train/cargo/trolley/pussywagon))
var/obj/vehicle/train/cargo/trolley/pussywagon/PW = tow
if(!PW.bucket)
to_chat(user, SPAN_NOTICE("You must insert a reagent container first."))
return
playsound(src, 'sound/machines/vehicles/button.ogg', 50, FALSE)
if(!PW.mopping)
to_chat(user, SPAN_NOTICE("You turn on \the [src]'s rotary mop."))
else
@@ -162,10 +97,13 @@
/obj/vehicle/train/cargo/engine/pussywagon/proc/toggle_hoover(mob/user)
if(use_check_and_message(user))
return
if(!tow)
to_chat(user, SPAN_NOTICE("You must hitch the trolley first."))
return
if(on && tow)
if(istype(tow, /obj/vehicle/train/cargo/trolley/pussywagon))
var/obj/vehicle/train/cargo/trolley/pussywagon/PW = tow
playsound(src, 'sound/machines/vehicles/button.ogg', 50, FALSE)
if(!PW.hoover)
to_chat(user, SPAN_NOTICE("You turn on \the [src]'s vacuum cleaner."))
else
@@ -174,13 +112,12 @@
/obj/vehicle/train/cargo/engine/pussywagon/update_icon()
cut_overlays()
if(on)
add_overlay(image('icons/obj/vehicles.dmi', "[cart_icon]_on_overlay", MOB_LAYER + 1))
icon_state = "[cart_icon]_on"
add_overlay(image('icons/obj/vehicles.dmi', "[initial(icon_state)]_on_overlay", MOB_LAYER + 1))
icon_state = "[initial(icon_state)]_on"
else
add_overlay(image('icons/obj/vehicles.dmi', "[cart_icon]_off_overlay", MOB_LAYER + 1))
icon_state = "[cart_icon]_off"
add_overlay(image('icons/obj/vehicles.dmi', "[initial(icon_state)]_overlay", MOB_LAYER + 1))
icon_state = "[initial(icon_state)]"
..()
/obj/vehicle/train/cargo/engine/pussywagon/Move(var/turf/destination)
@@ -209,7 +146,7 @@
/obj/vehicle/train/cargo/trolley/pussywagon
name = "\improper C8000 deluxe custodial trolley"
desc = "The trolley of the C8000 deluxe custodial truck, equipped with a dual rotary mop and a industrial vacuum cleaner."
desc = "The trolley of the C8000 deluxe custodial truck, equipped with a dual rotary mop and a NT-X1 industrial vacuum cleaner."
icon = 'icons/obj/vehicles.dmi'
icon_state = "jantrolley"
light_range = 0 // Turn off the light inherited from the parent.
@@ -293,17 +230,17 @@
/obj/vehicle/train/cargo/trolley/pussywagon/proc/toggle_mop()
if(!mopping)
playsound(src, 'sound/machines/hydraulic_long.ogg', 20, TRUE)
mopping = 1
mopping = TRUE
else
mopping = 0
mopping = FALSE
update_icon()
/obj/vehicle/train/cargo/trolley/pussywagon/proc/toggle_hoover()
if(!hoover)
playsound(src, 'sound/machines/hydraulic_long.ogg', 20, TRUE)
hoover = 1
hoover = TRUE
else
hoover = 0
hoover = FALSE
update_icon()
/obj/vehicle/train/cargo/trolley/pussywagon/update_icon()
@@ -317,4 +254,4 @@
desc = "A stainless steel key fob with a chromed top attached to a small steel key ring. The key ring has a pink tag hanging on it, with the text \"Pussy Wagon\"."
icon = 'icons/obj/vehicles.dmi'
icon_state = "keys"
w_class = ITEMSIZE_TINY
w_class = ITEMSIZE_TINY
+30 -39
View File
@@ -60,13 +60,13 @@
if(emagged)
if(isliving(A))
var/mob/living/M = A
visible_message("<span class='warning'>[src] knocks over [M]!</span>")
visible_message(SPAN_WARNING("[src] knocks over [M]!"))
var/def_zone = ran_zone()
M.apply_effects(5, 5) //knock people down if you hit them
M.apply_damage(22 / move_delay, BRUTE, def_zone,) // and do damage according to how fast the train is going
if(isliving(load))
var/mob/living/D = load
to_chat(D, "<span class='warning'>You hit [M]!</span>")
to_chat(D, SPAN_WARNING("You hit [M]!"))
msg_admin_attack("[D.name] ([D.ckey]) hit [M.name] ([M.ckey]) with [src]. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[src.x];Y=[src.y];Z=[src.z]'>JMP</a>)",ckey=key_name(D),ckey_target=key_name(M))
@@ -83,35 +83,18 @@
//-------------------------------------------
// Interaction procs
//-------------------------------------------
/obj/vehicle/train/relaymove(mob/user, direction)
var/turf/T = get_step_to(src, get_step(src, direction))
if(!T)
to_chat(user, "You can't find a clear area to step onto.")
return 0
if(user != load)
if(user in src) //for handling players stuck in src - this shouldn't happen - but just in case it does
user.forceMove(T)
return 1
return 0
unload(user, direction)
to_chat(user, "<span class='notice'>You climb down from [src].</span>")
return 1
/obj/vehicle/train/MouseDrop_T(var/atom/movable/C, mob/user as mob)
if(user.buckled_to || user.stat || user.restrained() || !Adjacent(user) || !user.Adjacent(C) || !istype(C) || (user == C && !user.canmove))
if(use_check_and_message(user))
return
if(istype(C, /obj/vehicle/train))
attach_to(C, user)
latch(C, user)
else
if(!load(C))
to_chat(user, "<span class='warning'>You were unable to load [C] on [src].</span>")
to_chat(user, SPAN_WARNING("You were unable to load \the [C] on \the [src]."))
/obj/vehicle/train/attack_hand(mob/user as mob)
if(user.stat || user.restrained() || !Adjacent(user))
if(use_check_and_message(user))
return 0
if(user != load && (user in src))
@@ -134,32 +117,31 @@
//Note: there is a modified version of this in code\modules\vehicles\cargo_train.dm specifically for cargo train engines
/obj/vehicle/train/proc/attach_to(obj/vehicle/train/T, mob/user)
if (get_dist(src, T) > 1)
to_chat(user, "<span class='warning'>[src] is too far away from [T] to hitch them together.</span>")
to_chat(user, SPAN_WARNING("\The [src] is too far away from \the [T] to hitch them together."))
return
if (lead)
to_chat(user, "<span class='warning'>[src] is already hitched to something.</span>")
to_chat(user, SPAN_WARNING("\The [src] is already hitched to something."))
return
if (T.tow)
to_chat(user, "<span class='warning'>[T] is already towing something.</span>")
to_chat(user, SPAN_WARNING("\The [T] is already towing something."))
return
//check for cycles.
var/obj/vehicle/train/next_car = T
while (next_car)
if (next_car == src)
to_chat(user, "<span class='warning'>That seems very silly.</span>")
to_chat(user, SPAN_WARNING("That seems very silly."))
return
next_car = next_car.lead
//latch with src as the follower
lead = T
src.lead = T
T.tow = src
set_dir(lead.dir)
if(user)
to_chat(user, "<span class='notice'>You hitch [src] to [T].</span>")
set_dir(get_dir(src, lead))
to_chat(user, SPAN_NOTICE("You hitch \the [src] to \the [T]."))
playsound(loc, 'sound/items/wrench.ogg', 70, TRUE)
update_stats()
@@ -167,27 +149,36 @@
//detaches the train from whatever is towing it
/obj/vehicle/train/proc/unattach(mob/user)
if (!lead)
to_chat(user, "<span class='warning'>[src] is not hitched to anything.</span>")
to_chat(user, SPAN_WARNING("\The [src] is not hitched to anything."))
return
lead.tow = null
lead.update_stats()
to_chat(user, "<span class='notice'>You unhitch [src] from [lead].</span>")
to_chat(user, SPAN_NOTICE("You unhitch \the [src] from \the [lead]."))
lead = null
update_stats()
//-------------------------------------------
// Latching/unlatching procs
//-------------------------------------------
/obj/vehicle/train/proc/latch(obj/vehicle/train/T, mob/user)
if(!istype(T) || !Adjacent(T))
return 0
var/T_dir = get_dir(src, T) //figure out where T is wrt src
if(dir == T_dir) //if car is ahead
//if we are attaching a trolley to an engine we don't care what direction
// it is in and it should probably be attached with the engine in the lead
if(istype(T, /obj/vehicle/train/cargo/engine))
src.attach_to(T, user)
else if(reverse_direction(dir) == T_dir) //else if car is behind
T.attach_to(src, user)
else
var/T_dir = get_dir(src, T) //figure out where T is wrt src
if(dir == T_dir) //if car is ahead
src.attach_to(T, user)
else if(reverse_direction(dir) == T_dir) //else if car is behind
T.attach_to(src, user)
//returns 1 if this is the lead car of the train
/obj/vehicle/train/proc/is_train_head()
+21 -9
View File
@@ -16,6 +16,8 @@
buckle_movable = 1
buckle_lying = 0
var/buckling_sound = 'sound/effects/metal_close.ogg'
var/attack_log = null
var/on = 0
var/health = 0 //do not forget to set health for your vehicle!
@@ -284,10 +286,10 @@
if(load || C.anchored)
return 0
// if a create/closet, close before loading
var/obj/structure/closet/crate = C
if(istype(crate))
crate.close()
// if a crate/closet, close before loading
var/obj/structure/closet/closet = C
if(istype(closet))
closet.close()
C.forceMove(loc)
C.set_dir(dir)
@@ -295,20 +297,30 @@
load = C
C.layer = src.layer + 0.1
if(load_item_visible)
C.pixel_x += load_offset_x
if(ismob(C))
C.pixel_y += mob_offset_y
else
C.pixel_y += load_offset_y
if(istype(C, /obj/structure/closet/crate))
C.pixel_y += load_offset_y
else
C.pixel_y += 10
if(ismob(C))
buckle(C)
buckle(C, C)
return 1
/obj/vehicle/user_unbuckle(var/mob/user)
unload(user)
/obj/vehicle/buckle(var/atom/movable/C, mob/user)
. = ..()
if(. && buckling_sound)
playsound(src, buckling_sound, 20)
/obj/vehicle/user_unbuckle(var/mob/user, var/direction)
..()
unload(user, direction)
return
/obj/vehicle/proc/unload(var/mob/user, var/direction)
@@ -358,7 +370,7 @@
load.layer = initial(load.layer)
if(ismob(load))
unbuckle(load)
unbuckle(user)
load = null
+42
View File
@@ -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: Wowzewow (Wezzy)
# 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:
- bugfix: "Fixes vehicle latching and boarding."
- rscadd: "Adds new sounds and quality of life features to vehicles."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

@@ -2,10 +2,10 @@
<div>
<h2>TRUCK STATUS</h2>
<div v-if="is_on">
The engine is currently running.
The engine is currently running. <vui-button :params="{ toggle_engine: 1}">Stop</vui-button>
</div>
<div v-else>
The engine is off.
The engine is off. <vui-button :disabled="!has_key || !has_cell" :params="{ toggle_engine: 1}">Start</vui-button>
</div>
<div v-if="has_key">
There is a key inserted into the ignition. <vui-button :params="{ key: 1}">Remove Key</vui-button>
@@ -14,7 +14,7 @@
There is no key in the ignition.
</div>
<div v-if="has_cell">
Cell Charge: <vui-progress :class="{ good: cell_charge >= cell_max_charge * 0.8, bad: cell_charge <= cell_max_charge * 0.4, average: cell_charge < cell_max_charge * 0.8 && cell_charge > cell_max_charge * 0.4 }" :value="cell_charge" :max="cell_max_charge" :min="0">{{ cell_charge }}J</vui-progress> <vui-tooltip label="?">The cell can be removed by using a screwdriver to open the maintenance panel, then using a crowbar to shimmy it out.</vui-tooltip>
Cell Charge:<br><vui-progress :class="{ good: cell_charge >= cell_max_charge * 0.8, bad: cell_charge <= cell_max_charge * 0.4, average: cell_charge < cell_max_charge * 0.8 && cell_charge > cell_max_charge * 0.4 }" :value="cell_charge" :max="cell_max_charge" :min="0">{{ cell_charge }}J</vui-progress> <vui-tooltip label="?">The cell can be removed by using a screwdriver to open the maintenance panel, then using a crowbar to shimmy it out.</vui-tooltip>
</div>
<div v-else>
There is no cell installed. <vui-tooltip label="?">The cell can be installed by using a screwdriver to open the maintenance panel, then clicking on the engine with a compatible power cell.</vui-tooltip>
@@ -32,7 +32,7 @@
The trolley is not vacuuming. <vui-button :disabled="!is_on" :params="{ toggle_hoover: 1}">Toggle</vui-button>
</div>
<div>
Vacuum Capacity Remaining: <vui-progress :class="{ good: vacuum_capacity >= max_vacuum_capacity * 0.8, bad: vacuum_capacity <= max_vacuum_capacity * 0.4, average: vacuum_capacity < max_vacuum_capacity * 0.8 && vacuum_capacity > max_vacuum_capacity * 0.4 }" :value="vacuum_capacity" :max="max_vacuum_capacity" :min="0">{{ vacuum_capacity }} L</vui-progress> <vui-button :disabled="vacuum_capacity >= max_vacuum_capacity" :params="{ empty_hoover: 1}">Empty</vui-button>
Vacuum Capacity Remaining:<br><vui-progress :class="{ good: vacuum_capacity >= max_vacuum_capacity * 0.8, bad: vacuum_capacity <= max_vacuum_capacity * 0.4, average: vacuum_capacity < max_vacuum_capacity * 0.8 && vacuum_capacity > max_vacuum_capacity * 0.4 }" :value="vacuum_capacity" :max="max_vacuum_capacity" :min="0">{{ vacuum_capacity }} L</vui-progress> <vui-button :disabled="vacuum_capacity >= max_vacuum_capacity" :params="{ empty_hoover: 1}">Empty</vui-button>
</div>
<div v-if="is_mopping">
The trolley is currently mopping. <vui-button :disabled="!is_on || !has_bucket || bucket_capacity <= 0" :params="{ toggle_mop: 1}">Toggle</vui-button>
@@ -43,7 +43,7 @@
<div v-if="has_bucket">
The trolley has a reagent container installed. <vui-tooltip label="?">The trolley must have a reagent container installed to draw reagents from, such as water or space cleaner. This can be done by opening the maintenance panel on the trolley with a screwdriver and clicking on it with a bucket. Similarly, with an open panel, it can be removed by using a wrench on it.</vui-tooltip>
<div>
Container Reagents Remaining: <vui-progress :class="{ good: bucket_capacity >= max_bucket_capacity * 0.8, bad: bucket_capacity <= max_bucket_capacity * 0.4, average: bucket_capacity < max_bucket_capacity * 0.8 && bucket_capacity > max_bucket_capacity * 0.4 }" :value="bucket_capacity" :max="max_bucket_capacity" :min="0">{{ bucket_capacity }} cl</vui-progress>
Container Reagents Remaining:<br><vui-progress :class="{ good: bucket_capacity >= max_bucket_capacity * 0.8, bad: bucket_capacity <= max_bucket_capacity * 0.4, average: bucket_capacity < max_bucket_capacity * 0.8 && bucket_capacity > max_bucket_capacity * 0.4 }" :value="bucket_capacity" :max="max_bucket_capacity" :min="0">{{ bucket_capacity }} cl</vui-progress>
</div>
</div>
<div v-else>
@@ -66,4 +66,4 @@ export default {
return this.$root.$data.state;
}
};
</script>
</script>
@@ -14,7 +14,7 @@
There is no key in the ignition.
</div>
<div v-if="has_cell">
Cell Charge: <vui-progress :class="{ good: cell_charge >= cell_max_charge * 0.8, bad: cell_charge <= cell_max_charge * 0.4, average: cell_charge < cell_max_charge * 0.8 && cell_charge > cell_max_charge * 0.4 }" :value="cell_charge" :max="cell_max_charge" :min="0">{{ cell_charge }}J</vui-progress> <vui-tooltip label="?">The cell can be removed by using a screwdriver to open the maintenance panel, then using a crowbar to shimmy it out.</vui-tooltip>
Cell Charge:<br><vui-progress :class="{ good: cell_charge >= cell_max_charge * 0.8, bad: cell_charge <= cell_max_charge * 0.4, average: cell_charge < cell_max_charge * 0.8 && cell_charge > cell_max_charge * 0.4 }" :value="cell_charge" :max="cell_max_charge" :min="0">{{ cell_charge }}J</vui-progress> <vui-tooltip label="?">The cell can be removed by using a screwdriver to open the maintenance panel, then using a crowbar to shimmy it out.</vui-tooltip>
</div>
<div v-else>
There is no cell installed. <vui-tooltip label="?">The cell can be installed by using a screwdriver to open the maintenance panel, then clicking on the engine with a compatible power cell.</vui-tooltip>
@@ -34,4 +34,4 @@ export default {
return this.$root.$data.state;
}
};
</script>
</script>