mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 14:08:31 +01:00
[MIRROR] Fixes a fuck ton more harddels (#5476)
* Fixes a fuck ton more harddels (#58779) Redoes how geese handle eating shit, it was fucking stupid and caused harddels, and while this method is technically slower in the best case, it's a fucking goose Fixes action related harddels, I hate how they work but at least this way they won't hold refs. Fixes the hierophont causing its beacon to harddel Removes the M variable from megafauna actions, it was used like a typed owner and caused harddels, so I burned it Fixes target and targets_from harddels, replaces all setters of target with LoseTarget and GiveTarget, which should help maintain behavior. I'm not sure if this breaks anything, but if it does we should fix the assumptions that code makes instead of reverting this change Fixes more area_senstive_contents related harddels, we need to allow the mob to move before clearing out its list. Fixes marked object harddels (I'm coming for you admin team) Fixes a language based human harddel Fixes managed overlay related harddels (This was just emissive blockers, but I think this is a good safety net to have. If we clear the overlay list we should clear this one as well) Fixes bot core harddels, I hate the fact that this exists but it has no reason to know who its owner is Adds a walk(src, 0) to simple_animal destroy, it's the best bang for the buck in terms of stopping spurious harddels. Walk related harddels aren't that expensive in the first place, since byond does the same thing I'm doing here, but this makes finding mob harddels easier, so let's go with it I fixed another source of part harddels, I hate fullupgrade so much Fixes all the sound loop harddels * Fixes a fuck ton more harddels Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
co-authored by
LemonInTheDark
parent
d61cc2d5c5
commit
42bd885efd
@@ -897,12 +897,10 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
/obj/machinery/bot_core
|
||||
use_power = NO_POWER_USE
|
||||
anchored = FALSE
|
||||
var/mob/living/simple_animal/bot/owner = null
|
||||
|
||||
/obj/machinery/bot_core/Initialize()
|
||||
. = ..()
|
||||
owner = loc
|
||||
if(!istype(owner))
|
||||
if(!isbot(loc))
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
/mob/living/simple_animal/bot/proc/topic_denied(mob/user) //Access check proc for bot topics! Remember to place in a bot's individual Topic if desired.
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/hostile/eldritch/armsy/Shoot(atom/targeted_atom)
|
||||
target = targeted_atom
|
||||
GiveTarget(targeted_atom)
|
||||
AttackingTarget()
|
||||
|
||||
/mob/living/simple_animal/hostile/eldritch/armsy/AttackingTarget()
|
||||
@@ -261,7 +261,7 @@
|
||||
if(target == back || target == front)
|
||||
return
|
||||
if(back)
|
||||
back.target = target
|
||||
back.GiveTarget(target)
|
||||
back.AttackingTarget()
|
||||
if(!Adjacent(target))
|
||||
return
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
var/obj/structure/beebox/BB = target
|
||||
forceMove(BB)
|
||||
toggle_ai(AI_IDLE)
|
||||
target = null
|
||||
LoseTarget()
|
||||
wanted_objects -= beehometypecache //so we don't attack beeboxes when not going home
|
||||
return //no don't attack the goddamm box
|
||||
else
|
||||
@@ -193,10 +193,10 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/poison/bees/proc/pollinate(obj/machinery/hydroponics/Hydro)
|
||||
if(!istype(Hydro) || !Hydro.myseed || Hydro.dead || Hydro.recent_bee_visit)
|
||||
target = null
|
||||
LoseTarget()
|
||||
return
|
||||
|
||||
target = null //so we pick a new hydro tray next FindTarget(), instead of loving the same plant for eternity
|
||||
LoseTarget() //so we pick a new hydro tray next FindTarget(), instead of loving the same plant for eternity
|
||||
wanted_objects -= hydroponicstypecache //so we only hunt them while they're alive/seeded/not visisted
|
||||
Hydro.recent_bee_visit = TRUE
|
||||
addtimer(VARSET_CALLBACK(Hydro, recent_bee_visit, FALSE), BEE_TRAY_RECENT_VISIT)
|
||||
@@ -232,7 +232,7 @@
|
||||
if(idle <= BEE_IDLE_GOHOME && prob(BEE_PROB_GOHOME))
|
||||
if(!FindTarget())
|
||||
wanted_objects |= beehometypecache //so we don't attack beeboxes when not going home
|
||||
target = beehome
|
||||
GiveTarget(beehome)
|
||||
if(!beehome) //add outselves to a beebox (of the same reagent) if we have no home
|
||||
for(var/obj/structure/beebox/BB in view(vision_range, src))
|
||||
if(reagent_incompatible(BB.queen_bee) || BB.bees.len >= BB.get_max_bees())
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
var/icon_vomit = "vomit"
|
||||
var/icon_vomit_end = "vomit_end"
|
||||
var/message_cooldown = 0
|
||||
var/list/nummies = list()
|
||||
var/choking = FALSE
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/goose/Initialize()
|
||||
@@ -46,27 +45,21 @@
|
||||
/mob/living/simple_animal/hostile/retaliate/goose/proc/goosement(atom/movable/AM, OldLoc, Dir, Forced)
|
||||
if(stat == DEAD)
|
||||
return
|
||||
nummies.Cut()
|
||||
nummies += loc.contents
|
||||
if(prob(5) && random_retaliate)
|
||||
Retaliate()
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action()
|
||||
if(length(nummies))
|
||||
var/obj/item/E = locate() in nummies
|
||||
if(E && E.loc == loc)
|
||||
feed(E)
|
||||
nummies -= E
|
||||
var/obj/item/eat_it_motherfucker = pick(locate(/obj/item) in loc)
|
||||
if(!eat_it_motherfucker)
|
||||
return
|
||||
feed(eat_it_motherfucker)
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action()
|
||||
if(length(nummies))
|
||||
var/obj/item/E = pick(nummies)
|
||||
if(!E.has_material_type(/datum/material/plastic))
|
||||
nummies -= E // remove non-plastic item from queue
|
||||
E = locate(/obj/item/reagent_containers/food) in nummies // find food
|
||||
if(E && E.loc == loc)
|
||||
feed(E)
|
||||
nummies -= E
|
||||
for(var/obj/item/eat_it_motherfucker in loc)
|
||||
if(!eat_it_motherfucker.has_material_type(/datum/material/plastic))
|
||||
continue
|
||||
feed(eat_it_motherfucker)
|
||||
break
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/goose/proc/feed(obj/item/suffocator)
|
||||
if(stat == DEAD || choking) // plapatin I swear to god
|
||||
@@ -174,7 +167,7 @@
|
||||
if (stat == DEAD)
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
var/obj/item/reagent_containers/food/consumed = locate() in contents //Barf out a single food item from our guts
|
||||
var/obj/item/consumed = locate() in contents //Barf out a single food item from our guts
|
||||
choking = FALSE // assume birdboat is vomiting out whatever he was choking on
|
||||
if (prob(50) && consumed)
|
||||
barf_food(consumed)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
stop_automated_movement_when_pulled = 0
|
||||
obj_damage = 40
|
||||
environment_smash = ENVIRONMENT_SMASH_STRUCTURES //Bitflags. Set to ENVIRONMENT_SMASH_STRUCTURES to break closets,tables,racks, etc; ENVIRONMENT_SMASH_WALLS for walls; ENVIRONMENT_SMASH_RWALLS for rwalls
|
||||
///The current target of our attacks, use GiveTarget and LoseTarget to set this var
|
||||
var/atom/target
|
||||
var/ranged = FALSE
|
||||
var/rapid = 0 //How many shots per volley.
|
||||
@@ -46,6 +47,7 @@
|
||||
var/stat_attack = CONSCIOUS
|
||||
var/stat_exclusive = FALSE //Mobs with this set to TRUE will exclusively attack things defined by stat_attack, stat_attack DEAD means they will only attack corpses
|
||||
var/attack_same = 0 //Set us to 1 to allow us to attack our own faction
|
||||
//Use set_targets_from to modify this var
|
||||
var/atom/targets_from = null //all range/attack/etc. calculations should be done from this atom, defaults to the mob itself, useful for Vehicles and such
|
||||
var/attack_all_objects = FALSE //if true, equivalent to having a wanted_objects list containing ALL objects.
|
||||
var/lose_patience_timer_id //id for a timer to call LoseTarget(), used to stop mobs fixating on a target they can't reach
|
||||
@@ -68,12 +70,14 @@
|
||||
. = ..()
|
||||
|
||||
if(!targets_from)
|
||||
targets_from = src
|
||||
set_targets_from(src)
|
||||
wanted_objects = typecacheof(wanted_objects)
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/Destroy()
|
||||
targets_from = null
|
||||
set_targets_from(null)
|
||||
//We can't use losetarget here because fucking cursed blobs override it to do nothing the motherfuckers
|
||||
GiveTarget(null)
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/Life(delta_time = SSMOBS_DT, times_fired)
|
||||
@@ -253,12 +257,12 @@
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/GiveTarget(new_target)//Step 4, give us our selected target
|
||||
target = new_target
|
||||
add_target(new_target)
|
||||
LosePatience()
|
||||
if(target != null)
|
||||
GainPatience()
|
||||
Aggro()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
//What we do after closing in
|
||||
/mob/living/simple_animal/hostile/proc/MeleeAction(patience = TRUE)
|
||||
@@ -337,7 +341,7 @@
|
||||
. = ..()
|
||||
if(!ckey && !stat && search_objects < 3 && . > 0)//Not unconscious, and we don't ignore mobs
|
||||
if(search_objects)//Turn off item searching and ignore whatever item we were looking at, we're more concerned with fight or flight
|
||||
target = null
|
||||
LoseTarget()
|
||||
LoseSearchObjects()
|
||||
if(AIStatus != AI_ON && AIStatus != AI_OFF)
|
||||
toggle_ai(AI_ON)
|
||||
@@ -364,7 +368,7 @@
|
||||
taunt_chance = initial(taunt_chance)
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/LoseTarget()
|
||||
target = null
|
||||
GiveTarget(null)
|
||||
approaching_target = FALSE
|
||||
in_melee = FALSE
|
||||
walk(src, 0)
|
||||
@@ -511,7 +515,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/RangedAttack(atom/A, modifiers) //Player firing
|
||||
if(ranged && ranged_cooldown <= world.time)
|
||||
target = A
|
||||
GiveTarget(A)
|
||||
OpenFire(A)
|
||||
return ..()
|
||||
|
||||
@@ -652,3 +656,28 @@
|
||||
if(charge_state)
|
||||
charge_state = FALSE
|
||||
update_icons()
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/set_targets_from(atom/target_from)
|
||||
if(targets_from)
|
||||
UnregisterSignal(targets_from, COMSIG_PARENT_QDELETING)
|
||||
targets_from = target_from
|
||||
if(targets_from)
|
||||
RegisterSignal(targets_from, COMSIG_PARENT_QDELETING, .proc/handle_targets_from_del)
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/handle_targets_from_del(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
if(targets_from != src)
|
||||
set_targets_from(src)
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/handle_target_del(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(target, COMSIG_PARENT_QDELETING)
|
||||
target = null
|
||||
LoseTarget()
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/add_target(new_target)
|
||||
if(target)
|
||||
UnregisterSignal(target, COMSIG_PARENT_QDELETING)
|
||||
target = new_target
|
||||
if(target)
|
||||
RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/handle_target_del)
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/jungle/leaper/CtrlClickOn(atom/A)
|
||||
face_atom(A)
|
||||
target = A
|
||||
GiveTarget(A)
|
||||
if(!isturf(loc))
|
||||
return
|
||||
if(next_move > world.time)
|
||||
|
||||
@@ -69,9 +69,9 @@
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/enter_mecha(obj/vehicle/sealed/mecha/M)
|
||||
if(!M)
|
||||
return 0
|
||||
target = null //Target was our mecha, so null it out
|
||||
LoseTarget() //Target was our mecha, so null it out
|
||||
M.aimob_enter_mech(src)
|
||||
targets_from = M
|
||||
set_targets_from(M)
|
||||
allow_movement_on_non_turfs = TRUE //duh
|
||||
var/do_ranged = 0
|
||||
for(var/equip in mecha.equipment)
|
||||
@@ -97,14 +97,14 @@
|
||||
|
||||
mecha.aimob_exit_mech(src)
|
||||
allow_movement_on_non_turfs = FALSE
|
||||
targets_from = src
|
||||
set_targets_from(src)
|
||||
|
||||
//Find a new mecha
|
||||
wanted_objects = typecacheof(/obj/vehicle/sealed/mecha/combat, TRUE)
|
||||
var/search_aggressiveness = 2
|
||||
for(var/obj/vehicle/sealed/mecha/combat/C in range(vision_range,src))
|
||||
if(is_valid_mecha(C))
|
||||
target = C
|
||||
GiveTarget(C)
|
||||
search_aggressiveness = 3 //We can see a mech? RUN FOR IT, IGNORE MOBS!
|
||||
break
|
||||
search_objects = search_aggressiveness
|
||||
@@ -188,7 +188,7 @@
|
||||
return
|
||||
else
|
||||
if(!CanAttack(M))
|
||||
target = null
|
||||
LoseTarget()
|
||||
return
|
||||
|
||||
return target.attack_animal(src)
|
||||
@@ -201,7 +201,7 @@
|
||||
if(!mecha)
|
||||
for(var/obj/vehicle/sealed/mecha/combat/mecha_in_range in range(src,vision_range))
|
||||
if(is_valid_mecha(mecha_in_range))
|
||||
target = mecha_in_range //Let's nab it!
|
||||
GiveTarget(mecha_in_range) //Let's nab it!
|
||||
minimum_distance = 1
|
||||
ranged = 0
|
||||
break
|
||||
|
||||
@@ -311,7 +311,7 @@
|
||||
if(stat || swooping)
|
||||
return
|
||||
if(manual_target)
|
||||
target = manual_target
|
||||
GiveTarget(manual_target)
|
||||
if(!target)
|
||||
return
|
||||
stop_automated_movement = TRUE
|
||||
|
||||
@@ -90,6 +90,10 @@ Difficulty: Hard
|
||||
. = ..()
|
||||
spawned_beacon = new(loc)
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/hierophant/Destroy()
|
||||
QDEL_NULL(spawned_beacon)
|
||||
. = ..()
|
||||
|
||||
/datum/action/innate/megafauna_attack/blink
|
||||
name = "Blink To Target"
|
||||
icon_icon = 'icons/mob/actions/actions_items.dmi'
|
||||
@@ -412,10 +416,6 @@ Difficulty: Hard
|
||||
set_stat(CONSCIOUS) // deathgasp won't run if dead, stupid
|
||||
..(force_grant = stored_nearby)
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/hierophant/Destroy()
|
||||
qdel(spawned_beacon)
|
||||
. = ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/hierophant/devour(mob/living/L)
|
||||
for(var/obj/item/W in L)
|
||||
if(!L.dropItemToGround(W))
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
for(var/i = 1 to nest_range)
|
||||
closest = get_step(closest, get_dir(closest, src))
|
||||
forceMove(closest) // someone teleported out probably and the megafauna kept chasing them
|
||||
target = null
|
||||
LoseTarget()
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -179,16 +179,15 @@
|
||||
name = "Megafauna Attack"
|
||||
icon_icon = 'icons/mob/actions/actions_animal.dmi'
|
||||
button_icon_state = ""
|
||||
var/mob/living/simple_animal/hostile/megafauna/M
|
||||
var/chosen_message
|
||||
var/chosen_attack_num = 0
|
||||
|
||||
/datum/action/innate/megafauna_attack/Grant(mob/living/L)
|
||||
if(istype(L, /mob/living/simple_animal/hostile/megafauna))
|
||||
M = L
|
||||
return ..()
|
||||
return FALSE
|
||||
if(!ismegafauna(L))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/action/innate/megafauna_attack/Activate()
|
||||
M.chosen_attack = chosen_attack_num
|
||||
to_chat(M, chosen_message)
|
||||
var/mob/living/simple_animal/hostile/megafauna/fauna = owner
|
||||
fauna.chosen_attack = chosen_attack_num
|
||||
to_chat(fauna, chosen_message)
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
G.is_burrowed = TRUE
|
||||
|
||||
/mob/living/simple_animal/hostile/asteroid/goldgrub/GiveTarget(new_target)
|
||||
target = new_target
|
||||
add_target(new_target)
|
||||
if(target != null)
|
||||
if(istype(target, /obj/item/stack/ore))
|
||||
visible_message("<span class='notice'>The [name] looks at [target.name] with hungry eyes.</span>")
|
||||
|
||||
@@ -230,6 +230,8 @@
|
||||
if (T && AIStatus == AI_Z_OFF)
|
||||
SSidlenpcpool.idle_mobs_by_zlevel[T.z] -= src
|
||||
|
||||
//Walking counts as a reference, putting this here because most things don't walk, clean this up once walk() procs are dead
|
||||
walk(src, 0)
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/vv_edit_var(var_name, var_value)
|
||||
|
||||
Reference in New Issue
Block a user