Skip to content

Commit

Permalink
[MIRROR] [no gbp] fixes not being able to walk over mook corpses and …
Browse files Browse the repository at this point in the history
…turns it all to a element [MDB IGNORE] (#24497) (#214)

* [no gbp] fixes not being able to walk over mook corpses and turns it all to a element (#79054)

## About The Pull Request
fixes not being able to move over or pull mook corpses and now mobs
changing their forces on death is a element

## Why It's Good For The Game
fixes not being able to move over or pull mook corpses

## Changelog
:cl:
fix: fixes not being able to walk over or pull mook corpses
/:cl:

* [no gbp] fixes not being able to walk over mook corpses and turns it all to a element

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: Ben10Omintrix <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2023
1 parent bdc32c0 commit 55b1d0a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 41 deletions.
49 changes: 49 additions & 0 deletions code/datums/elements/move_force_on_death.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Element to change a mob's move forces on death and reset them on living
*/
/datum/element/change_force_on_death
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
///Our move force
var/move_force
/// our resist move force
var/move_resist
/// how much we resist pulling
var/pull_force

/datum/element/change_force_on_death/Attach(datum/target, move_force, move_resist, pull_force)
. = ..()

if(!isliving(target))
return ELEMENT_INCOMPATIBLE

RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(on_death))
RegisterSignal(target, COMSIG_LIVING_REVIVE, PROC_REF(on_revive))

if(!isnull(move_force))
src.move_force = move_force
if(!isnull(move_resist))
src.move_resist = move_resist
if(!isnull(pull_force))
src.pull_force = pull_force

/datum/element/change_force_on_death/Detach(datum/target)
. = ..()
UnregisterSignal(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_REVIVE))

/datum/element/change_force_on_death/proc/on_death(mob/living/source)
SIGNAL_HANDLER

if(!isnull(move_force))
source.move_force = move_force
if(!isnull(move_resist))
source.move_resist = move_resist
if(!isnull(pull_force))
source.pull_force = pull_force

/datum/element/change_force_on_death/proc/on_revive(mob/living/source)
SIGNAL_HANDLER

source.move_force = initial(source.move_force)
source.move_resist = initial(source.move_resist)
source.pull_force = initial(source.pull_force)
21 changes: 7 additions & 14 deletions code/modules/mob/living/basic/lavaland/goliath/goliath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
AddElement(/datum/element/ai_retaliate)
AddElement(/datum/element/footstep, FOOTSTEP_MOB_HEAVY)
AddElement(/datum/element/basic_eating, heal_amt = 10, food_types = goliath_foods)
AddElement(\
/datum/element/change_force_on_death,\
move_force = MOVE_FORCE_DEFAULT,\
move_resist = MOVE_RESIST_DEFAULT,\
pull_force = PULL_FORCE_DEFAULT,\
)

AddComponent(/datum/component/ai_target_timer)
AddComponent(/datum/component/basic_mob_attack_telegraph)
AddComponentFrom(INNATE_TRAIT, /datum/component/shovel_hands)
Expand Down Expand Up @@ -92,20 +99,6 @@
if (saddled)
. += span_info("Someone appears to have attached a saddle to this one.")

/mob/living/basic/mining/goliath/revive(full_heal_flags, excess_healing, force_grab_ghost)
. = ..()
if (!.)
return
move_force = initial(move_force)
move_resist = initial(move_resist)
pull_force = initial(pull_force)

/mob/living/basic/mining/goliath/death(gibbed)
move_force = MOVE_FORCE_DEFAULT
move_resist = MOVE_RESIST_DEFAULT
pull_force = PULL_FORCE_DEFAULT
return ..()

// Goliaths can summon tentacles more frequently as they take damage, scary.
/mob/living/basic/mining/goliath/apply_damage(damage, damagetype, def_zone, blocked, forced, spread_damage, wound_bonus, bare_wound_bonus, sharpness, attack_direction, attacking_item)
. = ..()
Expand Down
11 changes: 8 additions & 3 deletions code/modules/mob/living/basic/lavaland/mook/mook.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
maxHealth = 150
faction = list(FACTION_MINING, FACTION_NEUTRAL)
health = 150
move_resist = MOVE_FORCE_OVERPOWERING
move_resist = MOVE_FORCE_VERY_STRONG
melee_damage_lower = 8
melee_damage_upper = 8
pass_flags_self = LETPASSTHROW
attack_sound = 'sound/weapons/rapierhit.ogg'
attack_vis_effect = ATTACK_EFFECT_SLASH
death_sound = 'sound/voice/mook_death.ogg'
ai_controller = /datum/ai_controller/basic_controller/mook/support
speed = 5

