mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] Allows you to use the ability of vatbeasts when riding them (#714)
* Allows you to use the ability of vatbeasts when riding them (#53266) * Allows you to use the ability of vatbeasts when riding them Co-authored-by: Qustinnus <Floydje123@hotmail.com>
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
var/slowed = FALSE
|
||||
var/slowvalue = 1
|
||||
|
||||
///Bool to check if you gain the ridden mob's abilities.
|
||||
var/can_use_abilities = FALSE
|
||||
|
||||
var/list/riding_offsets = list() //position_of_user = list(dir = list(px, py)), or RIDING_OFFSET_ALL for a generic one.
|
||||
var/list/directional_vehicle_layers = list() //["[DIRECTION]"] = layer. Don't set it for a direction for default, set a direction to null for no change.
|
||||
var/list/directional_vehicle_offsets = list() //same as above but instead of layer you have a list(px, py)
|
||||
@@ -37,6 +40,7 @@
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/atom/movable/AM = parent
|
||||
remove_abilities(M)
|
||||
restore_position(M)
|
||||
unequip_buckle_inhands(M)
|
||||
M.updating_glide_size = TRUE
|
||||
@@ -50,6 +54,32 @@
|
||||
M.set_glide_size(movable_parent.glide_size)
|
||||
M.updating_glide_size = FALSE
|
||||
handle_vehicle_offsets(movable_parent.dir)
|
||||
if(can_use_abilities)
|
||||
setup_abilities(M)
|
||||
|
||||
///Gives the rider the riding parent's abilities
|
||||
/datum/component/riding/proc/setup_abilities(mob/living/M)
|
||||
|
||||
if(!istype(parent, /mob/living))
|
||||
return
|
||||
|
||||
var/mob/living/ridden_creature = parent
|
||||
|
||||
for(var/i in ridden_creature.abilities)
|
||||
var/obj/effect/proc_holder/proc_holder = i
|
||||
M.AddAbility(proc_holder)
|
||||
|
||||
///Takes away the riding parent's abilities from the rider
|
||||
/datum/component/riding/proc/remove_abilities(mob/living/M)
|
||||
|
||||
if(!istype(parent, /mob/living))
|
||||
return
|
||||
|
||||
var/mob/living/ridden_creature = parent
|
||||
|
||||
for(var/i in ridden_creature.abilities)
|
||||
var/obj/effect/proc_holder/proc_holder = i
|
||||
M.RemoveAbility(proc_holder)
|
||||
|
||||
/datum/component/riding/proc/handle_vehicle_layer(dir)
|
||||
var/atom/movable/AM = parent
|
||||
|
||||
Reference in New Issue
Block a user