From aaad036c7c5b3cf6db5a05d15b3d82c693c84624 Mon Sep 17 00:00:00 2001
From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Date: Mon, 1 Jul 2024 20:14:09 -0400
Subject: [PATCH] Only small and tiny simplemobs can go on skateboards, shoot
people off them [BALANCE PRE APPROVED] (#26091)
* Only small and tiny simplemobs can go on skateboards, shoot people off them
* Update code/datums/components/riding/riding_vehicle.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
---------
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---
code/__DEFINES/vehicle_defines.dm | 3 ++-
.../components/riding/riding_vehicle.dm | 20 ++++++++++++++++---
code/datums/elements/ridable.dm | 11 +++++++---
code/game/objects/buckling.dm | 3 ++-
4 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/code/__DEFINES/vehicle_defines.dm b/code/__DEFINES/vehicle_defines.dm
index 73a5fdabe02..4cd27e39aa6 100644
--- a/code/__DEFINES/vehicle_defines.dm
+++ b/code/__DEFINES/vehicle_defines.dm
@@ -24,7 +24,8 @@
#define RIDER_NEEDS_LEGS (1<<2)
/// If the rider is disabled or loses their needed limbs, do they fall off?
#define UNBUCKLE_DISABLED_RIDER (1<<3)
-
+/// Do we need a carbon, a silicon, or a small mob, to ride the vehicle?
+#define RIDER_CARBON_OR_SILICON_NO_LARGE_MOBS (1<<4)
/// The vehicle being ridden requires pixel offsets for all directions
#define RIDING_OFFSET_ALL "ALL"
diff --git a/code/datums/components/riding/riding_vehicle.dm b/code/datums/components/riding/riding_vehicle.dm
index d682f264e79..06e2cce0a24 100644
--- a/code/datums/components/riding/riding_vehicle.dm
+++ b/code/datums/components/riding/riding_vehicle.dm
@@ -95,7 +95,7 @@
/datum/component/riding/vehicle/scooter/skateboard
vehicle_move_delay = 1.5
- ride_check_flags = RIDER_NEEDS_LEGS | UNBUCKLE_DISABLED_RIDER
+ ride_check_flags = RIDER_NEEDS_LEGS | UNBUCKLE_DISABLED_RIDER | RIDER_CARBON_OR_SILICON_NO_LARGE_MOBS
///If TRUE, the vehicle will be slower (but safer) to ride on walk intent.
var/can_slow_down = TRUE
@@ -123,23 +123,37 @@
if(can_slow_down)
RegisterSignal(rider, COMSIG_MOVE_INTENT_TOGGLED, PROC_REF(toggle_move_delay))
toggle_move_delay(rider)
+ RegisterSignal(rider, COMSIG_ATOM_BULLET_ACT, PROC_REF(check_knockoff))
/datum/component/riding/vehicle/scooter/skateboard/handle_unbuckle(mob/living/rider)
. = ..()
if(can_slow_down)
toggle_move_delay(rider)
UnregisterSignal(rider, COMSIG_MOVE_INTENT_TOGGLED)
+ UnregisterSignal(rider, COMSIG_ATOM_BULLET_ACT)
/datum/component/riding/vehicle/scooter/skateboard/proc/toggle_move_delay(mob/living/rider)
- SIGNAL_HANDLER //COMSIG_MOVE_INTENT_TOGGLED
+ SIGNAL_HANDLER // COMSIG_MOVE_INTENT_TOGGLED
vehicle_move_delay = initial(vehicle_move_delay)
if(rider.m_intent == MOVE_INTENT_WALK)
vehicle_move_delay += 0.6
+/datum/component/riding/vehicle/scooter/skateboard/proc/check_knockoff(datum/source, obj/item/projectile)
+ SIGNAL_HANDLER // COMSIG_ATOM_BULLET_ACT
+ if(!istype(parent, /obj/tgvehicle/scooter/skateboard))
+ return
+ var/obj/tgvehicle/scooter/skateboard/S = parent
+ for(var/mob/living/L in S.return_occupants()) // Only one on a skateboard unless an admin var edits it. If an admin var edits it, that is on them.
+ if((L.staminaloss >= 60 || L.health <= 40) && !L.absorb_stun(0)) // Only injured people can be shot off. Hulks and people on stimulants can not be shot off.
+ S.unbuckle_mob(L)
+ L.KnockDown(2 SECONDS)
+ L.visible_message("[L] gets shot off [S] by [projectile]!",
+ "You get shot off [S] by [projectile]!")
+
/datum/component/riding/vehicle/scooter/skateboard/pro
vehicle_move_delay = 1
-///This one lets the rider ignore gravity, move in zero g and son on, but only on ground turfs or at most one z-level above them.
+/// This one lets the rider ignore gravity, move in zero g and so on, but only on ground turfs or at most one z-level above them.
/datum/component/riding/vehicle/scooter/skateboard/hover
vehicle_move_delay = 1
override_allow_spacemove = TRUE
diff --git a/code/datums/elements/ridable.dm b/code/datums/elements/ridable.dm
index 956d6c60ff0..9844c1d2258 100644
--- a/code/datums/elements/ridable.dm
+++ b/code/datums/elements/ridable.dm
@@ -39,11 +39,12 @@
return ..()
/// Someone is buckling to this movable, which is literally the only thing we care about (other than speed potions)
-/datum/element/ridable/proc/check_mounting(atom/movable/target_movable, mob/living/potential_rider, force = FALSE, ride_check_flags = NONE)
+/datum/element/ridable/proc/check_mounting(atom/movable/target_movable, mob/living/potential_rider, force = FALSE)
SIGNAL_HANDLER //COMSIG_MOVABLE_PREBUCKLE
- INVOKE_ASYNC(src, PROC_REF(check_mounting_async_edition), target_movable, potential_rider, force, ride_check_flags)
+ var/datum/component/riding/R = riding_component_type
+ return check_mounting_part_two(target_movable, potential_rider, force, R.ride_check_flags)
-/datum/element/ridable/proc/check_mounting_async_edition(atom/movable/target_movable, mob/living/potential_rider, force = FALSE, ride_check_flags = NONE)
+/datum/element/ridable/proc/check_mounting_part_two(atom/movable/target_movable, mob/living/potential_rider, force = FALSE, ride_check_flags = NONE)
var/arms_needed = 0
if(ride_check_flags & RIDER_NEEDS_ARMS)
arms_needed = 2
@@ -60,6 +61,10 @@
potential_rider.visible_message("[potential_rider] can't get [potential_rider.p_their()] footing on [target_movable]!",
"You can't get your footing on [target_movable]!")
return COMPONENT_BLOCK_BUCKLE
+ if((ride_check_flags & RIDER_CARBON_OR_SILICON_NO_LARGE_MOBS) && !(iscarbon(potential_rider) || issilicon(potential_rider) || potential_rider.mob_size <= MOB_SIZE_SMALL))
+ potential_rider.visible_message("[potential_rider] is too big to get [potential_rider.p_their()] footing on [target_movable]!",
+ "You are too big to get your footing on [target_movable]!")
+ return COMPONENT_BLOCK_BUCKLE
var/mob/living/target_living = target_movable
diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm
index 69839ada462..ac9c02cd97b 100644
--- a/code/game/objects/buckling.dm
+++ b/code/game/objects/buckling.dm
@@ -52,7 +52,8 @@
// 1. This movable doesn't have a ridable element and can't be ridden, so nothing gets returned, so continue on
// 2. There's a ridable element but we failed to mount it for whatever reason (maybe it has no seats left, for example), so we cancel the buckling
// 3. There's a ridable element and we were successfully able to mount, so keep it going and continue on with buckling
- if(SEND_SIGNAL(src, COMSIG_MOVABLE_PREBUCKLE, M, force) & COMPONENT_BLOCK_BUCKLE)
+ var/signal_result = SEND_SIGNAL(src, COMSIG_MOVABLE_PREBUCKLE, M, force)
+ if(signal_result & COMPONENT_BLOCK_BUCKLE)
return FALSE
M.buckling = src