[READY]VEHICLE REFACTOR - Riding datums --> Components, Vehicles --> /obj/vehicle, staging for mech overhaul later on
This commit is contained in:
committed by
CitadelStationBot
parent
6217206bae
commit
66c66f0bd7
@@ -54,7 +54,7 @@
|
||||
name = "Biker Gang Kit" //TUNNEL SNAKES OWN THIS TOWN
|
||||
cost = 2000
|
||||
contraband = TRUE
|
||||
contains = list(/obj/vehicle/atv,
|
||||
contains = list(/obj/vehicle/ridden/atv,
|
||||
/obj/item/key,
|
||||
/obj/item/clothing/suit/jacket/leather/overcoat,
|
||||
/obj/item/clothing/gloves/color/black,
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
|
||||
/datum/crafting_recipe/skateboard
|
||||
name = "Skateboard"
|
||||
result = /obj/vehicle/scooter/skateboard
|
||||
result = /obj/vehicle/ridden/scooter/skateboard
|
||||
time = 60
|
||||
reqs = list(/obj/item/stack/sheet/metal = 5,
|
||||
/obj/item/stack/rods = 10)
|
||||
@@ -365,7 +365,7 @@
|
||||
|
||||
/datum/crafting_recipe/scooter
|
||||
name = "Scooter"
|
||||
result = /obj/vehicle/scooter
|
||||
result = /obj/vehicle/ridden/scooter
|
||||
time = 65
|
||||
reqs = list(/obj/item/stack/sheet/metal = 5,
|
||||
/obj/item/stack/rods = 12)
|
||||
|
||||
@@ -469,16 +469,19 @@
|
||||
|
||||
//Boat
|
||||
|
||||
/obj/vehicle/lavaboat
|
||||
/obj/vehicle/ridden/lavaboat
|
||||
name = "lava boat"
|
||||
desc = "A boat used for traversing lava."
|
||||
icon_state = "goliath_boat"
|
||||
icon = 'icons/obj/lavaland/dragonboat.dmi'
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF
|
||||
can_buckle = TRUE
|
||||
|
||||
/obj/vehicle/lavaboat/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
/obj/vehicle/ridden/lavaboat/Initialize()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/boat
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.keytype = /obj/item/oar
|
||||
D.allowed_turf_typecache = typecacheof(/turf/open/lava)
|
||||
|
||||
/obj/item/oar
|
||||
name = "oar"
|
||||
@@ -501,7 +504,7 @@
|
||||
|
||||
/datum/crafting_recipe/boat
|
||||
name = "goliath hide boat"
|
||||
result = /obj/vehicle/lavaboat
|
||||
result = /obj/vehicle/ridden/lavaboat
|
||||
reqs = list(/obj/item/stack/sheet/animalhide/goliath_hide = 3)
|
||||
time = 50
|
||||
category = CAT_PRIMAL
|
||||
@@ -518,17 +521,20 @@
|
||||
/obj/item/ship_in_a_bottle/attack_self(mob/user)
|
||||
to_chat(user, "You're not sure how they get the ships in these things, but you're pretty sure you know how to get it out.")
|
||||
playsound(user.loc, 'sound/effects/glassbr1.ogg', 100, 1)
|
||||
new /obj/vehicle/lavaboat/dragon(get_turf(src))
|
||||
new /obj/vehicle/ridden/lavaboat/dragon(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/vehicle/lavaboat/dragon
|
||||
/obj/vehicle/ridden/lavaboat/dragon
|
||||
name = "mysterious boat"
|
||||
desc = "This boat moves where you will it, without the need for an oar."
|
||||
icon_state = "dragon_boat"
|
||||
|
||||
/obj/vehicle/lavaboat/dragon/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
..()
|
||||
riding_datum = new/datum/riding/boat/dragon
|
||||
/obj/vehicle/ridden/lavaboat/dragon/Initialize()
|
||||
. = ..()
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.vehicle_move_delay = 1
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(1, 2), TEXT_SOUTH = list(1, 2), TEXT_EAST = list(1, 2), TEXT_WEST = list( 1, 2)))
|
||||
D.keytype = null
|
||||
|
||||
//Potion of Flight
|
||||
/obj/item/reagent_containers/glass/bottle/potion
|
||||
|
||||
@@ -890,8 +890,11 @@
|
||||
if(!is_type_in_typecache(M, can_ride_typecache))
|
||||
M.visible_message("<span class='warning'>[M] really can't seem to mount [src]...</span>")
|
||||
return
|
||||
if(!riding_datum)
|
||||
riding_datum = new /datum/riding/human(src)
|
||||
var/datum/component/riding/human/riding_datum = LoadComponent(/datum/component/riding/human)
|
||||
riding_datum.ride_check_rider_incapacitated = TRUE
|
||||
riding_datum.ride_check_ridden_incapacitated = TRUE
|
||||
riding_datum.ride_check_rider_restrained = TRUE
|
||||
riding_datum.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 6), TEXT_SOUTH = list(0, 6), TEXT_EAST = list(-6, 4), TEXT_WEST = list( 6, 4)))
|
||||
if(buckled_mobs && ((M in buckled_mobs) || (buckled_mobs.len >= max_buckled_mobs)) || buckled || (M.stat != CONSCIOUS))
|
||||
return
|
||||
visible_message("<span class='notice'>[M] starts to climb onto [src]...</span>")
|
||||
@@ -908,13 +911,6 @@
|
||||
else
|
||||
visible_message("<span class='warning'>[M] fails to climb onto [src]!</span>")
|
||||
|
||||
/mob/living/carbon/human/unbuckle_mob(mob/living/M, force=FALSE)
|
||||
if(iscarbon(M))
|
||||
if(riding_datum)
|
||||
riding_datum.unequip_buckle_inhands(M)
|
||||
riding_datum.restore_position(M)
|
||||
. = ..(M, force)
|
||||
|
||||
/mob/living/carbon/human/species
|
||||
var/race = null
|
||||
|
||||
|
||||
@@ -188,12 +188,8 @@
|
||||
return
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.a_intent == INTENT_DISARM)
|
||||
if(H.buckled_mobs && (src in H.buckled_mobs) && H.riding_datum)
|
||||
H.riding_datum.force_dismount(src)
|
||||
dna.species.spec_attack_hand(H, src)
|
||||
|
||||
|
||||
/mob/living/carbon/human/attack_paw(mob/living/carbon/monkey/M)
|
||||
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
|
||||
var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
|
||||
|
||||
@@ -58,11 +58,6 @@
|
||||
//End bloody footprints
|
||||
S.step_action()
|
||||
|
||||
/mob/living/carbon/human/Moved()
|
||||
. = ..()
|
||||
if(buckled_mobs && buckled_mobs.len && riding_datum)
|
||||
riding_datum.on_vehicle_move()
|
||||
|
||||
/mob/living/carbon/human/Process_Spacemove(movement_dir = 0) //Temporary laziness thing. Will change to handles by species reee.
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
@@ -491,14 +491,14 @@
|
||||
. = ..()
|
||||
if(.)
|
||||
user.spin(20, 1)
|
||||
if(iscyborg(user))
|
||||
if(iscyborg(user) && user.has_buckled_mobs())
|
||||
var/mob/living/silicon/robot/R = user
|
||||
if(R.buckled_mobs)
|
||||
GET_COMPONENT_FROM(riding_datum, /datum/component/riding, R)
|
||||
if(riding_datum)
|
||||
for(var/mob/M in R.buckled_mobs)
|
||||
if(R.riding_datum)
|
||||
R.riding_datum.force_dismount(M)
|
||||
else
|
||||
R.unbuckle_all_mobs()
|
||||
riding_datum.force_dismount(M)
|
||||
else
|
||||
R.unbuckle_all_mobs()
|
||||
|
||||
|
||||
/datum/emote/living/circle
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
ranged_ability.remove_ranged_ability(src)
|
||||
if(buckled)
|
||||
buckled.unbuckle_mob(src,force=1)
|
||||
QDEL_NULL(riding_datum)
|
||||
|
||||
for(var/mob/living/simple_animal/drone/D in GLOB.player_list)
|
||||
for(var/image/I in staticOverlays)
|
||||
@@ -955,11 +954,6 @@
|
||||
"[C] leaps out of [src]'s way!")]</span>")
|
||||
C.Knockdown(40)
|
||||
|
||||
/mob/living/post_buckle_mob(mob/living/M)
|
||||
if(riding_datum)
|
||||
riding_datum.handle_vehicle_offsets()
|
||||
riding_datum.handle_vehicle_layer()
|
||||
|
||||
/mob/living/ConveyorMove()
|
||||
if((movement_type & FLYING) && !stat)
|
||||
return
|
||||
|
||||
@@ -1151,8 +1151,7 @@
|
||||
if(!is_type_in_typecache(M, can_ride_typecache))
|
||||
M.visible_message("<span class='warning'>[M] really can't seem to mount [src]...</span>")
|
||||
return
|
||||
if(!riding_datum)
|
||||
riding_datum = new /datum/riding/cyborg(src)
|
||||
var/datum/component/riding/riding_datum = LoadComponent(/datum/component/riding/cyborg)
|
||||
if(buckled_mobs)
|
||||
if(buckled_mobs.len >= max_buckled_mobs)
|
||||
return
|
||||
@@ -1175,7 +1174,8 @@
|
||||
|
||||
/mob/living/silicon/robot/unbuckle_mob(mob/user)
|
||||
if(iscarbon(user))
|
||||
if(riding_datum)
|
||||
GET_COMPONENT(riding_datum, /datum/component/riding)
|
||||
if(istype(riding_datum))
|
||||
riding_datum.unequip_buckle_inhands(user)
|
||||
riding_datum.restore_position(user)
|
||||
. = ..(user)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/mob/living/silicon/robot/Process_Spacemove(movement_dir = 0)
|
||||
if(ionpulse())
|
||||
return 1
|
||||
@@ -24,3 +25,26 @@
|
||||
. = ..()
|
||||
if(riding_datum)
|
||||
riding_datum.on_vehicle_move()
|
||||
=======
|
||||
/mob/living/silicon/robot/Process_Spacemove(movement_dir = 0)
|
||||
if(ionpulse())
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/robot/movement_delay()
|
||||
. = ..()
|
||||
var/static/config_robot_delay
|
||||
if(isnull(config_robot_delay))
|
||||
config_robot_delay = CONFIG_GET(number/robot_delay)
|
||||
. += speed + config_robot_delay
|
||||
|
||||
/mob/living/silicon/robot/mob_negates_gravity()
|
||||
return magpulse
|
||||
|
||||
/mob/living/silicon/robot/mob_has_gravity()
|
||||
return ..() || mob_negates_gravity()
|
||||
|
||||
/mob/living/silicon/robot/experience_pressure_difference(pressure_difference, direction)
|
||||
if(!magpulse)
|
||||
return ..()
|
||||
>>>>>>> 5182128... refactors riding datums to a component, vehicle refactor staging for mech overhaul (#32249)
|
||||
|
||||
@@ -379,12 +379,11 @@
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/post_buckle_mob(mob/living/M)
|
||||
if(M in buckled_mobs) //post buckling
|
||||
M.pixel_y = initial(M.pixel_y) + 9
|
||||
if(M.layer < layer)
|
||||
M.layer = layer + 0.01
|
||||
M.pixel_y = initial(M.pixel_y) + 9
|
||||
if(M.layer < layer)
|
||||
M.layer = layer + 0.01
|
||||
|
||||
else //post unbuckling
|
||||
/mob/living/simple_animal/bot/mulebot/post_unbuckle_mob(mob/living/M)
|
||||
load = null
|
||||
M.layer = initial(M.layer)
|
||||
M.pixel_y = initial(M.pixel_y)
|
||||
|
||||
@@ -521,37 +521,26 @@
|
||||
client.screen |= l_hand
|
||||
|
||||
//ANIMAL RIDING
|
||||
/mob/living/simple_animal/unbuckle_mob(mob/living/buckled_mob, force = 0, check_loc = 1)
|
||||
if(riding_datum)
|
||||
riding_datum.restore_position(buckled_mob)
|
||||
. = ..()
|
||||
|
||||
|
||||
/mob/living/simple_animal/user_buckle_mob(mob/living/M, mob/user)
|
||||
GET_COMPONENT(riding_datum, /datum/component/riding)
|
||||
if(riding_datum)
|
||||
if(user.incapacitated())
|
||||
return
|
||||
for(var/atom/movable/A in get_turf(src))
|
||||
if(A != src && A != M && A.density)
|
||||
return
|
||||
M.loc = get_turf(src)
|
||||
riding_datum.handle_vehicle_offsets()
|
||||
riding_datum.ridden = src
|
||||
M.forceMove(get_turf(src))
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/relaymove(mob/user, direction)
|
||||
GET_COMPONENT(riding_datum, /datum/component/riding)
|
||||
if(tame && riding_datum)
|
||||
riding_datum.handle_ride(user, direction)
|
||||
|
||||
/mob/living/simple_animal/Moved()
|
||||
. = ..()
|
||||
if(riding_datum)
|
||||
riding_datum.on_vehicle_move()
|
||||
|
||||
|
||||
/mob/living/simple_animal/buckle_mob(mob/living/buckled_mob, force = 0, check_loc = 1)
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/animal
|
||||
|
||||
LoadComponent(/datum/component/riding)
|
||||
|
||||
/mob/living/simple_animal/proc/toggle_ai(togglestatus)
|
||||
if (AIStatus != togglestatus)
|
||||
|
||||
@@ -774,14 +774,14 @@
|
||||
|
||||
//Default buckling shift visual for mobs
|
||||
/mob/post_buckle_mob(mob/living/M)
|
||||
if(M in buckled_mobs)//post buckling
|
||||
var/height = M.get_mob_buckling_height(src)
|
||||
M.pixel_y = initial(M.pixel_y) + height
|
||||
if(M.layer < layer)
|
||||
M.layer = layer + 0.1
|
||||
else //post unbuckling
|
||||
M.layer = initial(M.layer)
|
||||
M.pixel_y = initial(M.pixel_y)
|
||||
var/height = M.get_mob_buckling_height(src)
|
||||
M.pixel_y = initial(M.pixel_y) + height
|
||||
if(M.layer < layer)
|
||||
M.layer = layer + 0.1
|
||||
|
||||
/mob/post_unbuckle_mob(mob/living/M)
|
||||
M.layer = initial(M.layer)
|
||||
M.pixel_y = initial(M.pixel_y)
|
||||
|
||||
//returns the height in pixel the mob should have when buckled to another mob.
|
||||
/mob/proc/get_mob_buckling_height(mob/seat)
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
var/obj/machinery/machine = null
|
||||
var/other_mobs = null
|
||||
var/disabilities = 0 //Carbon
|
||||
var/movement_type = GROUND //Incase you have multiple types, you automatically use the most useful one. IE: Skating on ice, flippers on water, flying over chasm/space, etc.
|
||||
|
||||
var/atom/movable/pulling = null
|
||||
var/grab_state = 0
|
||||
|
||||
@@ -343,8 +343,8 @@
|
||||
|
||||
if(istype(C, /obj/vehicle))
|
||||
var/obj/vehicle/V = C
|
||||
var/datum/riding/R = V.riding_datum
|
||||
if(V.riding_datum)
|
||||
var/datum/component/riding/R = V.GetComponent(/datum/component/riding)
|
||||
if(R)
|
||||
if(R.vehicle_move_delay <= 0 )
|
||||
to_chat(user, "<span class='warning'>The [C] can't be made any faster!</span>")
|
||||
return ..()
|
||||
@@ -355,7 +355,6 @@
|
||||
C.add_atom_colour("#FF0000", FIXED_COLOUR_PRIORITY)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/slimepotion/fireproof
|
||||
name = "slime chill potion"
|
||||
desc = "A potent chemical mix that will fireproof any article of clothing. Has three uses."
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
//This is a simple 3 by 3 grid working off the corpse of the space torus. The donut is dead, cube has been avenged!
|
||||
|
||||
#define Z_LEVEL_NORTH "1"
|
||||
#define Z_LEVEL_SOUTH "2"
|
||||
#define Z_LEVEL_EAST "4"
|
||||
#define Z_LEVEL_WEST "8"
|
||||
|
||||
GLOBAL_LIST_EMPTY(z_levels_list)
|
||||
|
||||
/datum/space_level
|
||||
@@ -19,7 +14,7 @@ GLOBAL_LIST_EMPTY(z_levels_list)
|
||||
linked = transition_type
|
||||
if(linked == SELFLOOPING)
|
||||
neigbours = list()
|
||||
var/list/L = list(Z_LEVEL_NORTH,Z_LEVEL_SOUTH,Z_LEVEL_EAST,Z_LEVEL_WEST)
|
||||
var/list/L = list(TEXT_NORTH,TEXT_SOUTH,TEXT_EAST,TEXT_WEST)
|
||||
for(var/A in L)
|
||||
neigbours[A] = src
|
||||
|
||||
@@ -27,18 +22,18 @@ GLOBAL_LIST_EMPTY(z_levels_list)
|
||||
for(var/datum/point/P in L)
|
||||
if(P.x == xi)
|
||||
if(P.y == yi+1)
|
||||
neigbours[Z_LEVEL_NORTH] = P.spl
|
||||
P.spl.neigbours[Z_LEVEL_SOUTH] = src
|
||||
neigbours[TEXT_NORTH] = P.spl
|
||||
P.spl.neigbours[TEXT_SOUTH] = src
|
||||
else if(P.y == yi-1)
|
||||
neigbours[Z_LEVEL_SOUTH] = P.spl
|
||||
P.spl.neigbours[Z_LEVEL_NORTH] = src
|
||||
neigbours[TEXT_SOUTH] = P.spl
|
||||
P.spl.neigbours[TEXT_NORTH] = src
|
||||
else if(P.y == yi)
|
||||
if(P.x == xi+1)
|
||||
neigbours[Z_LEVEL_EAST] = P.spl
|
||||
P.spl.neigbours[Z_LEVEL_WEST] = src
|
||||
neigbours[TEXT_EAST] = P.spl
|
||||
P.spl.neigbours[TEXT_WEST] = src
|
||||
else if(P.x == xi-1)
|
||||
neigbours[Z_LEVEL_WEST] = P.spl
|
||||
P.spl.neigbours[Z_LEVEL_EAST] = src
|
||||
neigbours[TEXT_WEST] = P.spl
|
||||
P.spl.neigbours[TEXT_EAST] = src
|
||||
|
||||
/datum/point //this is explicitly utilitarian datum type made specially for the space map generation and are absolutely unusable for anything else
|
||||
var/list/neigbours = list()
|
||||
@@ -157,8 +152,3 @@ GLOBAL_LIST_EMPTY(z_levels_list)
|
||||
|
||||
for(var/A in grid)
|
||||
GLOB.z_levels_list[A] = grid[A]
|
||||
|
||||
#undef Z_LEVEL_NORTH
|
||||
#undef Z_LEVEL_SOUTH
|
||||
#undef Z_LEVEL_EAST
|
||||
#undef Z_LEVEL_WEST
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
#define VEHICLE_CONTROL_PERMISSION 1
|
||||
#define VEHICLE_CONTROL_DRIVE 2
|
||||
|
||||
/obj/vehicle
|
||||
name = "generic vehicle"
|
||||
desc = "Yell at coderbus."
|
||||
icon = 'icons/obj/vehicles.dmi'
|
||||
icon_state = "fuckyou"
|
||||
max_integrity = 300
|
||||
armor = list("melee" = 30, "bullet" = 30, "laser" = 30, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 60, "acid" = 60)
|
||||
density = TRUE
|
||||
anchored = FALSE
|
||||
var/list/mob/occupants //mob = bitflags of their control level.
|
||||
var/max_occupants = 1
|
||||
var/max_drivers = 1
|
||||
var/movedelay = 2
|
||||
var/lastmove = 0
|
||||
var/key_type
|
||||
var/obj/item/key/inserted_key
|
||||
var/key_type_exact = TRUE //can subtypes work
|
||||
var/canmove = TRUE
|
||||
var/emulate_door_bumps = TRUE //when bumping a door try to make occupants bump them to open them.
|
||||
var/default_driver_move = TRUE //handle driver movement instead of letting something else do it like riding datums.
|
||||
var/list/autogrant_actions_passenger //plain list of typepaths
|
||||
var/list/autogrant_actions_controller //assoc list "[bitflag]" = list(typepaths)
|
||||
var/list/mob/occupant_actions //assoc list mob = list(type = action datum assigned to mob)
|
||||
|
||||
/obj/vehicle/Initialize(mapload)
|
||||
. = ..()
|
||||
occupants = list()
|
||||
autogrant_actions_passenger = list()
|
||||
autogrant_actions_controller = list()
|
||||
occupant_actions = list()
|
||||
generate_actions()
|
||||
|
||||
/obj/vehicle/proc/is_key(obj/item/I)
|
||||
return I? (key_type_exact? (I.type == key_type) : istype(I, key_type)) : FALSE
|
||||
|
||||
/obj/vehicle/proc/return_occupants()
|
||||
return occupants
|
||||
|
||||
/obj/vehicle/proc/occupant_amount()
|
||||
return length(occupants)
|
||||
|
||||
/obj/vehicle/proc/return_amount_of_controllers_with_flag(flag)
|
||||
. = 0
|
||||
for(var/i in occupants)
|
||||
if(occupants[i] & flag)
|
||||
.++
|
||||
|
||||
/obj/vehicle/proc/return_controllers_with_flag(flag)
|
||||
. = list()
|
||||
for(var/i in occupants)
|
||||
if(occupants[i] & flag)
|
||||
. += i
|
||||
|
||||
/obj/vehicle/proc/return_drivers()
|
||||
return return_controllers_with_flag(VEHICLE_CONTROL_DRIVE)
|
||||
|
||||
/obj/vehicle/proc/driver_amount()
|
||||
return return_amount_of_controllers_with_flag(VEHICLE_CONTROL_DRIVE)
|
||||
|
||||
/obj/vehicle/proc/is_driver(mob/M)
|
||||
return is_occupant(M) && occupants[M] & VEHICLE_CONTROL_DRIVE
|
||||
|
||||
/obj/vehicle/proc/is_occupant(mob/M)
|
||||
return !isnull(occupants[M])
|
||||
|
||||
/obj/vehicle/proc/add_occupant(mob/M, control_flags)
|
||||
if(!istype(M) || occupants[M])
|
||||
return FALSE
|
||||
occupants[M] = NONE
|
||||
add_control_flags(M, control_flags)
|
||||
grant_passenger_actions(M)
|
||||
after_add_occupant(M)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/after_add_occupant(mob/M)
|
||||
auto_assign_occupant_flags(M)
|
||||
|
||||
/obj/vehicle/proc/auto_assign_occupant_flags(mob/M) //override for each type that needs it. Default is assign driver if drivers is not at max.
|
||||
if(driver_amount() < max_drivers)
|
||||
add_control_flags(M, VEHICLE_CONTROL_DRIVE|VEHICLE_CONTROL_PERMISSION)
|
||||
|
||||
/obj/vehicle/proc/remove_occupant(mob/M)
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
remove_control_flags(M, ALL)
|
||||
occupants -= M
|
||||
remove_passenger_actions(M)
|
||||
cleanup_actions_for_mob(M)
|
||||
after_remove_occupant(M)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/after_remove_occupant(mob/M)
|
||||
|
||||
/obj/vehicle/relaymove(mob/user, direction)
|
||||
if(is_driver(user))
|
||||
return driver_move(user, direction)
|
||||
return FALSE
|
||||
|
||||
/obj/vehicle/proc/driver_move(mob/user, direction)
|
||||
if(key_type && !is_key(inserted_key))
|
||||
to_chat(user, "<span class='warning'>[src] has no key inserted!</span>")
|
||||
return FALSE
|
||||
if(!default_driver_move)
|
||||
return
|
||||
vehicle_move(direction)
|
||||
|
||||
/obj/vehicle/proc/vehicle_move(direction)
|
||||
if(lastmove + movedelay > world.time)
|
||||
return FALSE
|
||||
lastmove = world.time
|
||||
return step(src, direction)
|
||||
|
||||
/obj/vehicle/proc/add_control_flags(mob/controller, flags)
|
||||
if(!istype(controller) || !flags)
|
||||
return FALSE
|
||||
occupants[controller] |= flags
|
||||
for(var/i in GLOB.bitflags)
|
||||
if(flags & i)
|
||||
grant_controller_actions_by_flag(controller, i)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/remove_control_flags(mob/controller, flags)
|
||||
if(!istype(controller) || !flags)
|
||||
return FALSE
|
||||
occupants[controller] &= ~flags
|
||||
for(var/i in GLOB.bitflags)
|
||||
if(flags & i)
|
||||
remove_controller_actions_by_flag(controller, i)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/Collide(atom/movable/M)
|
||||
. = ..()
|
||||
if(emulate_door_bumps)
|
||||
if(istype(M, /obj/machinery/door) && has_buckled_mobs())
|
||||
for(var/m in occupants)
|
||||
M.CollidedWith(m)
|
||||
|
||||
@@ -1,45 +1,63 @@
|
||||
|
||||
/obj/vehicle/atv
|
||||
/obj/vehicle/ridden/atv
|
||||
name = "all-terrain vehicle"
|
||||
desc = "An all-terrain vehicle built for traversing rough terrain with ease. One of the few old-Earth technologies that are still relevant on most planet-bound outposts."
|
||||
icon_state = "atv"
|
||||
key_type = /obj/item/key
|
||||
var/static/mutable_appearance/atvcover
|
||||
|
||||
/obj/vehicle/atv/buckle_mob(mob/living/buckled_mob, force = 0, check_loc = 1)
|
||||
/obj/vehicle/ridden/atv/Initialize()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/atv
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.vehicle_move_delay = 1
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(0, 4), TEXT_WEST = list( 0, 4)))
|
||||
D.set_vehicle_dir_layer(SOUTH, ABOVE_MOB_LAYER)
|
||||
D.set_vehicle_dir_layer(NORTH, OBJ_LAYER)
|
||||
D.set_vehicle_dir_layer(EAST, OBJ_LAYER)
|
||||
D.set_vehicle_dir_layer(WEST, OBJ_LAYER)
|
||||
|
||||
/obj/vehicle/atv/Initialize()
|
||||
. = ..()
|
||||
atvcover = atvcover || mutable_appearance(icon, "atvcover", ABOVE_MOB_LAYER)
|
||||
/obj/vehicle/ridden/atv/post_buckle_mob(mob/living/M)
|
||||
add_overlay(atvcover)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/vehicle/atv/post_buckle_mob(mob/living/M)
|
||||
if(has_buckled_mobs())
|
||||
add_overlay(atvcover)
|
||||
else
|
||||
/obj/vehicle/ridden/atv/post_unbuckle_mob(mob/living/M)
|
||||
if(!has_buckled_mobs())
|
||||
cut_overlay(atvcover)
|
||||
|
||||
|
||||
return ..()
|
||||
|
||||
//TURRETS!
|
||||
/obj/vehicle/atv/turret
|
||||
/obj/vehicle/ridden/atv/turret
|
||||
var/obj/machinery/porta_turret/syndicate/vehicle_turret/turret = null
|
||||
|
||||
|
||||
/obj/machinery/porta_turret/syndicate/vehicle_turret
|
||||
name = "mounted turret"
|
||||
scan_range = 7
|
||||
emp_vunerable = 1
|
||||
density = FALSE
|
||||
|
||||
|
||||
/obj/vehicle/atv/turret/Initialize()
|
||||
/obj/vehicle/ridden/atv/turret/Initialize()
|
||||
. = ..()
|
||||
turret = new(loc)
|
||||
turret.base = src
|
||||
|
||||
/obj/vehicle/atv/turret/buckle_mob(mob/living/buckled_mob, force = 0, check_loc = 1)
|
||||
/obj/vehicle/ridden/atv/turret/Moved()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/atv/turret
|
||||
|
||||
if(turret)
|
||||
turret.forceMove(get_turf(src))
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
turret.pixel_x = 0
|
||||
turret.pixel_y = 4
|
||||
turret.layer = ABOVE_MOB_LAYER
|
||||
if(EAST)
|
||||
turret.pixel_x = -12
|
||||
turret.pixel_y = 4
|
||||
turret.layer = OBJ_LAYER
|
||||
if(SOUTH)
|
||||
turret.pixel_x = 0
|
||||
turret.pixel_y = 4
|
||||
turret.layer = OBJ_LAYER
|
||||
if(WEST)
|
||||
turret.pixel_x = 12
|
||||
turret.pixel_y = 4
|
||||
turret.layer = OBJ_LAYER
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
var/static/list/bike_music = list('sound/misc/bike1.mid',
|
||||
'sound/misc/bike2.mid',
|
||||
'sound/misc/bike3.mid')
|
||||
|
||||
/obj/vehicle/bicycle/Initialize()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/bicycle
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(0, 4), TEXT_WEST = list( 0, 4)))
|
||||
D.vehicle_move_delay = 0
|
||||
|
||||
/obj/vehicle/bicycle/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
if(prob(easter_egg_chance) || (SSevents.holidays && SSevents.holidays[APRIL_FOOLS]))
|
||||
@@ -24,7 +27,7 @@
|
||||
/obj/vehicle/bicycle/tesla_act() // :::^^^)))
|
||||
name = "fried bicycle"
|
||||
desc = "Well spent."
|
||||
riding_datum = null
|
||||
color = rgb(63, 23, 4)
|
||||
can_buckle = FALSE
|
||||
for(var/m in buckled_mobs)
|
||||
unbuckle_mob(m,1)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/obj/vehicle/sealed
|
||||
var/enter_delay = 20
|
||||
|
||||
/obj/vehicle/sealed/generate_actions()
|
||||
. = ..()
|
||||
initialize_passenger_action_type(/datum/action/vehicle/sealed/climb_out)
|
||||
|
||||
/obj/vehicle/sealed/generate_action_type()
|
||||
var/datum/action/vehicle/sealed/E = ..()
|
||||
. = E
|
||||
if(istype(E))
|
||||
E.vehicle_entered_target = src
|
||||
|
||||
/obj/vehicle/sealed/MouseDrop_T(atom/dropping, mob/M)
|
||||
if(!istype(dropping) || !istype(M))
|
||||
return ..()
|
||||
if(M == dropping)
|
||||
mob_try_enter(M)
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/sealed/proc/mob_try_enter(mob/M)
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
if(occupant_amount() >= max_occupants)
|
||||
return FALSE
|
||||
if(do_after(M, get_enter_delay(M), FALSE, src, TRUE))
|
||||
mob_enter(M)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/vehicle/sealed/proc/get_enter_delay(mob/M)
|
||||
return enter_delay
|
||||
|
||||
/obj/vehicle/sealed/proc/mob_enter(mob/M, silent = FALSE)
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
if(!silent)
|
||||
M.visible_message("<span class='boldnotice'>[M] climbs into \the [src]!</span>")
|
||||
M.forceMove(src)
|
||||
add_occupant(M)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/sealed/proc/mob_try_exit(mob/M, mob/user, silent = FALSE)
|
||||
mob_exit(M, silent)
|
||||
|
||||
/obj/vehicle/sealed/proc/mob_exit(mob/M, silent = FALSE)
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
remove_occupant(M)
|
||||
M.forceMove(exit_location(M))
|
||||
if(!silent)
|
||||
M.visible_message("<span class='boldnotice'>[M] drops out of \the [src]!</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/sealed/proc/exit_location(M)
|
||||
return drop_location()
|
||||
@@ -1,33 +1,24 @@
|
||||
//PIMP-CART
|
||||
/obj/vehicle/janicart
|
||||
/obj/vehicle/ridden/janicart
|
||||
name = "janicart (pimpin' ride)"
|
||||
desc = "A brave janitor cyborg gave its life to produce such an amazing combination of speed and utility."
|
||||
icon_state = "pussywagon"
|
||||
|
||||
key_type = /obj/item/key/janitor
|
||||
var/obj/item/storage/bag/trash/mybag = null
|
||||
var/floorbuffer = FALSE
|
||||
|
||||
/obj/vehicle/janicart/Initialize(mapload)
|
||||
/obj/vehicle/ridden/janicart/Initialize(mapload)
|
||||
. = ..()
|
||||
update_icon()
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 7), TEXT_EAST = list(-12, 7), TEXT_WEST = list( 12, 7)))
|
||||
|
||||
/obj/vehicle/janicart/Destroy()
|
||||
/obj/vehicle/ridden/janicart/Destroy()
|
||||
if(mybag)
|
||||
qdel(mybag)
|
||||
mybag = null
|
||||
. = ..()
|
||||
|
||||
/obj/vehicle/janicart/buckle_mob(mob/living/buckled_mob, force = 0, check_loc = 0)
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/janicart
|
||||
|
||||
|
||||
|
||||
/obj/item/key/janitor
|
||||
desc = "A keyring with a small steel key, and a pink fob reading \"Pussy Wagon\"."
|
||||
icon_state = "keyjanitor"
|
||||
|
||||
|
||||
/obj/item/janiupgrade
|
||||
name = "floor buffer upgrade"
|
||||
desc = "An upgrade for mobile janicarts."
|
||||
@@ -35,14 +26,12 @@
|
||||
icon_state = "upgrade"
|
||||
origin_tech = "materials=3;engineering=4"
|
||||
|
||||
|
||||
/obj/vehicle/janicart/examine(mob/user)
|
||||
/obj/vehicle/ridden/janicart/examine(mob/user)
|
||||
..()
|
||||
if(floorbuffer)
|
||||
to_chat(user, "It has been upgraded with a floor buffer.")
|
||||
|
||||
|
||||
/obj/vehicle/janicart/attackby(obj/item/I, mob/user, params)
|
||||
/obj/vehicle/ridden/janicart/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/storage/bag/trash))
|
||||
if(mybag)
|
||||
to_chat(user, "<span class='warning'>[src] already has a trashbag hooked!</span>")
|
||||
@@ -64,16 +53,14 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/vehicle/janicart/update_icon()
|
||||
/obj/vehicle/ridden/janicart/update_icon()
|
||||
cut_overlays()
|
||||
if(mybag)
|
||||
add_overlay("cart_garbage")
|
||||
if(floorbuffer)
|
||||
add_overlay("cart_buffer")
|
||||
|
||||
|
||||
/obj/vehicle/janicart/attack_hand(mob/user)
|
||||
/obj/vehicle/ridden/janicart/attack_hand(mob/user)
|
||||
if(..())
|
||||
return 1
|
||||
else if(mybag)
|
||||
@@ -82,5 +69,5 @@
|
||||
mybag = null
|
||||
update_icon()
|
||||
|
||||
/obj/vehicle/janicart/upgraded
|
||||
/obj/vehicle/ridden/janicart/upgraded
|
||||
floorbuffer = TRUE
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/obj/vehicle/ridden
|
||||
name = "ridden vehicle"
|
||||
can_buckle = TRUE
|
||||
max_buckled_mobs = 1
|
||||
buckle_lying = FALSE
|
||||
default_driver_move = FALSE
|
||||
var/legs_required = 2
|
||||
var/arms_requires = 0 //why not?
|
||||
|
||||
/obj/vehicle/ridden/Initialize()
|
||||
. = ..()
|
||||
LoadComponent(/datum/component/riding)
|
||||
|
||||
/obj/vehicle/ridden/examine(mob/user)
|
||||
. = ..()
|
||||
to_chat(user, "<span class='notice'>Put a key inside it by clicking it with the key. If there's a key inside, you can remove it via Alt-Click!</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))
|
||||
if(user.transferItemToLoc(I, src))
|
||||
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
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[I] seems to be stuck to your hand!</span>")
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/ridden/AltClick(mob/user)
|
||||
if(user.Adjacent(src) && inserted_key)
|
||||
if(!is_occupant(user))
|
||||
to_chat(user, "<span class='notice'>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
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/ridden/driver_move(mob/user, direction)
|
||||
if(key_type && !is_key(inserted_key))
|
||||
to_chat(user, "<span class='warning'>[src] has no key inserted!</span>")
|
||||
return FALSE
|
||||
var/datum/component/riding/R = GetComponent(/datum/component/riding)
|
||||
R.handle_ride(user, direction)
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/ridden/user_buckle_mob(mob/living/M, mob/user, check_loc = TRUE)
|
||||
if(user.incapacitated())
|
||||
return
|
||||
for(var/atom/movable/A in get_turf(src))
|
||||
if(A.density)
|
||||
if(A != src && A != M)
|
||||
return
|
||||
M.forceMove(get_turf(src))
|
||||
. = ..()
|
||||
|
||||
/obj/vehicle/ridden/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
|
||||
if(!force && occupant_amount() >= max_occupants)
|
||||
return FALSE
|
||||
return ..()
|
||||
@@ -1,14 +1,20 @@
|
||||
/obj/vehicle/scooter
|
||||
/obj/vehicle/ridden/scooter
|
||||
name = "scooter"
|
||||
desc = "A fun way to get around."
|
||||
icon_state = "scooter"
|
||||
|
||||
/obj/vehicle/scooter/attackby(obj/item/I, mob/user, params)
|
||||
/obj/vehicle/ridden/scooter/Initialize()
|
||||
. = ..()
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0), TEXT_SOUTH = list(-2), TEXT_EAST = list(0), TEXT_WEST = list( 2)))
|
||||
|
||||
|
||||
/obj/vehicle/ridden/scooter/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/wrench))
|
||||
to_chat(user, "<span class='notice'>You begin to remove the handlebars...</span>")
|
||||
playsound(get_turf(user), 'sound/items/ratchet.ogg', 50, 1)
|
||||
if(do_after(user, 40*I.toolspeed, target = src))
|
||||
var/obj/vehicle/scooter/skateboard/S = new /obj/vehicle/scooter/skateboard(get_turf(src))
|
||||
var/obj/vehicle/ridden/scooter/skateboard/S = new(loc)
|
||||
new /obj/item/stack/rods(get_turf(src),2)
|
||||
to_chat(user, "<span class='notice'>You remove the handlebars from [src].</span>")
|
||||
if(has_buckled_mobs())
|
||||
@@ -17,9 +23,16 @@
|
||||
S.buckle_mob(H)
|
||||
qdel(src)
|
||||
|
||||
/obj/vehicle/ridden/scooter/Moved()
|
||||
. = ..()
|
||||
for(var/m in buckled_mobs)
|
||||
var/mob/living/buckled_mob = m
|
||||
if(buckled_mob.get_num_legs() > 0)
|
||||
buckled_mob.pixel_y = 5
|
||||
else
|
||||
buckled_mob.pixel_y = -4
|
||||
|
||||
/obj/vehicle/scooter/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
riding_datum = new/datum/riding/scooter
|
||||
/obj/vehicle/ridden/scooter/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
if(!istype(M))
|
||||
return 0
|
||||
if(M.get_num_legs() < 2 && M.get_num_arms() <= 0)
|
||||
@@ -27,29 +40,32 @@
|
||||
return 0
|
||||
. = ..()
|
||||
|
||||
/obj/vehicle/scooter/post_buckle_mob(mob/living/M)
|
||||
riding_datum.account_limbs(M)
|
||||
|
||||
/obj/vehicle/scooter/skateboard
|
||||
/obj/vehicle/ridden/scooter/skateboard
|
||||
name = "skateboard"
|
||||
desc = "An unfinished scooter which can only barely be called a skateboard. It's still rideable, but probably unsafe. Looks like you'll need to add a few rods to make handlebars."
|
||||
icon_state = "skateboard"
|
||||
|
||||
density = FALSE
|
||||
|
||||
/obj/vehicle/scooter/skateboard/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
/obj/vehicle/ridden/scooter/skateboard/Initialize()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/scooter/skateboard
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.vehicle_move_delay = 0
|
||||
D.set_vehicle_dir_layer(SOUTH, ABOVE_MOB_LAYER)
|
||||
D.set_vehicle_dir_layer(NORTH, OBJ_LAYER)
|
||||
D.set_vehicle_dir_layer(EAST, OBJ_LAYER)
|
||||
D.set_vehicle_dir_layer(WEST, OBJ_LAYER)
|
||||
|
||||
/obj/vehicle/scooter/skateboard/post_buckle_mob(mob/living/M)//allows skateboards to be non-dense but still allows 2 skateboarders to collide with each other
|
||||
if(has_buckled_mobs())
|
||||
density = TRUE
|
||||
else
|
||||
/obj/vehicle/ridden/scooter/skateboard/post_buckle_mob(mob/living/M)//allows skateboards to be non-dense but still allows 2 skateboarders to collide with each other
|
||||
density = TRUE
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/ridden/scooter/skateboard/post_unbuckle_mob(mob/living/M)
|
||||
if(!has_buckled_mobs())
|
||||
density = FALSE
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/scooter/skateboard/Collide(atom/A)
|
||||
..()
|
||||
/obj/vehicle/ridden/scooter/skateboard/Collide(atom/A)
|
||||
. = ..()
|
||||
if(A.density && has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
var/atom/throw_target = get_edge_target_turf(H, pick(GLOB.cardinals))
|
||||
@@ -63,7 +79,7 @@
|
||||
visible_message("<span class='danger'>[src] crashes into [A], sending [H] flying!</span>")
|
||||
playsound(src, 'sound/effects/bang.ogg', 50, 1)
|
||||
|
||||
/obj/vehicle/scooter/skateboard/MouseDrop(atom/over_object)
|
||||
/obj/vehicle/ridden/scooter/skateboard/MouseDrop(atom/over_object)
|
||||
var/mob/living/carbon/M = usr
|
||||
if(!istype(M) || M.incapacitated() || !Adjacent(M))
|
||||
return
|
||||
@@ -102,10 +118,10 @@
|
||||
return
|
||||
M.use(5)
|
||||
to_chat(user, "<span class='notice'>You finish making wheels for [src].</span>")
|
||||
new /obj/vehicle/scooter/skateboard(user.loc)
|
||||
new /obj/vehicle/ridden/scooter/skateboard(user.loc)
|
||||
qdel(src)
|
||||
|
||||
/obj/vehicle/scooter/skateboard/attackby(obj/item/I, mob/user, params)
|
||||
/obj/vehicle/ridden/scooter/skateboard/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
to_chat(user, "<span class='notice'>You begin to deconstruct and remove the wheels on [src]...</span>")
|
||||
playsound(get_turf(user), I.usesound, 50, 1)
|
||||
@@ -129,7 +145,7 @@
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You add the rods to [src], creating handlebars.</span>")
|
||||
C.use(2)
|
||||
var/obj/vehicle/scooter/S = new/obj/vehicle/scooter(get_turf(src))
|
||||
var/obj/vehicle/ridden/scooter/S = new(loc)
|
||||
if(has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
unbuckle_mob(H)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
|
||||
/obj/vehicle/secway
|
||||
/obj/vehicle/ridden/secway
|
||||
name = "secway"
|
||||
desc = "A brave security cyborg gave its life to help you look like a complete tool."
|
||||
icon_state = "secway"
|
||||
key_type = /obj/item/key/security
|
||||
|
||||
/obj/item/key/security
|
||||
desc = "A keyring with a small steel key, and a rubber stun baton accessory."
|
||||
icon_state = "keysec"
|
||||
|
||||
/obj/vehicle/secway/buckle_mob(mob/living/buckled_mob, force = 0, check_loc = 1)
|
||||
/obj/vehicle/ridden/secway/Initialize()
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/secway
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.vehicle_move_delay = 1
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(0, 4), TEXT_WEST = list( 0, 4)))
|
||||
|
||||
@@ -1,44 +1,72 @@
|
||||
/obj/vehicle/space/speedbike
|
||||
|
||||
/obj/vehicle/ridden/space
|
||||
name = "Generic Space Vehicle!"
|
||||
|
||||
/obj/vehicle/ridden/space/Initialize()
|
||||
. = ..()
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.override_allow_spacemove = TRUE
|
||||
|
||||
/obj/vehicle/ridden/space/speedbike
|
||||
name = "Speedbike"
|
||||
icon = 'icons/obj/bike.dmi'
|
||||
icon_state = "speedbike_blue"
|
||||
layer = LYING_MOB_LAYER
|
||||
var/overlay_state = "cover_blue"
|
||||
var/static/mutable_appearance/overlay
|
||||
|
||||
/obj/vehicle/space/speedbike/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/space/speedbike
|
||||
var/mutable_appearance/overlay
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/vehicle/space/speedbike/New()
|
||||
=======
|
||||
/obj/vehicle/ridden/space/speedbike/Initialize()
|
||||
>>>>>>> 5182128... refactors riding datums to a component, vehicle refactor staging for mech overhaul (#32249)
|
||||
. = ..()
|
||||
overlay = overlay || mutable_appearance(icon, overlay_state, ABOVE_MOB_LAYER)
|
||||
overlay = mutable_appearance(icon, overlay_state, ABOVE_MOB_LAYER)
|
||||
add_overlay(overlay)
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, -8), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(-10, 5), TEXT_WEST = list( 10, 5)))
|
||||
D.vehicle_move_delay = 0
|
||||
D.set_vehicle_dir_offsets(NORTH, -16, -16)
|
||||
D.set_vehicle_dir_offsets(SOUTH, -16, -16)
|
||||
D.set_vehicle_dir_offsets(EAST, -18, 0)
|
||||
D.set_vehicle_dir_offsets(WEST, -18, 0)
|
||||
|
||||
/obj/vehicle/space/speedbike/Move(newloc,move_dir)
|
||||
/obj/vehicle/ridden/space/speedbike/Move(newloc,move_dir)
|
||||
if(has_buckled_mobs())
|
||||
new /obj/effect/temp_visual/dir_setting/speedbike_trail(loc,move_dir)
|
||||
. = ..()
|
||||
|
||||
/obj/vehicle/space/speedbike/red
|
||||
/obj/vehicle/ridden/space/speedbike/red
|
||||
icon_state = "speedbike_red"
|
||||
overlay_state = "cover_red"
|
||||
|
||||
//BM SPEEDWAGON
|
||||
|
||||
/obj/vehicle/space/speedbike/speedwagon
|
||||
/obj/vehicle/ridden/space/speedwagon
|
||||
name = "BM Speedwagon"
|
||||
desc = "Push it to the limit, walk along the razor's edge."
|
||||
icon = 'icons/obj/car.dmi'
|
||||
icon_state = "speedwagon"
|
||||
layer = LYING_MOB_LAYER
|
||||
overlay_state = "speedwagon_cover"
|
||||
var/static/mutable_appearance/overlay = mutable_appearance(icon, "speedwagon_cover", ABOVE_MOB_LAYER)
|
||||
max_buckled_mobs = 4
|
||||
var/crash_all = FALSE //CHAOS
|
||||
pixel_y = -48 //to fix the offset when Initialized()
|
||||
pixel_x = -48
|
||||
|
||||
/obj/vehicle/space/speedbike/speedwagon/Collide(atom/movable/A)
|
||||
/obj/vehicle/ridden/space/speedwagon/Initialize()
|
||||
. = ..()
|
||||
add_overlay(overlay)
|
||||
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
|
||||
D.vehicle_move_delay = 0
|
||||
D.set_riding_offsets(1, list(TEXT_NORTH = list(-10, -4), TEXT_SOUTH = list(16, 3), TEXT_EAST = list(-4, 30), TEXT_WEST = list(4, -3)))
|
||||
D.set_riding_offsets(2, list(TEXT_NORTH = list(19, -5, 4), TEXT_SOUTH = list(-13, 3, 4), TEXT_EAST = list(-4, -3, 4.1), TEXT_WEST = list(4, 28, 3.9)))
|
||||
D.set_riding_offsets(3, list(TEXT_NORTH = list(-10, -18, 4.2), TEXT_SOUTH = list(16, 25, 3.9), TEXT_EAST = list(-22, 30), TEXT_WEST = list(22, -3, 4.1)))
|
||||
D.set_riding_offsets(4, list(TEXT_NORTH = list(19, -18, 4.2), TEXT_SOUTH = list(-13, 25, 3.9), TEXT_EAST = list(-22, 3, 3.9), TEXT_WEST = list(22, 28)))
|
||||
for(var/i in GLOB.cardinals)
|
||||
D.set_vehicle_dir_layer(i, BELOW_MOB_LAYER)
|
||||
|
||||
/obj/vehicle/ridden/space/speedwagon/Collide(atom/movable/A)
|
||||
. = ..()
|
||||
if(A.density && has_buckled_mobs())
|
||||
var/atom/throw_target = get_edge_target_turf(A, dir)
|
||||
@@ -56,11 +84,7 @@
|
||||
visible_message("<span class='danger'>[src] crashes into [H]!</span>")
|
||||
playsound(src, 'sound/effects/bang.ogg', 50, 1)
|
||||
|
||||
/obj/vehicle/space/speedbike/speedwagon/buckle_mob(mob/living/M, force = 0, check_loc = 1)
|
||||
. = ..()
|
||||
riding_datum = new/datum/riding/space/speedwagon
|
||||
|
||||
/obj/vehicle/space/speedbike/speedwagon/Moved()
|
||||
/obj/vehicle/ridden/space/speedwagon/Moved()
|
||||
. = ..()
|
||||
if(has_buckled_mobs())
|
||||
for(var/atom/A in range(2, src))
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
|
||||
/obj/vehicle
|
||||
name = "vehicle"
|
||||
desc = "A basic vehicle, vroom."
|
||||
icon = 'icons/obj/vehicles.dmi'
|
||||
icon_state = "fuckyou"
|
||||
density = TRUE
|
||||
anchored = FALSE
|
||||
can_buckle = 1
|
||||
buckle_lying = 0
|
||||
max_integrity = 300
|
||||
armor = list(melee = 30, bullet = 30, laser = 30, energy = 0, bomb = 30, bio = 0, rad = 0, fire = 60, acid = 60)
|
||||
var/auto_door_open = TRUE
|
||||
var/view_range = 7
|
||||
var/datum/riding/riding_datum = null
|
||||
|
||||
/obj/vehicle/Destroy()
|
||||
QDEL_NULL(riding_datum)
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/update_icon()
|
||||
return
|
||||
|
||||
/obj/item/key
|
||||
name = "key"
|
||||
desc = "A small grey key."
|
||||
icon = 'icons/obj/vehicles.dmi'
|
||||
icon_state = "key"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
|
||||
//BUCKLE HOOKS
|
||||
/obj/vehicle/unbuckle_mob(mob/living/buckled_mob,force = 0)
|
||||
if(riding_datum)
|
||||
riding_datum.restore_position(buckled_mob)
|
||||
. = ..()
|
||||
|
||||
|
||||
/obj/vehicle/user_buckle_mob(mob/living/M, mob/living/user)
|
||||
if(!istype(user) || user.incapacitated())
|
||||
return
|
||||
for(var/atom/movable/A in get_turf(src))
|
||||
if(A.density)
|
||||
if(A != src && A != M)
|
||||
return
|
||||
M.forceMove(get_turf(src))
|
||||
..()
|
||||
if(user.client)
|
||||
user.client.change_view(view_range)
|
||||
if(riding_datum)
|
||||
riding_datum.ridden = src
|
||||
riding_datum.handle_vehicle_offsets()
|
||||
|
||||
//MOVEMENT
|
||||
/obj/vehicle/relaymove(mob/user, direction)
|
||||
if(riding_datum)
|
||||
riding_datum.handle_ride(user, direction)
|
||||
|
||||
|
||||
/obj/vehicle/Moved()
|
||||
. = ..()
|
||||
if(riding_datum)
|
||||
riding_datum.handle_vehicle_layer()
|
||||
riding_datum.handle_vehicle_offsets()
|
||||
|
||||
|
||||
/obj/vehicle/Collide(atom/movable/M)
|
||||
. = ..()
|
||||
if(auto_door_open)
|
||||
if(istype(M, /obj/machinery/door) && has_buckled_mobs())
|
||||
for(var/m in buckled_mobs)
|
||||
M.CollidedWith(m)
|
||||
|
||||
|
||||
/obj/vehicle/Process_Spacemove(direction)
|
||||
if(has_gravity())
|
||||
return 1
|
||||
|
||||
if(pulledby && (pulledby.loc != loc))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/obj/vehicle/space
|
||||
pressure_resistance = INFINITY
|
||||
|
||||
|
||||
/obj/vehicle/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
|
||||
if(damage_flag == "melee" && damage_amount < 20)
|
||||
return 0
|
||||
. = ..()
|
||||
|
||||
/obj/vehicle/deconstruct(disassembled = TRUE)
|
||||
new /obj/item/stack/sheet/metal (loc, 5)
|
||||
qdel(src)
|
||||
|
||||
/obj/vehicle/examine(mob/user)
|
||||
..()
|
||||
if(!(resistance_flags & INDESTRUCTIBLE))
|
||||
if(resistance_flags & ON_FIRE)
|
||||
to_chat(user, "<span class='warning'>It's on fire!</span>")
|
||||
var/healthpercent = (obj_integrity/max_integrity) * 100
|
||||
switch(healthpercent)
|
||||
if(50 to 99)
|
||||
to_chat(user, "It looks slightly damaged.")
|
||||
if(25 to 50)
|
||||
to_chat(user, "It appears heavily damaged.")
|
||||
if(0 to 25)
|
||||
to_chat(user, "<span class='warning'>It's falling apart!</span>")
|
||||
@@ -0,0 +1,112 @@
|
||||
//VEHICLE DEFAULT HANDLING
|
||||
/obj/vehicle/proc/generate_actions()
|
||||
return
|
||||
|
||||
/obj/vehicle/proc/generate_action_type(actiontype)
|
||||
var/datum/action/vehicle/A = new actiontype
|
||||
if(!istype(A))
|
||||
return
|
||||
A.vehicle_target = src
|
||||
return A
|
||||
|
||||
/obj/vehicle/proc/initialize_passenger_action_type(actiontype)
|
||||
autogrant_actions_passenger += actiontype
|
||||
for(var/i in occupants)
|
||||
grant_passenger_actions(i) //refresh
|
||||
|
||||
/obj/vehicle/proc/initialize_controller_action_type(actiontype, control_flag)
|
||||
LAZYINITLIST(autogrant_actions_controller["[control_flag]"])
|
||||
autogrant_actions_controller["[control_flag]"] += actiontype
|
||||
for(var/i in occupants)
|
||||
grant_controller_actions(i) //refresh
|
||||
|
||||
/obj/vehicle/proc/grant_action_type_to_mob(actiontype, mob/m)
|
||||
if(!occupants[m] || !actiontype)
|
||||
return FALSE
|
||||
LAZYINITLIST(occupant_actions[m])
|
||||
if(occupant_actions[m][actiontype])
|
||||
return TRUE
|
||||
var/datum/action/action = generate_action_type(actiontype)
|
||||
action.Grant(m)
|
||||
occupant_actions[m][action.type] = action
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/remove_action_type_from_mob(actiontype, mob/m)
|
||||
if(!occupants[m] || !actiontype)
|
||||
return FALSE
|
||||
LAZYINITLIST(occupant_actions[m])
|
||||
if(occupant_actions[m][actiontype])
|
||||
var/datum/action/action = occupant_actions[m][actiontype]
|
||||
action.Remove(m)
|
||||
occupant_actions[m] -= actiontype
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/grant_passenger_actions(mob/M)
|
||||
for(var/v in autogrant_actions_passenger)
|
||||
grant_action_type_to_mob(v, M)
|
||||
|
||||
/obj/vehicle/proc/remove_passenger_actions(mob/M)
|
||||
for(var/v in autogrant_actions_passenger)
|
||||
remove_action_type_from_mob(v, M)
|
||||
|
||||
/obj/vehicle/proc/grant_controller_actions(mob/M)
|
||||
if(!istype(M) || !occupants[M])
|
||||
return FALSE
|
||||
for(var/i in GLOB.bitflags)
|
||||
if(occupants[M] & i)
|
||||
grant_controller_actions_by_flag(M, i)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/remove_controller_actions(mob/M)
|
||||
if(!istype(M) || !occupants[M])
|
||||
return FALSE
|
||||
for(var/i in GLOB.bitflags)
|
||||
remove_controller_actions_by_flag(M, i)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/grant_controller_actions_by_flag(mob/M, flag)
|
||||
if(!istype(M) || !autogrant_actions_controller["[flag]"])
|
||||
return FALSE
|
||||
for(var/v in autogrant_actions_controller["[flag]"])
|
||||
grant_action_type_to_mob(v, M)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/remove_controller_actions_by_flag(mob/M, flag)
|
||||
if(!istype(M) || autogrant_actions_controller["[flag]"])
|
||||
return FALSE
|
||||
for(var/v in autogrant_actions_controller["[flag]"])
|
||||
remove_action_type_from_mob(v, M)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/proc/cleanup_actions_for_mob(mob/M)
|
||||
if(!istype(M))
|
||||
return FALSE
|
||||
LAZYINITLIST(occupant_actions[M])
|
||||
for(var/path in occupant_actions[M])
|
||||
stack_trace("Leftover action type [path] in vehicle type [type] for mob type [M.type] - THIS SHOULD NOT BE HAPPENING!")
|
||||
var/datum/action/action = occupant_actions[M]
|
||||
action.Remove(M)
|
||||
occupant_actions -= M
|
||||
return TRUE
|
||||
|
||||
//ACTION DATUMS
|
||||
|
||||
/datum/action/vehicle
|
||||
check_flags = AB_CHECK_RESTRAINED | AB_CHECK_STUN | AB_CHECK_CONSCIOUS
|
||||
icon_icon = 'icons/mob/actions/actions_vehicle.dmi'
|
||||
button_icon_state = "vehicle_eject"
|
||||
var/obj/vehicle/vehicle_target
|
||||
|
||||
/datum/action/vehicle/sealed
|
||||
var/obj/vehicle/sealed/vehicle_entered_target
|
||||
|
||||
/datum/action/vehicle/sealed/climb_out
|
||||
name = "Climb Out"
|
||||
desc = "Climb out of your vehicle!"
|
||||
|
||||
/datum/action/vehicle/sealed/climb_out/Trigger()
|
||||
if(..() && istype(vehicle_entered_target))
|
||||
vehicle_entered_target.mob_try_exit(owner, owner)
|
||||
|
||||
/datum/action/vehicle/ridden
|
||||
var/obj/vehicle/ridden/vehicle_ridden_target
|
||||
@@ -0,0 +1,15 @@
|
||||
/obj/item/key
|
||||
name = "key"
|
||||
desc = "A small grey key."
|
||||
icon = 'icons/obj/vehicles.dmi'
|
||||
icon_state = "key"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
|
||||
/obj/item/key/security
|
||||
desc = "A keyring with a small steel key, and a rubber stun baton accessory."
|
||||
icon_state = "keysec"
|
||||
|
||||
/obj/item/key/janitor
|
||||
desc = "A keyring with a small steel key, and a pink fob reading \"Pussy Wagon\"."
|
||||
icon_state = "keyjanitor"
|
||||
|
||||
Reference in New Issue
Block a user