From 0a2d3a8cf6815154f087a6fa2c5da7a199426c82 Mon Sep 17 00:00:00 2001 From: Cameron Lennox Date: Sun, 14 Sep 2025 03:05:16 -0400 Subject: [PATCH] Mop do_after multi use (#18485) * Mop do_after Makes mop do after allow multiple uses * Update mop.dm * fixes * Gets rid of these unused vars * cleanup --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> --- code/game/atom/_atom.dm | 4 +- code/game/gamemodes/events/clang.dm | 1 + code/game/machinery/camera/camera.dm | 13 ++-- code/game/machinery/doors/door.dm | 19 +++--- code/game/mecha/mecha.dm | 7 +- code/game/objects/items/weapons/mop.dm | 27 ++------ code/game/objects/structures/alien/alien.dm | 19 ++++-- code/game/objects/structures/gargoyle.dm | 12 ++-- code/game/objects/structures/low_wall.dm | 10 +-- code/game/objects/structures/window.dm | 12 ++-- code/game/turfs/simulated/lava.dm | 4 +- code/game/turfs/simulated/walls.dm | 16 +++-- code/game/turfs/turf.dm | 18 +++--- code/game/turfs/unsimulated/sky_vr.dm | 14 ++-- code/modules/assembly/mousetrap.dm | 4 +- code/modules/awaymissions/redgate.dm | 64 ++++++++++--------- .../kitchen/smartfridge/smartfridge_vr.dm | 12 ++-- .../maint_recycler/code/maint_recycler.dm | 32 +++++----- .../mob/living/carbon/human/human_defense.dm | 10 +-- code/modules/mob/living/living_defense.dm | 10 +-- .../subtypes/animal/alien animals/stardog.dm | 24 +++---- code/modules/multiz/turf.dm | 4 +- code/modules/recycling/disposal_machines.dm | 22 +++---- code/modules/recycling/sortingmachinery.dm | 14 ++-- code/modules/shieldgen/emergency_shield.dm | 15 +++-- 25 files changed, 197 insertions(+), 190 deletions(-) diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index 86d04711c03..8438fdbc022 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -284,9 +284,9 @@ return -/atom/proc/hitby(atom/movable/AM as mob|obj) +/atom/proc/hitby(atom/movable/source) if (density) - AM.throwing = 0 + source.throwing = 0 return //returns 1 if made bloody, returns 0 otherwise diff --git a/code/game/gamemodes/events/clang.dm b/code/game/gamemodes/events/clang.dm index b080ddd9b14..1a9abbace36 100644 --- a/code/game/gamemodes/events/clang.dm +++ b/code/game/gamemodes/events/clang.dm @@ -69,6 +69,7 @@ name = "Immovable Rod" desc = "What the fuck is that?" icon = 'icons/obj/objects.dmi' + w_class = 100 //Affects how much damage it does to stuff icon_state = "immrod" density = TRUE anchored = TRUE diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 5f2219d2cb8..1978f969864 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -121,13 +121,14 @@ return destroy() -/obj/machinery/camera/hitby(AM as mob|obj) +/obj/machinery/camera/hitby(atom/movable/source) ..() - if (istype(AM, /obj)) - var/obj/item/O = AM - if(O.throwforce >= src.toughness) - visible_message(span_boldwarning("[src] was hit by [O].")) - take_damage(O.throwforce) + if (!isobj(source)) + return + var/obj/item/O = source + if(O.throwforce >= src.toughness) + visible_message(span_boldwarning("[src] was hit by [O].")) + take_damage(O.throwforce) /obj/machinery/camera/proc/setViewRange(var/num = 7) src.view_range = num diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 760be0f817b..af652de037f 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -197,18 +197,21 @@ -/obj/machinery/door/hitby(AM as mob|obj, var/speed=5) - +/obj/machinery/door/hitby(atom/movable/source, var/speed=5) ..() - visible_message(span_danger("[src.name] was hit by [AM].")) + visible_message(span_danger("[src.name] was hit by [source].")) var/tforce = 0 - if(ismob(AM)) - tforce = 15 * (speed/5) - else - tforce = AM:throwforce * (speed/5) + if(ismob(source)) + tforce = 15 * (speed/THROWFORCE_SPEED_DIVISOR) + else if(isobj(source)) + var/obj/object = source + if(isitem(object)) + var/obj/item/our_item = object + tforce = our_item.throwforce * (speed/THROWFORCE_SPEED_DIVISOR) + else + tforce = object.w_class * (speed/THROWFORCE_SPEED_DIVISOR) playsound(src, hitsound, 100, 1) take_damage(tforce) - return /obj/machinery/door/attack_ai(mob/user as mob) return src.attack_hand(user) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 8c7503ca74c..024c600cb55 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1109,11 +1109,10 @@ src.log_append_to_last("Armor saved.") return -/obj/mecha/hitby(atom/movable/A as mob|obj) //wrapper +/obj/mecha/hitby(atom/movable/source) //wrapper ..() - src.mecha_log_message("Hit by [A].",1) - call((proc_res["dynhitby"]||src), "dynhitby")(A) - return + src.mecha_log_message("Hit by [source].",1) + call((proc_res["dynhitby"]||src), "dynhitby")(source) //I think this is relative to throws. /obj/mecha/proc/dynhitby(atom/movable/A) diff --git a/code/game/objects/items/weapons/mop.dm b/code/game/objects/items/weapons/mop.dm index 157c0b8548c..4049671428a 100644 --- a/code/game/objects/items/weapons/mop.dm +++ b/code/game/objects/items/weapons/mop.dm @@ -15,8 +15,8 @@ GLOBAL_LIST_BOILERPLATE(all_mops, /obj/item/mop) w_class = ITEMSIZE_NORMAL flags = NOCONDUCT attack_verb = list("mopped", "bashed", "bludgeoned", "whacked") - var/mopping = 0 - var/mopcount = 0 + ///How long it takes to mop a tile. + var/mop_time = 4 SECONDS /obj/item/mop/Initialize(mapload) . = ..() @@ -31,7 +31,7 @@ GLOBAL_LIST_BOILERPLATE(all_mops, /obj/item/mop) user.visible_message(span_warning("[user] begins to clean \the [get_turf(A)].")) - if(do_after(user, 4 SECONDS, target = src)) + if(do_after(user, mop_time, target = src, max_interact_count = 9)) var/turf/T = get_turf(A) if(T) T.wash(CLEAN_SCRUB) @@ -59,23 +59,4 @@ GLOBAL_LIST_BOILERPLATE(all_mops, /obj/item/mop) w_class = ITEMSIZE_NORMAL flags = NOCONDUCT attack_verb = list("mopped", "bashed", "bludgeoned", "whacked") - -/obj/item/mop/advanced/Initialize(mapload) - . = ..() - create_reagents(30) - -/obj/item/mop/advanced/afterattack(atom/A, mob/user, proximity) - if(!proximity) return - if(istype(A, /turf) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay) || istype(A, /obj/effect/rune)) - if(reagents.total_volume < 1) - to_chat(user, span_notice("Your mop is dry!")) - return - - user.visible_message(span_warning("[user] begins to clean \the [get_turf(A)].")) - - if(do_after(user, 2 SECONDS, target = src)) - var/turf/T = get_turf(A) - if(T) - T.wash(CLEAN_SCRUB) - reagents.trans_to_turf(T, 1, 10) - to_chat(user, span_notice("You have finished mopping!")) + mop_time = 2 SECONDS diff --git a/code/game/objects/structures/alien/alien.dm b/code/game/objects/structures/alien/alien.dm index 58633a86d42..476397cb107 100644 --- a/code/game/objects/structures/alien/alien.dm +++ b/code/game/objects/structures/alien/alien.dm @@ -33,14 +33,19 @@ healthcheck() return -/obj/structure/alien/hitby(AM as mob|obj) +/obj/structure/alien/hitby(atom/movable/source) ..() - visible_message(span_danger("\The [src] was hit by \the [AM].")) - var/tforce = 0 - if(ismob(AM)) - tforce = 10 - else - tforce = AM:throwforce + visible_message(span_danger("\The [src] was hit by \the [source].")) + var/tforce + if(ismob(source)) + tforce = 15 + else if(isobj(source)) + var/obj/object = source + if(isitem(object)) + var/obj/item/our_item = object + tforce = our_item.throwforce + else + tforce = object.w_class playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) health = max(0, health - tforce) healthcheck() diff --git a/code/game/objects/structures/gargoyle.dm b/code/game/objects/structures/gargoyle.dm index 67139208002..b8d940c4c17 100644 --- a/code/game/objects/structures/gargoyle.dm +++ b/code/game/objects/structures/gargoyle.dm @@ -285,17 +285,17 @@ tail_image.layer = BODY_LAYER + ((dir in tail_lower_dirs) ? TAIL_LOWER_LAYER : tail_layering) add_overlay(tail_image) -/obj/structure/gargoyle/hitby(atom/movable/AM as mob|obj,var/speed = THROWFORCE_SPEED_DIVISOR) +/obj/structure/gargoyle/hitby(atom/movable/source ,var/speed = THROWFORCE_SPEED_DIVISOR) var/mob/living/carbon/human/gargoyle = WR_gargoyle.resolve() if(!gargoyle) return - if(istype(AM,/obj/item) && gargoyle.vore_selected && gargoyle.trash_catching) - var/obj/item/I = AM + if(isitem(source) && gargoyle.vore_selected && gargoyle.trash_catching) + var/obj/item/I = source if(gargoyle.adminbus_trash || is_type_in_list(I, GLOB.edible_trash) && I.trash_eatable && !is_type_in_list(I, GLOB.item_vore_blacklist)) - gargoyle.hitby(AM, speed) + gargoyle.hitby(source, speed) return - else if(isliving(AM)) - var/mob/living/L = AM + else if(isliving(source)) + var/mob/living/L = source if(gargoyle.throw_vore && L.throw_vore && gargoyle.can_be_drop_pred && L.can_be_drop_prey) var/drop_prey_temp = FALSE if(gargoyle.can_be_drop_prey) diff --git a/code/game/objects/structures/low_wall.dm b/code/game/objects/structures/low_wall.dm index 36a458c0691..a2ff142a653 100644 --- a/code/game/objects/structures/low_wall.dm +++ b/code/game/objects/structures/low_wall.dm @@ -257,14 +257,14 @@ take_damage(damage) return -/obj/structure/low_wall/hitby(AM as mob|obj, var/speed) +/obj/structure/low_wall/hitby(atom/movable/source, var/speed) ..() var/tforce = 0 - if(ismob(AM)) // All mobs have a multiplier and a size according to mob_defines.dm - var/mob/I = AM + if(ismob(source)) // All mobs have a multiplier and a size according to mob_defines.dm + var/mob/I = source tforce = I.mob_size * (speed/THROWFORCE_SPEED_DIVISOR) - else if(isitem(AM)) - var/obj/item/O = AM + else if(isitem(source)) + var/obj/item/O = source tforce = O.throwforce * (speed/THROWFORCE_SPEED_DIVISOR) if (tforce < 15) return diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 0e4391146c7..5f74eed2e6e 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -156,21 +156,21 @@ return !anchored // If it's anchored, it'll block air. return TRUE // Don't stop airflow from the other sides. -/obj/structure/window/hitby(AM as mob|obj) +/obj/structure/window/hitby(atom/movable/source) ..() - visible_message(span_danger("[src] was hit by [AM].")) + visible_message(span_danger("[src] was hit by [source].")) var/tforce = 0 - if(ismob(AM)) + if(ismob(source)) tforce = 40 - else if(isobj(AM)) - var/obj/item/I = AM + else if(isobj(source)) + var/obj/item/I = source tforce = I.throwforce if(reinf) tforce *= 0.25 if(health - tforce <= 7 && !reinf) anchored = FALSE update_verbs() update_nearby_icons() - step(src, get_dir(AM, src)) + step(src, get_dir(source, src)) take_damage(tforce) /obj/structure/window/attack_tk(mob/user as mob) diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm index 04d663b3653..8e5eecb41f1 100644 --- a/code/game/turfs/simulated/lava.dm +++ b/code/game/turfs/simulated/lava.dm @@ -52,8 +52,8 @@ if(burn_stuff(AM)) START_PROCESSING(SSturfs, src) -/turf/simulated/floor/lava/hitby(atom/movable/AM) - if(burn_stuff(AM)) +/turf/simulated/floor/lava/hitby(atom/movable/source) + if(burn_stuff(source)) START_PROCESSING(SSturfs, src) /turf/simulated/floor/lava/process() diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 14e6ec4b55f..2ae30050d11 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -96,13 +96,19 @@ take_damage(damage) return -/turf/simulated/wall/hitby(AM as mob|obj, var/speed=THROWFORCE_SPEED_DIVISOR) +/turf/simulated/wall/hitby(atom/movable/source, var/speed=THROWFORCE_SPEED_DIVISOR) ..() - if(ismob(AM)) + if(ismob(source)) return - - var/tforce = AM:throwforce * (speed/THROWFORCE_SPEED_DIVISOR) - if (tforce < 15) + var/tforce = 0 + if(isobj(source)) + var/obj/object = source + if(isitem(object)) + var/obj/item/our_item = object + tforce = our_item.throwforce * (speed/THROWFORCE_SPEED_DIVISOR) + else + tforce = object.w_class * (speed/THROWFORCE_SPEED_DIVISOR) + if(tforce < 15) return take_damage(tforce) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index faa434f5dcb..2f9c0b53ec2 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -335,14 +335,16 @@ return // Called when turf is hit by a thrown object -/turf/hitby(atom/movable/AM as mob|obj, var/speed) - if(density) - if(!get_gravity(AM)) //Checked a different codebase for reference. Turns out it's only supposed to happen in no-gravity - spawn(2) - step(AM, turn(AM.last_move, 180)) //This makes it float away after hitting a wall in 0G - if(isliving(AM)) - var/mob/living/M = AM - M.turf_collision(src, speed) +/turf/hitby(atom/movable/source, var/speed) + if(!density) + return + + if(!get_gravity(source)) //Checked a different codebase for reference. Turns out it's only supposed to happen in no-gravity + spawn(2) + step(source, turn(source.last_move, 180)) //This makes it float away after hitting a wall in 0G + if(isliving(source)) + var/mob/living/M = source + M.turf_collision(src, speed) /turf/AllowDrop() return TRUE diff --git a/code/game/turfs/unsimulated/sky_vr.dm b/code/game/turfs/unsimulated/sky_vr.dm index f805f06d311..6127168178d 100644 --- a/code/game/turfs/unsimulated/sky_vr.dm +++ b/code/game/turfs/unsimulated/sky_vr.dm @@ -41,15 +41,15 @@ do_fall(AM) -/turf/unsimulated/floor/sky/hitby(var/atom/movable/AM, var/speed) +/turf/unsimulated/floor/sky/hitby(var/atom/movable/source, var/speed) . = ..() if(!does_skyfall) return //We don't do that - do_fall(AM) + do_fall(source) -/turf/unsimulated/floor/sky/proc/do_fall(atom/movable/AM) +/turf/unsimulated/floor/sky/proc/do_fall(atom/movable/source) //Bye var/attempts = 100 var/turf/simulated/T @@ -65,8 +65,8 @@ if(!T) return - AM.forceMove(T) - if(isliving(AM)) - var/mob/living/L = AM - message_admins("\The [AM] fell out of the sky.") + source.forceMove(T) + if(isliving(source)) + var/mob/living/L = source + message_admins("\The [source] fell out of the sky.") L.fall_impact(T, 42, 90, FALSE, TRUE) //You will not be defibbed from this. diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index fdcb825a9ff..9b385944ae9 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -101,10 +101,10 @@ return 1 //end the search! return 0 -/obj/item/assembly/mousetrap/hitby(var/atom/movable/A) +/obj/item/assembly/mousetrap/hitby(var/atom/movable/source) if(!armed) return ..() - visible_message(span_warning("[src] is triggered by [A].")) + visible_message(span_warning("[src] is triggered by [source].")) triggered(null) /obj/item/assembly/mousetrap/armed diff --git a/code/modules/awaymissions/redgate.dm b/code/modules/awaymissions/redgate.dm index 1f1f02f8662..92b156dd408 100644 --- a/code/modules/awaymissions/redgate.dm +++ b/code/modules/awaymissions/redgate.dm @@ -1759,39 +1759,41 @@ ball.item_state = "[initial(ball.item_state)]" ball.update_icon() -/obj/structure/hyperball_goal/hitby(obj/B as obj) +/obj/structure/hyperball_goal/hitby(atom/movable/source) . = ..() - if(istype(B,/obj/item/laserdome_hyperball)) - var/obj/item/laserdome_hyperball/ball = B - if(prob(range_dunk_chance)) - if(ball.last_team != goal_team) - GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball for [capitalize(ball.last_team)] team! [num2text(range_dunk_points)] points scored!","Laserdome Announcer","Entertainment") - score += range_dunk_points //increment our score! - if(score < score_limit) //announce the current score and how many more captures are needed - GLOB.global_announcer.autosay("[num2text(score_limit-score)] points remain until [capitalize(ball.last_team)] team wins.","Laserdome Announcer","Entertainment") - else if(score >= score_limit) //now, if score equals or exceeds the score limit, announce that our team won and reset the score for all flag bases nearby - GLOB.global_announcer.autosay("+|[uppertext(ball.last_team)] TEAM HAS WON THE MATCH!|+","Laserdome Announcer","Entertainment") - for(var/obj/structure/hyperball_goal/HB in src.loc.loc.contents) //this feels dirty, but it works - HB.score = 0 - else if(ball.last_team == goal_team) //discourage people from dunking the ball into their own goal as a quick way to teleport it back to the midfield - switch(goal_team) //this gets a bit fiddly because we store our score on the target's goal, so we need to scan the map for the opposing team's goal and deduct points from it - if("blue") - for(var/obj/structure/hyperball_goal/red/HGR in src.loc.loc.contents) - HGR.score = max(0,HGR.score-range_dunk_points) - GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and scored an own goal! +Points |de-ducted!|+ [capitalize(goal_team)] team score is now: [HGR.score].","Laserdome Announcer","Entertainment") - if("red") - for(var/obj/structure/hyperball_goal/blue/HGB in src.loc.loc.contents) - HGB.score = max(0,HGB.score-range_dunk_points) - GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and scored an own goal! +Points |de-ducted!|+ [capitalize(goal_team)] team score is now: [HGB.score].","Laserdome Announcer","Entertainment") + if(!istype(source, /obj/item/laserdome_hyperball)) + return - ball.loc = ball.start_pos //teleport the ball back to the midfield - ball.icon_state = "[initial(ball.icon_state)]" - ball.item_state = "[initial(ball.item_state)]" - ball.update_icon() - else - //todo; throw the ball in a random direction - src.visible_message("\The [ball] bounces off \the [src]'s rim!") - GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and +missed!+ |Oooh!|","Laserdome Announcer","Entertainment") + var/obj/item/laserdome_hyperball/ball = source + if(prob(range_dunk_chance)) + if(ball.last_team != goal_team) + GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball for [capitalize(ball.last_team)] team! [num2text(range_dunk_points)] points scored!","Laserdome Announcer","Entertainment") + score += range_dunk_points //increment our score! + if(score < score_limit) //announce the current score and how many more captures are needed + GLOB.global_announcer.autosay("[num2text(score_limit-score)] points remain until [capitalize(ball.last_team)] team wins.","Laserdome Announcer","Entertainment") + else if(score >= score_limit) //now, if score equals or exceeds the score limit, announce that our team won and reset the score for all flag bases nearby + GLOB.global_announcer.autosay("+|[uppertext(ball.last_team)] TEAM HAS WON THE MATCH!|+","Laserdome Announcer","Entertainment") + for(var/obj/structure/hyperball_goal/HB in src.loc.loc.contents) //this feels dirty, but it works + HB.score = 0 + else if(ball.last_team == goal_team) //discourage people from dunking the ball into their own goal as a quick way to teleport it back to the midfield + switch(goal_team) //this gets a bit fiddly because we store our score on the target's goal, so we need to scan the map for the opposing team's goal and deduct points from it + if("blue") + for(var/obj/structure/hyperball_goal/red/HGR in src.loc.loc.contents) + HGR.score = max(0,HGR.score-range_dunk_points) + GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and scored an own goal! +Points |de-ducted!|+ [capitalize(goal_team)] team score is now: [HGR.score].","Laserdome Announcer","Entertainment") + if("red") + for(var/obj/structure/hyperball_goal/blue/HGB in src.loc.loc.contents) + HGB.score = max(0,HGB.score-range_dunk_points) + GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and scored an own goal! +Points |de-ducted!|+ [capitalize(goal_team)] team score is now: [HGB.score].","Laserdome Announcer","Entertainment") + + ball.loc = ball.start_pos //teleport the ball back to the midfield + ball.icon_state = "[initial(ball.icon_state)]" + ball.item_state = "[initial(ball.item_state)]" + ball.update_icon() + else + //todo; throw the ball in a random direction + src.visible_message("\The [ball] bounces off \the [src]'s rim!") + GLOB.global_announcer.autosay("[ball.last_holder] threw the HYPERball and +missed!+ |Oooh!|","Laserdome Announcer","Entertainment") /obj/structure/prop/machine/biosyphon/laserdome name = "Laserdome Orientation Holo" diff --git a/code/modules/food/kitchen/smartfridge/smartfridge_vr.dm b/code/modules/food/kitchen/smartfridge/smartfridge_vr.dm index e35c7878f00..1708bf97fe6 100644 --- a/code/modules/food/kitchen/smartfridge/smartfridge_vr.dm +++ b/code/modules/food/kitchen/smartfridge/smartfridge_vr.dm @@ -19,22 +19,22 @@ /* * Allow thrown items into smartfridges */ -/obj/machinery/smartfridge/hitby(var/atom/movable/A, speed) +/obj/machinery/smartfridge/hitby(var/atom/movable/source, speed) . = ..() - if(accept_check(A) && A.thrower) + if(accept_check(source) && source.thrower) //Try to find what job they are via ID var/obj/item/card/id/thrower_id - if(ismob(A.thrower)) - var/mob/T = A.thrower + if(ismob(source.thrower)) + var/mob/T = source.thrower thrower_id = T.GetIdCard() //98% chance the expert makes it if(expert_job && thrower_id && thrower_id.rank == expert_job && prob(98)) - stock(A) + stock(source) //20% chance a non-expert makes it else if(prob(20)) - stock(A) + stock(source) /* * Chemistry 'chemavator' (multi-z chem storage) diff --git a/code/modules/maint_recycler/code/maint_recycler.dm b/code/modules/maint_recycler/code/maint_recycler.dm index b15b371eb7f..54bafdb8399 100644 --- a/code/modules/maint_recycler/code/maint_recycler.dm +++ b/code/modules/maint_recycler/code/maint_recycler.dm @@ -244,23 +244,25 @@ -/obj/machinery/maint_recycler/hitby(atom/movable/AM) +/obj/machinery/maint_recycler/hitby(atom/movable/source) . = ..() - if(istype(AM, /obj/item) && !istype(AM, /obj/item/projectile)) //no mob throwing. - if(prob(75)) - if(get_item_whitelist(AM) == RECYCLER_ALLOWED) - if(inserted_item == null) - visible_message("\The [AM] lands in \the [src].",runemessage = "swish") - AM.forceMove(src) - inserted_item = AM - update_icon() - playsound(src, 'code/modules/maint_recycler/sfx/voice/a wonderful throw.ogg', 75) - set_screen_state("screen_happy",10) - return - else - deny_act(AM,null) + if(!isitem(source) || istype(source, /obj/item/projectile)) //no mob throwing. + return - visible_message("\The [AM] bounces off of the rim of \the [src]'s processing compartment!") + if(prob(75)) + if(get_item_whitelist(source) == RECYCLER_ALLOWED) + if(inserted_item == null) + visible_message("\The [source] lands in \the [src].",runemessage = "swish") + source.forceMove(src) + inserted_item = source + update_icon() + playsound(src, 'code/modules/maint_recycler/sfx/voice/a wonderful throw.ogg', 75) + set_screen_state("screen_happy",10) + return + else + deny_act(source, null) + + visible_message("\The [source] bounces off of the rim of \the [src]'s processing compartment!") /obj/machinery/maint_recycler/proc/deny_act(var/obj/item/O,var/mob/user) set_screen_state("screen_deny",10) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index bfed0554605..fbfe5123504 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -389,7 +389,7 @@ emp_act return 1 //this proc handles being hit by a thrown atom -/mob/living/carbon/human/hitby(atom/movable/AM as mob|obj,var/speed = THROWFORCE_SPEED_DIVISOR) +/mob/living/carbon/human/hitby(atom/movable/source, var/speed = THROWFORCE_SPEED_DIVISOR) if(src.is_incorporeal()) return // if(buckled && buckled == AM) @@ -398,8 +398,8 @@ emp_act //VORESTATION EDIT START - Allows for thrown vore! //Throwing a prey into a pred takes priority. After that it checks to see if the person being thrown is a pred. // I put more comments here for ease of reading. - if(isliving(AM)) - var/mob/living/thrown_mob = AM + if(isliving(source)) + var/mob/living/thrown_mob = source if(isanimal(thrown_mob) && !allowmobvore && !thrown_mob.ckey) //Is the thrown_mob an animal and we don't allow mobvore? return // PERSON BEING HIT: CAN BE DROP PRED, ALLOWS THROW VORE. @@ -423,8 +423,8 @@ emp_act return //VORESTATION EDIT END - Allows for thrown vore! - if(istype(AM,/obj/item)) - var/obj/item/O = AM + if(isitem(source)) + var/obj/item/O = source if(stat != DEAD && trash_catching && vore_selected) if(adminbus_trash || is_type_in_list(O, GLOB.edible_trash) && O.trash_eatable && !is_type_in_list(O, GLOB.item_vore_blacklist)) visible_message(span_vwarning("[O] is thrown directly into [src]'s [lowertext(vore_selected.name)]!")) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 41ec25c0400..58ece1e9bd4 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -260,11 +260,11 @@ return 1 //this proc handles being hit by a thrown atom -/mob/living/hitby(atom/movable/AM as mob|obj,var/speed = THROWFORCE_SPEED_DIVISOR)//Standardization and logging -Sieve +/mob/living/hitby(atom/movable/source, var/speed = THROWFORCE_SPEED_DIVISOR)//Standardization and logging -Sieve if(is_incorporeal()) return - if(istype(AM,/obj/item)) - var/obj/item/O = AM + if(isitem(source)) + var/obj/item/O = source if(stat != DEAD && trash_catching && vore_selected) if(adminbus_trash || is_type_in_list(O, GLOB.edible_trash) && O.trash_eatable && !is_type_in_list(O, GLOB.item_vore_blacklist)) visible_message(span_vwarning("[O] is thrown directly into [src]'s [lowertext(vore_selected.name)]!")) @@ -329,8 +329,8 @@ //VORESTATION EDIT START - Allows for thrown vore! //Throwing a prey into a pred takes priority. After that it checks to see if the person being thrown is a pred. - if(isliving(AM)) - var/mob/living/thrown_mob = AM + if(isliving(source)) + var/mob/living/thrown_mob = source if(!allowmobvore && isanimal(thrown_mob) && !thrown_mob.ckey) //Does the person being hit not allow mob vore and the perrson being thrown a simple_mob? return diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm index 13640e77203..e517c4d55eb 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/stardog.dm @@ -1439,13 +1439,13 @@ var/mobstuff = TRUE //if false, we don't care about dogs, and that's terrible var/we_process = FALSE //don't start another process while you're processing, idiot -/turf/simulated/floor/water/digestive_enzymes/Entered(atom/movable/AM) - if(digest_stuff(AM) && !we_process) +/turf/simulated/floor/water/digestive_enzymes/Entered(atom/movable/source) + if(digest_stuff(source) && !we_process) START_PROCESSING(SSturfs, src) we_process = TRUE -/turf/simulated/floor/water/digestive_enzymes/hitby(atom/movable/AM) - if(digest_stuff(AM) && !we_process) +/turf/simulated/floor/water/digestive_enzymes/hitby(atom/movable/source) + if(digest_stuff(source) && !we_process) START_PROCESSING(SSturfs, src) we_process = TRUE @@ -1454,12 +1454,12 @@ we_process = FALSE return PROCESS_KILL -/turf/simulated/floor/water/digestive_enzymes/proc/can_digest(atom/movable/AM as mob|obj) +/turf/simulated/floor/water/digestive_enzymes/proc/can_digest(atom/movable/digest_target) . = FALSE - if(AM.loc != src) + if(digest_target.loc != src) return FALSE - if(isitem(AM)) - var/obj/item/I = AM + if(isitem(digest_target)) + var/obj/item/I = digest_target if(I.unacidable || I.throwing || I.is_incorporeal()) return FALSE var/food = FALSE @@ -1476,8 +1476,8 @@ yum += 50 linked_mob.adjust_nutrition(yum) return TRUE - if(isliving(AM)) - var/mob/living/L = AM + if(isliving(digest_target)) + var/mob/living/L = digest_target if(L.unacidable || !L.digestable || L.buckled || L.hovering || L.throwing || L.is_incorporeal()) return FALSE if(ishuman(L)) @@ -1488,7 +1488,7 @@ return TRUE else return TRUE -/turf/simulated/floor/water/digestive_enzymes/proc/digest_stuff(atom/movable/AM) //I'm so sorry +/turf/simulated/floor/water/digestive_enzymes/proc/digest_stuff(atom/movable/digest_target) //I'm so sorry . = FALSE var/damage = 1 @@ -1574,7 +1574,7 @@ if(!we_process) START_PROCESSING(SSturfs, src) -/turf/simulated/floor/flesh/mover/hitby(atom/movable/AM) +/turf/simulated/floor/flesh/mover/hitby(atom/movable/source) if(!we_process) START_PROCESSING(SSturfs, src) diff --git a/code/modules/multiz/turf.dm b/code/modules/multiz/turf.dm index bdd12202312..00dcc1c5d48 100644 --- a/code/modules/multiz/turf.dm +++ b/code/modules/multiz/turf.dm @@ -84,9 +84,9 @@ GLOBAL_DATUM_INIT(openspace_backdrop_one_for_all, /atom/movable/openspace_backdr A.fall() // Called when thrown object lands on this turf. -/turf/simulated/open/hitby(var/atom/movable/AM, var/speed) +/turf/simulated/open/hitby(var/atom/movable/source, var/speed) . = ..() - AM.fall() + source.fall() /turf/simulated/open/examine(mob/user, distance, infix, suffix) . = ..() diff --git a/code/modules/recycling/disposal_machines.dm b/code/modules/recycling/disposal_machines.dm index 199fcf22013..e0937ef2fc2 100644 --- a/code/modules/recycling/disposal_machines.dm +++ b/code/modules/recycling/disposal_machines.dm @@ -419,22 +419,22 @@ update() // update icon return -/obj/machinery/disposal/hitby(atom/movable/AM) +/obj/machinery/disposal/hitby(atom/movable/source) . = ..() - if(istype(AM, /obj/item) && !istype(AM, /obj/item/projectile)) + if(isitem(source) && !istype(source, /obj/item/projectile)) if(prob(75)) - AM.forceMove(src) - visible_message("\The [AM] lands in \the [src].") + source.forceMove(src) + visible_message("\The [source] lands in \the [src].") else - visible_message("\The [AM] bounces off of \the [src]'s rim!") + visible_message("\The [source] bounces off of \the [src]'s rim!") - if(istype(AM,/mob/living)) + if(isliving(source)) if(prob(75)) - var/mob/living/to_be_dunked = AM - if(ishuman(AM) ||to_be_dunked.client) - log_and_message_admins("[AM] was thrown into \the [src]", null) - AM.forceMove(src) - visible_message("\The [AM] lands in \the [src].") + var/mob/living/to_be_dunked = source + if(ishuman(source) ||to_be_dunked.client) + log_and_message_admins("[source] was thrown into \the [src]", null) + source.forceMove(src) + visible_message("\The [source] lands in \the [src].") /obj/machinery/disposal/wall name = "inset disposal unit" diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index d7536808b27..f73dd14de94 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -28,18 +28,18 @@ AM.forceMove(src) flush() -/obj/machinery/disposal/deliveryChute/hitby(atom/movable/AM) - if(!QDELETED(AM) || (istype(AM, /obj/item) || istype(AM, /mob/living)) && !istype(AM, /obj/item/projectile)) +/obj/machinery/disposal/deliveryChute/hitby(atom/movable/source) + if(!QDELETED(source) || (isitem(source) || isliving(source)) && !istype(source, /obj/item/projectile)) switch(dir) if(NORTH) - if(AM.loc.y != src.loc.y+1) return ..() + if(source.loc.y != src.loc.y+1) return ..() if(EAST) - if(AM.loc.x != src.loc.x+1) return ..() + if(source.loc.x != src.loc.x+1) return ..() if(SOUTH) - if(AM.loc.y != src.loc.y-1) return ..() + if(source.loc.y != src.loc.y-1) return ..() if(WEST) - if(AM.loc.x != src.loc.x-1) return ..() - AM.forceMove(src) + if(source.loc.x != src.loc.x-1) return ..() + source.forceMove(src) flush() /obj/machinery/disposal/deliveryChute/attackby(var/obj/item/I, var/mob/user) diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index bd6d01ba7f3..538a224c728 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -91,16 +91,21 @@ qdel(src) -/obj/machinery/shield/hitby(AM as mob|obj) +/obj/machinery/shield/hitby(atom/movable/source) //Let everyone know we've been hit! - visible_message(span_danger("\The [src] was hit by [AM].")) + visible_message(span_danger("\The [src] was hit by [source].")) //Super realistic, resource-intensive, real-time damage calculations. var/tforce = 0 - if(ismob(AM)) + if(ismob(source)) tforce = 40 - else - tforce = AM:throwforce + if(isobj(source)) + var/obj/object = source + if(isitem(object)) + var/obj/item/our_item = object + tforce = our_item.throwforce + else + tforce = object.w_class src.health -= tforce