Files
Bubberstation/code/modules/vehicles/ridden.dm
SkyratBot 515b270fd4 [MIRROR] Minor vehicle tidying (#4161)
* Minor vehicle tidying (#57625)

Nothing too interesting just cleanup and making it readable

* Minor vehicle tidying

Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
2021-03-15 00:21:01 +00:00

66 lines
2.0 KiB
Plaintext

/obj/vehicle/ridden
name = "ridden vehicle"
can_buckle = TRUE
max_buckled_mobs = 1
buckle_lying = 0
pass_flags_self = PASSTABLE
COOLDOWN_DECLARE(message_cooldown)
/obj/vehicle/ridden/examine(mob/user)
. = ..()
if(key_type)
if(!inserted_key)
. += "<span class='notice'>Put a key inside it by clicking it with the key.</span>"
else
. += "<span class='notice'>Alt-click [src] to remove the key.</span>"
/obj/vehicle/ridden/generate_action_type(actiontype)
var/datum/action/vehicle/ridden/A = ..()
. = A
if(istype(A))
A.vehicle_ridden_target = src
/obj/vehicle/ridden/post_unbuckle_mob(mob/living/M)
remove_occupant(M)
return ..()
/obj/vehicle/ridden/post_buckle_mob(mob/living/M)
add_occupant(M)
return ..()
/obj/vehicle/ridden/attackby(obj/item/I, mob/user, params)
if(!key_type || is_key(inserted_key) || !is_key(I))
return ..()
if(!user.transferItemToLoc(I, src))
to_chat(user, "<span class='warning'>[I] seems to be stuck to your hand!</span>")
return
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
if(inserted_key) //just in case there's an invalid key
inserted_key.forceMove(drop_location())
inserted_key = I
/obj/vehicle/ridden/AltClick(mob/user)
if(!inserted_key || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !issilicon(user)))
return ..()
if(!is_occupant(user))
to_chat(user, "<span class='warning'>You must be riding the [src] to remove [src]'s key!</span>")
return
to_chat(user, "<span class='notice'>You remove \the [inserted_key] from \the [src].</span>")
inserted_key.forceMove(drop_location())
user.put_in_hands(inserted_key)
inserted_key = null
/obj/vehicle/ridden/user_buckle_mob(mob/living/M, mob/user, check_loc = TRUE)
if(!in_range(user, src) || !in_range(M, src))
return FALSE
return ..(M, user, FALSE)
/obj/vehicle/ridden/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
if(!force && occupant_amount() >= max_occupants)
return FALSE
return ..()
/obj/vehicle/ridden/zap_act(power, zap_flags)
zap_buckle_check(power)
return ..()