diff --git a/code/game/atoms.dm b/code/game/atoms.dm index a27ffc4946e8c..9b7c823e51424 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -444,6 +444,7 @@ directive is properly returned. /atom/proc/hitby(atom/movable/AM, speed = 5) if(density) AM.stop_throw() + return TRUE /atom/proc/GenerateTag() diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index f1c763899851f..0b84010641dc6 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -311,7 +311,7 @@ return COMPONENT_BUMP_RESOLVED . = ..() if(throwing) - . = throw_impact(A) + . = !throw_impact(A) if(QDELETED(A)) return A.Bumped(src) @@ -469,19 +469,16 @@ for(var/atom/movable/location AS in nested_locs) LAZYORASSOCLIST(location.important_recursive_contents, channel, arrived.important_recursive_contents[channel]) -//called when src is thrown into hit_atom +///called when src is thrown into hit_atom /atom/movable/proc/throw_impact(atom/hit_atom, speed, bounce = TRUE) - if(isliving(hit_atom)) - var/mob/living/M = hit_atom - M.hitby(src, speed) - - else - var/old_throw_source = throw_source - hit_atom.hitby(src, speed) - if(bounce && hit_atom.density) + var/hit_successful + var/old_throw_source = throw_source + hit_successful = hit_atom.hitby(src, speed) + if(hit_successful) + SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom) + if(bounce && hit_atom.density && !isliving(hit_atom)) INVOKE_NEXT_TICK(src, PROC_REF(throw_bounce), hit_atom, old_throw_source) - - SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom) + return hit_successful //if the throw missed, it continues ///Bounces the AM off hit_atom /atom/movable/proc/throw_bounce(atom/hit_atom, turf/old_throw_source) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index d4a25f65c59a9..081c2e22a5293 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -332,7 +332,7 @@ GLOBAL_DATUM_INIT(welding_sparks_prepdoor, /mutable_appearance, mutable_appearan ///When hit by a thrown object, play the associated hitsound of the object /obj/item/throw_impact(atom/hit_atom, speed, bounce) . = ..() - if(isliving(hit_atom)) + if(. && isliving(hit_atom)) playsound(src, hitsound, 50) // apparently called whenever an item is removed from a slot, container, or anything else. diff --git a/code/game/objects/items/explosives/grenades/marines.dm b/code/game/objects/items/explosives/grenades/marines.dm index 2b270929f6c14..aee05af094db1 100644 --- a/code/game/objects/items/explosives/grenades/marines.dm +++ b/code/game/objects/items/explosives/grenades/marines.dm @@ -86,8 +86,10 @@ /obj/item/explosive/grenade/sticky/throw_impact(atom/hit_atom, speed) . = ..() + if(!.) + return if(!active || stuck_to || isturf(hit_atom)) - return TRUE + return var/image/stuck_overlay = image(icon, hit_atom, initial(icon_state) + "_stuck") stuck_overlay.pixel_x = rand(-5, 5) stuck_overlay.pixel_y = rand(-7, 7) @@ -129,7 +131,7 @@ /obj/item/explosive/grenade/sticky/trailblazer/throw_impact(atom/hit_atom, speed) . = ..() - if(.) + if(!.) return RegisterSignal(stuck_to, COMSIG_MOVABLE_MOVED, PROC_REF(make_fire)) var/turf/T = get_turf(src) @@ -171,7 +173,7 @@ /obj/item/explosive/grenade/sticky/cloaker/throw_impact(atom/hit_atom, speed) . = ..() - if(.) + if(!.) return RegisterSignal(stuck_to, COMSIG_MOVABLE_MOVED, PROC_REF(make_smoke)) @@ -239,6 +241,8 @@ /obj/item/explosive/grenade/incendiary/molotov/throw_impact(atom/hit_atom, speed, bounce = TRUE) . = ..() + if(!.) + return if(!hit_atom.density || prob(35)) return prime() @@ -411,6 +415,8 @@ /obj/item/explosive/grenade/impact/throw_impact(atom/hit_atom, speed) . = ..() + if(!.) + return if(launched && active && !istype(hit_atom, /turf/open)) //Only contact det if active, we actually hit something, and we're fired from a grenade launcher. explosion(loc, light_impact_range = 1, flash_range = 2) qdel(src) @@ -522,6 +528,8 @@ /obj/item/explosive/grenade/flare/throw_impact(atom/hit_atom, speed) . = ..() + if(!.) + return if(!active) return @@ -592,6 +600,8 @@ /obj/item/explosive/grenade/flare/strongerflare/throw_impact(atom/hit_atom, speed) . = ..() + if(!.) + return anchored = TRUE//prevents marines from picking up and running around with a stronger flare /obj/item/explosive/grenade/flare/strongerflare/update_brightness() diff --git a/code/game/objects/items/reagent_containers/food/piecake.dm b/code/game/objects/items/reagent_containers/food/piecake.dm index 85a5ff3ab7772..cb94b3f36de7b 100644 --- a/code/game/objects/items/reagent_containers/food/piecake.dm +++ b/code/game/objects/items/reagent_containers/food/piecake.dm @@ -22,7 +22,9 @@ bitesize = 3 /obj/item/reagent_containers/food/snacks/pastries/pie/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return new /obj/effect/decal/cleanable/pie_smudge(loc) visible_message(span_warning(" [src.name] splats."),span_warning(" You hear a splat.")) qdel(src) diff --git a/code/game/objects/items/reagent_containers/food/snacks.dm b/code/game/objects/items/reagent_containers/food/snacks.dm index b3b4c9ec000c9..0e6a1768d408a 100644 --- a/code/game/objects/items/reagent_containers/food/snacks.dm +++ b/code/game/objects/items/reagent_containers/food/snacks.dm @@ -358,7 +358,9 @@ tastes = list("egg" = 1) /obj/item/reagent_containers/food/snacks/egg/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return new/obj/effect/decal/cleanable/egg_smudge(src.loc) src.reagents.reaction(hit_atom, TOUCH) src.visible_message(span_warning(" [src.name] has been squashed."),span_warning(" You hear a smack.")) diff --git a/code/game/objects/items/reagent_containers/food/snacks/grown.dm b/code/game/objects/items/reagent_containers/food/snacks/grown.dm index 7cde7983b4c23..f5286f2881d8f 100644 --- a/code/game/objects/items/reagent_containers/food/snacks/grown.dm +++ b/code/game/objects/items/reagent_containers/food/snacks/grown.dm @@ -324,7 +324,9 @@ plantname = "tomato" /obj/item/reagent_containers/food/snacks/grown/tomato/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return new/obj/effect/decal/cleanable/tomato_smudge(src.loc) src.visible_message(span_notice("The [src.name] has been squashed."),span_moderate("You hear a smack.")) qdel(src) @@ -348,7 +350,9 @@ plantname = "bloodtomato" /obj/item/reagent_containers/food/snacks/grown/bloodtomato/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return new/obj/effect/decal/cleanable/blood/splatter(src.loc) src.visible_message(span_notice("The [src.name] has been squashed."),span_moderate("You hear a smack.")) src.reagents.reaction(get_turf(hit_atom)) @@ -370,7 +374,9 @@ AddComponent(/datum/component/slippery, 0.8 SECONDS, 0.5 SECONDS) /obj/item/reagent_containers/food/snacks/grown/bluetomato/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return new/obj/effect/decal/cleanable/blood/oil(src.loc) src.visible_message(span_notice("The [src.name] has been squashed."),span_moderate("You hear a smack.")) src.reagents.reaction(get_turf(hit_atom)) @@ -506,7 +512,9 @@ plantname = "bluespacetomato" /obj/item/reagent_containers/food/snacks/grown/bluespacetomato/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return var/mob/M = usr var/outer_teleport_radius = potency/10 //Plant potency determines radius of teleport. var/inner_teleport_radius = potency/15 diff --git a/code/game/objects/items/toys/toys.dm b/code/game/objects/items/toys/toys.dm index 33bb63c978434..e25b26fdc7f35 100755 --- a/code/game/objects/items/toys/toys.dm +++ b/code/game/objects/items/toys/toys.dm @@ -84,6 +84,9 @@ /obj/item/toy/balloon/throw_impact(atom/hit_atom) + . = ..() + if(!.) + return if(src.reagents.total_volume >= 1) src.visible_message(span_warning(" The [src] bursts!"),"You hear a pop and a splash.") src.reagents.reaction(get_turf(hit_atom), TOUCH) @@ -174,7 +177,9 @@ AddElement(/datum/element/connect_loc, connections) /obj/item/toy/snappop/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread s.set_up(3, 1, src) s.start() diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 9368e5d3ce9cb..18fa517f877ef 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -288,9 +288,6 @@ transform = rotate_me return ..() -/obj/item/weapon/twohanded/spear/throw_impact(atom/hit_atom, speed, bounce = FALSE) - . = ..() - /obj/item/weapon/twohanded/spear/pickup(mob/user) . = ..() if(initial(current_angle) == current_angle) diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index bc38a9fb3f5ab..8f229a32f3384 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -89,6 +89,8 @@ /obj/hitby(atom/movable/AM, speed = 5) . = ..() + if(!.) + return if(!anchored && (move_resist < MOVE_FORCE_STRONG)) step(src, AM.dir) visible_message(span_warning("[src] was hit by [AM]."), visible_message_flags = COMBAT_MESSAGE) diff --git a/code/game/turfs/closed.dm b/code/game/turfs/closed.dm index 7857e717f4980..1416dfff5eaaa 100644 --- a/code/game/turfs/closed.dm +++ b/code/game/turfs/closed.dm @@ -19,6 +19,7 @@ /turf/closed/hitby(atom/movable/AM, speed = 5) AM.stop_throw() AM.turf_collision(src, speed) + return TRUE /turf/closed/mineral name = "rock" diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 0f3dbf2aae507..20e961ead7085 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -140,6 +140,8 @@ /obj/item/assembly/infra/throw_impact(atom/hit_atom) . = ..() + if(!.) + return if(!olddir) return setDir(olddir) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 45338defd3171..f5b046043353f 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -144,6 +144,9 @@ GLOBAL_LIST_INIT(hallucination_list, list( name = "Mature Runner ([rand(100, 999)])" /obj/effect/hallucination/simple/xeno/throw_impact(atom/hit_atom, speed) + . = ..() + if(!.) + return if(hit_atom == target && target.stat != DEAD) target.Paralyze(3 SECONDS, TRUE, TRUE) target.visible_message(span_danger("[target] flails around wildly."),span_xenowarning("\The [src] pounces at [target]!")) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index caeec8371e34d..7d967feef2388 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -242,7 +242,7 @@ Contains most of the procs that are called when a mob is attacked by something throw_mode_off() if(living_thrower) log_combat(living_thrower, src, "thrown at", thrown_item, "(FAILED: caught)") - return + return TRUE throw_damage = thrown_item.throwforce * speed * 0.2 @@ -259,7 +259,7 @@ Contains most of the procs that are called when a mob is attacked by something visible_message(span_notice(" \The [thrown_item] misses [src] narrowly!"), null, null, 5) if(living_thrower) log_combat(living_thrower, src, "thrown at", thrown_item, "(FAILED: missed)") - return + return FALSE if(thrown_item.thrower != src) throw_damage = check_shields(COMBAT_MELEE_ATTACK, throw_damage, MELEE) @@ -268,13 +268,13 @@ Contains most of the procs that are called when a mob is attacked by something visible_message(span_danger("[src] deflects \the [thrown_item]!")) if(living_thrower) log_combat(living_thrower, src, "thrown at", thrown_item, "(FAILED: shield blocked)") - return + return TRUE var/datum/limb/affecting = get_limb(zone) if(affecting.limb_status & LIMB_DESTROYED) log_combat(living_thrower, src, "thrown at", thrown_item, "(FAILED: target limb missing)") - return + return FALSE thrown_item.stop_throw() // Hit the limb. var/applied_damage = modify_by_armor(throw_damage, MELEE, thrown_item.penetration, zone) @@ -282,7 +282,7 @@ Contains most of the procs that are called when a mob is attacked by something if(applied_damage <= 0) visible_message(span_notice("\The [thrown_item] bounces on [src]'s armor!"), null, null, 5) log_combat(living_thrower, src, "thrown at", thrown_item, "(FAILED: armor blocked)") - return + return TRUE visible_message(span_warning("[src] has been hit in the [affecting.display_name] by \the [thrown_item]."), null, null, 5) @@ -307,14 +307,15 @@ Contains most of the procs that are called when a mob is attacked by something throw_at(get_edge_target_turf(src, get_dir(AM.throw_source, src)), 1, speed * 0.5) hit_report += "(thrown away)" - if(!living_thrower) - return - log_combat(living_thrower, src, "thrown at", AM, "[hit_report.Join(" ")]") - if(throw_damage && !living_thrower.mind?.bypass_ff && !mind?.bypass_ff && living_thrower.faction == faction) - var/turf/T = get_turf(src) - living_thrower.ff_check(throw_damage, src) - log_ffattack("[key_name(living_thrower)] hit [key_name(src)] with \the [AM] (thrown) in [AREACOORD(T)] [hit_report.Join(" ")].") - msg_admin_ff("[ADMIN_TPMONTY(living_thrower)] hit [ADMIN_TPMONTY(src)] with \the [AM] (thrown) in [ADMIN_VERBOSEJMP(T)] [hit_report.Join(" ")].") + if(living_thrower) + log_combat(living_thrower, src, "thrown at", AM, "[hit_report.Join(" ")]") + if(throw_damage && !living_thrower.mind?.bypass_ff && !mind?.bypass_ff && living_thrower.faction == faction) + var/turf/T = get_turf(src) + living_thrower.ff_check(throw_damage, src) + log_ffattack("[key_name(living_thrower)] hit [key_name(src)] with \the [AM] (thrown) in [AREACOORD(T)] [hit_report.Join(" ")].") + msg_admin_ff("[ADMIN_TPMONTY(living_thrower)] hit [ADMIN_TPMONTY(src)] with \the [AM] (thrown) in [ADMIN_VERBOSEJMP(T)] [hit_report.Join(" ")].") + + return TRUE /mob/living/carbon/human/resist_fire(datum/source) diff --git a/code/modules/mob/living/carbon/xenomorph/facehuggers.dm b/code/modules/mob/living/carbon/xenomorph/facehuggers.dm index 0ea3a3c30be99..fb4020c0f5a72 100644 --- a/code/modules/mob/living/carbon/xenomorph/facehuggers.dm +++ b/code/modules/mob/living/carbon/xenomorph/facehuggers.dm @@ -245,12 +245,8 @@ if(stat != CONSCIOUS) //need to be active to leap return - for(var/check_smoke in get_turf(src)) //Check for pacifying smoke - if(!istype(check_smoke, /obj/effect/particle_effect/smoke/xeno)) - continue - - var/obj/effect/particle_effect/smoke/xeno/xeno_smoke = check_smoke - if(CHECK_BITFIELD(xeno_smoke.smoke_traits, SMOKE_HUGGER_PACIFY)) //Cancel out and make the hugger go idle if we have the xeno pacify tag + for(var/obj/effect/particle_effect/smoke/check_smoke in get_turf(src)) //Check for pacifying smoke + if(CHECK_BITFIELD(check_smoke.smoke_traits, SMOKE_HUGGER_PACIFY)) //Cancel out and make the hugger go idle if we have the xeno pacify tag go_idle() return @@ -358,40 +354,38 @@ update_icon() /obj/item/clothing/mask/facehugger/throw_impact(atom/hit_atom, speed) + if(isopenturf(hit_atom)) + leaping = FALSE + go_idle() + return FALSE . = ..() + if(!.) + return if(stat != CONSCIOUS) return - if(iscarbon(hit_atom)) - var/mob/living/carbon/M = hit_atom - if(loc == M) //Caught - update_icon() - pre_leap(impact_time) - else if(leaping && M.can_be_facehugged(src)) //Standard leaping behaviour, not attributable to being _thrown_ such as by a Carrier. - if(!Attach(M)) - go_idle() - return - else - step(src, REVERSE_DIR(dir)) //We want the hugger to bounce off if it hits a mob. - update_icon() - if(!issamexenohive(M)) //If the target is not friendly, stagger and slow it, and activate faster. - M.adjust_stagger(3 SECONDS) //Apply stagger and slowdown so the carrier doesn't have to suicide when going for direct hugger hits. - M.add_slowdown(3) - pre_leap(impact_time) //Go into the universal leap set up proc - return - - pre_leap(activate_time) //Go into the universal leap set up proc - return + if(!iscarbon(hit_atom)) + leaping = FALSE + go_idle() + return + + var/mob/living/carbon/M = hit_atom + if(loc == M) //Caught + pre_leap(impact_time) + else if(leaping && M.can_be_facehugged(src)) //Standard leaping behaviour, not attributable to being _thrown_ such as by a Carrier. + if(!Attach(M)) + go_idle() else - if(leaping) - for(var/mob/living/carbon/M in loc) - if(M.can_be_facehugged(src)) - if(!Attach(M)) - go_idle() - return - stop_throw() + step(src, REVERSE_DIR(dir)) + if(!issamexenohive(M)) + M.adjust_stagger(3 SECONDS) + M.add_slowdown(3) + pre_leap(activate_time) + leaping = FALSE - go_idle(FALSE) +/obj/item/clothing/mask/facehugger/stop_throw(flying, original_layer) + . = ..() + update_icon() ////////////////////// // FACEHUG CHECKS diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 71bf25022218f..e9d7b145fdc17 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -436,6 +436,9 @@ return if(!client) return + var/mob/mob_to_push = AM + if(istype(mob_to_push) && mob_to_push.lying_angle) + return now_pushing = TRUE var/dir_to_target = get_dir(src, AM) @@ -456,7 +459,6 @@ if(force_push(AM, move_force, dir_to_target, push_anchored)) push_anchored = TRUE if(ismob(AM)) - var/mob/mob_to_push = AM var/atom/movable/mob_buckle = mob_to_push.buckled // If we can't pull them because of what they're buckled to, make sure we can push the thing they're buckled to instead. // If neither are true, we're not pushing anymore. diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index f65a96cdb73fe..af7dd52439ebe 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -9,6 +9,7 @@ //this proc handles being hit by a thrown atom /mob/living/hitby(atom/movable/AM, speed = 5) + . = TRUE if(isliving(AM)) var/mob/living/thrown_mob = AM if(thrown_mob.mob_size >= mob_size) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 183ae6c4f03cf..f03e2ac120513 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -570,7 +570,9 @@ var/brightness = 2 //how much light it gives off /obj/item/light_bulb/throw_impact(atom/hit_atom) - ..() + . = ..() + if(!.) + return shatter() /obj/item/light_bulb/tube