pixel_x = -16
base_pixel_x = -16
pixel_y = -16
Expand Down Expand Up @@ -49,6 +47,10 @@

/mob/living/basic/mining/mook/Initialize(mapload)
. = ..()
AddElement(\
/datum/element/change_force_on_death,\
move_resist = MOVE_RESIST_DEFAULT,\
)
AddComponent(/datum/component/ai_retaliate_advanced, CALLBACK(src, PROC_REF(attack_intruder)))
var/datum/action/cooldown/mob_cooldown/mook_ability/mook_jump/jump = new(src)
jump.Grant(src)
Expand Down Expand Up @@ -154,6 +156,9 @@
/mob/living/basic/mining/mook/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()

if(.)
return TRUE

if(!istype(mover, /mob/living/basic/mining/mook))
return FALSE

Expand Down
11 changes: 1 addition & 10 deletions code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
RegisterSignal(src, COMSIG_MOB_ABILITY_FINISHED, PROC_REF(finished_attack))
RegisterSignal(src, COMSIG_SWOOP_INVULNERABILITY_STARTED, PROC_REF(swoop_invulnerability_started))
RegisterSignal(src, COMSIG_LAVA_ARENA_FAILED, PROC_REF(on_arena_fail))
AddElement(/datum/element/change_force_on_death, move_force = MOVE_FORCE_DEFAULT)

/mob/living/simple_animal/hostile/megafauna/dragon/Destroy()
QDEL_NULL(fire_cone)
Expand All @@ -100,16 +101,6 @@
QDEL_NULL(lava_swoop)
return ..()

/mob/living/simple_animal/hostile/megafauna/dragon/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
. = ..()
if(!.)
return
pull_force = MOVE_FORCE_OVERPOWERING

/mob/living/simple_animal/hostile/megafauna/dragon/death(gibbed)
move_force = MOVE_FORCE_DEFAULT
return ..()

/mob/living/simple_animal/hostile/megafauna/dragon/OpenFire()
if(swooping)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
/// Message for when the polar bear starts to attack faster
var/aggressive_message_said = FALSE

/mob/living/simple_animal/hostile/asteroid/polarbear/Initialize(mapload)
. = ..()
AddElement(\
/datum/element/change_force_on_death,\
move_force = MOVE_FORCE_DEFAULT,\
move_resist = MOVE_RESIST_DEFAULT,\
pull_force = PULL_FORCE_DEFAULT,\
)

/mob/living/simple_animal/hostile/asteroid/polarbear/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
. = ..()
if(health > maxHealth*0.5)
Expand All @@ -52,20 +61,6 @@
return
aggressive_message_said = FALSE

/mob/living/simple_animal/hostile/asteroid/polarbear/death(gibbed)
move_force = MOVE_FORCE_DEFAULT
move_resist = MOVE_RESIST_DEFAULT
pull_force = PULL_FORCE_DEFAULT
return ..()

/mob/living/simple_animal/hostile/asteroid/polarbear/revive(full_heal_flags = NONE, excess_healing = 0, force_grab_ghost = FALSE)
. = ..()
if(!.)
return
move_force = initial(move_force)
move_resist = initial(move_resist)
pull_force = initial(pull_force)

/mob/living/simple_animal/hostile/asteroid/polarbear/lesser
name = "magic polar bear"
desc = "It seems sentient somehow."
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@
#include "code\datums\elements\mirage_border.dm"
#include "code\datums\elements\mob_grabber.dm"
#include "code\datums\elements\mob_killed_tally.dm"
#include "code\datums\elements\move_force_on_death.dm"
#include "code\datums\elements\movement_turf_changer.dm"
#include "code\datums\elements\movetype_handler.dm"
#include "code\datums\elements\nerfed_pulling.dm"
Expand Down

0 comments on commit 55b1d0a

Please sign in to comment.