mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +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
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/vatbeast/Initialize()
|
||||
. = ..()
|
||||
tentacle_slap = new
|
||||
tentacle_slap = new(src)
|
||||
AddAbility(tentacle_slap)
|
||||
add_cell_sample()
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
can_buckle = TRUE
|
||||
buckle_lying = 0
|
||||
var/datum/component/riding/riding = LoadComponent(/datum/component/riding)
|
||||
riding.can_use_abilities = TRUE
|
||||
riding.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 15), TEXT_SOUTH = list(0, 15), TEXT_EAST = list(-10, 15), TEXT_WEST = list(10, 15)))
|
||||
riding.set_vehicle_dir_layer(SOUTH, ABOVE_MOB_LAYER)
|
||||
riding.set_vehicle_dir_layer(NORTH, OBJ_LAYER)
|
||||
@@ -85,7 +86,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
if(!istype(ranged_ability_user, /mob/living/simple_animal/hostile/vatbeast) || ranged_ability_user.stat)
|
||||
if(owner.stat)
|
||||
remove_ranged_ability()
|
||||
return
|
||||
|
||||
@@ -97,12 +98,10 @@
|
||||
|
||||
var/mob/living/living_target = target
|
||||
|
||||
var/mob/living/simple_animal/hostile/vatbeast/vatbeast = ranged_ability_user
|
||||
|
||||
vatbeast.visible_message("<span class='warning>[vatbeast] slaps [living_target] with its tentacle!</span>", "<span class='notice'>You slap [living_target] with your tentacle.</span>")
|
||||
playsound(vatbeast, 'sound/effects/assslap.ogg', 90)
|
||||
var/atom/throw_target = get_edge_target_turf(target, vatbeast.dir)
|
||||
living_target.throw_at(throw_target, 6, 4, vatbeast)
|
||||
owner.visible_message("<span class='warning>[owner] slaps [living_target] with its tentacle!</span>", "<span class='notice'>You slap [living_target] with your tentacle.</span>")
|
||||
playsound(owner, 'sound/effects/assslap.ogg', 90)
|
||||
var/atom/throw_target = get_edge_target_turf(target, ranged_ability_user.dir)
|
||||
living_target.throw_at(throw_target, 6, 4, owner)
|
||||
living_target.apply_damage(30)
|
||||
current_cooldown = world.time + cooldown
|
||||
remove_ranged_ability()
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
var/action_icon_state = "spell_default"
|
||||
var/action_background_icon_state = "bg_spell"
|
||||
var/base_action = /datum/action/spell_action
|
||||
var/mob/living/owner
|
||||
|
||||
/obj/effect/proc_holder/Initialize()
|
||||
/obj/effect/proc_holder/Initialize(mob/living/owner)
|
||||
. = ..()
|
||||
src.owner = owner
|
||||
if(has_action)
|
||||
action = new base_action(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user