From 2e0ff48bbb1486e0bee6bd89ecf7fd72a72742d1 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:45:27 +0200 Subject: [PATCH] Fixing three fishing issues in one PR. (#86042) ## About The Pull Request This will fix #83730, fix #85985 and fix #86033. ## Why It's Good For The Game See above. ## Changelog :cl: fix: You can no longer pickup closets and crates wrapped in a package with a fishing rod. fix: Fixed a few harddel issues with mob spawns that caused charred corpses fished from lavaland to create an invisible blockade. fix: Fixed being able to fish up mobs that have fallen in totally different z-levels with a rescue hook (i.e. from bitrunning domains to lavaland). /:cl: --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/datums/components/chasm.dm | 41 ++++++++++++++++++++- code/modules/fishing/fish/chasm_detritus.dm | 2 +- code/modules/fishing/fishing_rod.dm | 7 ++-- code/modules/mob_spawn/mob_spawn.dm | 9 ++++- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index 43d7201b1e4..6cae053afd1 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -251,14 +251,51 @@ GLOBAL_LIST_EMPTY(chasm_fallen_mobs) /obj/effect/abstract/chasm_storage/Entered(atom/movable/arrived) . = ..() if(isliving(arrived)) + //Mobs that have fallen in reserved area should be deleted to avoid fishing stuff from the deathmatch or VR. + if(is_reserved_level(loc.z) && !istype(get_area(loc), /area/shuttle)) + qdel(arrived) + return RegisterSignal(arrived, COMSIG_LIVING_REVIVE, PROC_REF(on_revive)) - GLOB.chasm_fallen_mobs += arrived + LAZYADD(GLOB.chasm_fallen_mobs[get_chasm_category(loc)], arrived) /obj/effect/abstract/chasm_storage/Exited(atom/movable/gone) . = ..() if(isliving(gone)) UnregisterSignal(gone, COMSIG_LIVING_REVIVE) - GLOB.chasm_fallen_mobs -= gone + LAZYREMOVE(GLOB.chasm_fallen_mobs[get_chasm_category(loc)], gone) + +/obj/effect/abstract/chasm_storage/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) + . = ..() + var/old_cat = get_chasm_category(old_turf) + var/new_cat = get_chasm_category(new_turf) + var/list/mobs = list() + for(var/mob/fallen in src) + mobs += fallen + LAZYREMOVE(GLOB.chasm_fallen_mobs[old_cat], mobs) + LAZYADD(GLOB.chasm_fallen_mobs[new_cat], mobs) + +/** + * Returns a key to store, remove and access fallen mobs depending on the z-level. + * This stops rescuing people from places that are waaaaaaaay too far-fetched. + */ +/proc/get_chasm_category(turf/turf) + var/z_level = turf?.z + var/area/area = get_area(turf) + if(istype(area, /area/shuttle)) //shuttle move between z-levels, so they're a special case. + return area + + if(is_away_level(z_level)) + return ZTRAIT_AWAY + if(is_mining_level(z_level)) + return ZTRAIT_MINING + if(is_station_level(z_level)) + return ZTRAIT_STATION + if(is_centcom_level(z_level)) + return ZTRAIT_CENTCOM + if(is_reserved_level(z_level)) + return ZTRAIT_RESERVED + + return ZTRAIT_SPACE_RUINS #define CHASM_TRAIT "chasm trait" /** diff --git a/code/modules/fishing/fish/chasm_detritus.dm b/code/modules/fishing/fish/chasm_detritus.dm index ea9fcb47757..9595c552e18 100644 --- a/code/modules/fishing/fish/chasm_detritus.dm +++ b/code/modules/fishing/fish/chasm_detritus.dm @@ -96,7 +96,7 @@ GLOBAL_LIST_INIT_TYPED(chasm_detritus_types, /datum/chasm_detritus, init_chasm_d /// This also includes all mobs fallen into chasms, regardless of distance /datum/chasm_detritus/restricted/bodies/get_chasm_contents(turf/fishing_spot) . = ..() - . |= GLOB.chasm_fallen_mobs + . |= GLOB.chasm_fallen_mobs[get_chasm_category(fishing_spot)] /// Body detritus is selected in favor of bodies belonging to sentient mobs /// The first sentient body found in the list of contents is returned, otherwise diff --git a/code/modules/fishing/fishing_rod.dm b/code/modules/fishing/fishing_rod.dm index 68ac1cf2371..1c47b8f7ee3 100644 --- a/code/modules/fishing/fishing_rod.dm +++ b/code/modules/fishing/fishing_rod.dm @@ -138,9 +138,10 @@ return //Try to move it 'till it's under the user's feet, then try to pick it up if(isitem(currently_hooked)) - step_towards(currently_hooked, get_turf(src)) - if(currently_hooked.loc == user.loc) - user.put_in_inactive_hand(currently_hooked) + var/obj/item/item = currently_hooked + step_towards(item, get_turf(src)) + if(item.loc == user.loc && (item.interaction_flags_item & INTERACT_ITEM_ATTACK_HAND_PICKUP)) + user.put_in_inactive_hand(item) QDEL_NULL(fishing_line) //Not an item, so just delete the line if it's adjacent to the user. else if(get_dist(currently_hooked,get_turf(src)) > 1) diff --git a/code/modules/mob_spawn/mob_spawn.dm b/code/modules/mob_spawn/mob_spawn.dm index 3337a15b441..36562cec6e8 100644 --- a/code/modules/mob_spawn/mob_spawn.dm +++ b/code/modules/mob_spawn/mob_spawn.dm @@ -38,6 +38,12 @@ if(faction) faction = string_list(faction) +/obj/effect/mob_spawn/Destroy() + spawned_mob_ref = null + if(istype(outfit)) + QDEL_NULL(outfit) + return ..() + /// Creates whatever mob the spawner makes. Return FALSE if we want to exit from here without doing that, returning NULL will be logged to admins. /obj/effect/mob_spawn/proc/create(mob/mob_possessor, newname) var/mob/living/spawned_mob = new mob_type(get_turf(src)) //living mobs only @@ -137,7 +143,7 @@ SSpoints_of_interest.make_point_of_interest(src) LAZYADD(GLOB.mob_spawners[name], src) -/obj/effect/mob_spawn/Destroy() +/obj/effect/mob_spawn/ghost_role/Destroy() var/list/spawners = GLOB.mob_spawners[name] LAZYREMOVE(spawners, src) if(!LAZYLEN(spawners)) @@ -261,6 +267,7 @@ ///these mob spawn subtypes trigger immediately (New or Initialize) and are not player controlled... since they're dead, you know? /obj/effect/mob_spawn/corpse + density = FALSE //these are pretty much abstract objects that leave a corpse in their place. ///when this mob spawn should auto trigger. var/spawn_when = CORPSE_INSTANT