diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index d86f0351d75..9cb3d4945e5 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -128,7 +128,7 @@ var/const/tk_maxrange = 15 else apply_focus_overlay() - focus.throw_at(target, 10, 1) + focus.throw_at(target, 10, 1,user) last_throw = world.time return diff --git a/code/datums/martial.dm b/code/datums/martial.dm index 8c5c136980e..a1c92bd97d0 100644 --- a/code/datums/martial.dm +++ b/code/datums/martial.dm @@ -225,7 +225,7 @@ "[A] has hit [D] with Plasma Punch!") playsound(D.loc, 'sound/weapons/punch1.ogg', 50, 1, -1) var/atom/throw_target = get_edge_target_turf(D, get_dir(D, get_step_away(D, A))) - D.throw_at(throw_target, 200, 4) + D.throw_at(throw_target, 200, 4,A) A.say("HYAH!") return diff --git a/code/datums/spells/wizard.dm b/code/datums/spells/wizard.dm index d6cdfe7c872..f7624463fe0 100644 --- a/code/datums/spells/wizard.dm +++ b/code/datums/spells/wizard.dm @@ -343,4 +343,4 @@ var/mob/living/M = AM M.Weaken(2) M << "You're thrown back by a mystical force!" - spawn(0) AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time. \ No newline at end of file + spawn(0) AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1,user)//So stuff gets tossed around at the same time. \ No newline at end of file diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f6a52f40e54..52ac867c334 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -55,10 +55,10 @@ return 0 -/atom/proc/throw_impact(atom/hit_atom) +/atom/proc/throw_impact(atom/hit_atom,mob/thrower) if(istype(hit_atom,/mob/living)) var/mob/living/M = hit_atom - M.hitby(src) + M.hitby(src,thrower) else if(isobj(hit_atom)) var/obj/O = hit_atom diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 41ebb2b02b2..f0083db4d8b 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -154,13 +154,13 @@ /atom/movable/proc/checkpass(passflag) return pass_flags&passflag -/atom/movable/proc/hit_check() // todo: this is partly obsolete due to passflags already, add throwing stuff to mob CanPass and finish it +/atom/movable/proc/hit_check(mob/thrower) // todo: this is partly obsolete due to passflags already, add throwing stuff to mob CanPass and finish it if(src.throwing) for(var/atom/A in get_turf(src)) if(A == src) continue if(istype(A,/mob/living)) if(A:lying) continue - src.throw_impact(A) + src.throw_impact(A,thrower) if(src.throwing == 1) src.throwing = 0 if(isobj(A)) @@ -168,7 +168,7 @@ src.throw_impact(A) src.throwing = 0 -/atom/movable/proc/throw_at(atom/target, range, speed) +/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower) if(!target || !src || (flags & NODROP)) return 0 //use a modified version of Bresenham's algorithm to get from the atom's current position to that of the target @@ -203,7 +203,7 @@ if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge break src.Move(step, get_dir(loc, step)) - hit_check() + hit_check(thrower) error += (error < 0) ? tdist_x : -tdist_y; dist_travelled++ dist_since_sleep++ diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index e6daa56cf5f..b71cb447ff7 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -81,8 +81,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s var/flags_cover = 0 //for flags such as GLASSESCOVERSEYES -/obj/item/proc/check_allowed_items(atom/target, not_inside) - if((src in target) || ((!istype(target.loc, /turf)) && (!istype(target, /turf)) && (not_inside)) || is_type_in_list(target, can_be_placed_into)) +/obj/item/proc/check_allowed_items(atom/target, not_inside, target_self) + if(((src in target) && !target_self) || ((!istype(target.loc, /turf)) && (!istype(target, /turf)) && (not_inside)) || is_type_in_list(target, can_be_placed_into)) return 0 else return 1 diff --git a/code/game/objects/items/weapons/pneumaticCannon.dm b/code/game/objects/items/weapons/pneumaticCannon.dm index c501d6fc5e9..56e9da2f999 100644 --- a/code/game/objects/items/weapons/pneumaticCannon.dm +++ b/code/game/objects/items/weapons/pneumaticCannon.dm @@ -92,7 +92,7 @@ loadedWeightClass -= ITD.w_class ITD.throw_speed = pressureSetting * 2 ITD.loc = get_turf(src) - ITD.throw_at(target, pressureSetting * 5, pressureSetting * 2) + ITD.throw_at(target, pressureSetting * 5, pressureSetting * 2,user) if(pressureSetting >= 3) user << "\The [src]'s recoil knocks you down!" user.Weaken(2) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 71d40ca2dd4..79114808580 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -228,6 +228,16 @@ if (M.m_intent=="walk" && (lube&NO_SLIP_WHEN_WALKING)) return 0 if(!M.lying && (M.status_flags & CANWEAKEN)) // we slip those who are standing and can fall. + if(O) + M << "You slipped on the [O.name]!" + else + M << "You slipped!" + M.attack_log += "\[[time_stamp()]\] Slipped[O ? " on the [O.name]" : ""][(lube&SLIDE)? " (LUBE)" : ""]!" + playsound(M.loc, 'sound/misc/slip.ogg', 50, 1, -3) + + M.accident(M.l_hand) + M.accident(M.r_hand) + var/olddir = M.dir M.Stun(s_amount) M.Weaken(w_amount) @@ -239,11 +249,9 @@ M.spin(1,1) if(M.lying) //did I fall over? M.adjustBruteLoss(2) - if(O) - M << "You slipped on the [O.name]!" - else - M << "You slipped!" - playsound(M.loc, 'sound/misc/slip.ogg', 50, 1, -3) + + + return 1 return 0 // no success. Used in clown pda and wet floors diff --git a/code/modules/admin/verbs/buildmode.dm b/code/modules/admin/verbs/buildmode.dm index d06bd7e61c8..a3912ae24c0 100644 --- a/code/modules/admin/verbs/buildmode.dm +++ b/code/modules/admin/verbs/buildmode.dm @@ -189,10 +189,10 @@ var/type = input(usr,"Select Generator Type","Type") as null|anything in gen_paths if(!type) return - + master.generator_path = type master.cornerA = null - master.cornerB = null + master.cornerB = null return 1 @@ -292,7 +292,7 @@ holder.throw_atom = object if(pa.Find("right")) if(holder.throw_atom) - holder.throw_atom.throw_at(object, 10, 1) + holder.throw_atom.throw_at(object, 10, 1,user) log_admin("Build Mode: [key_name(usr)] threw [holder.throw_atom] at [object] ([object.x],[object.y],[object.z])") if(AREA_BUILDMODE) if(!holder.cornerA) @@ -300,7 +300,7 @@ return if(holder.cornerA && !holder.cornerB) holder.cornerB = get_turf(object) - + if(pa.Find("left")) //rectangular if(holder.cornerA && holder.cornerB) if(!holder.generator_path) diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 379adeecace..6058b09be26 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -104,7 +104,7 @@ H.update_icon() source.visible_message("\The [source] deals a card to \the [target].") - H.throw_at(get_step(target, target.dir), 10, 1, H) + H.throw_at(get_step(target, target.dir), 10, 1, source) /* Hand */ diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 937d13e4ec4..d43041dac13 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -278,7 +278,7 @@ newtonian_move(get_dir(target, src)) - item.throw_at(target, item.throw_range, item.throw_speed) + item.throw_at(target, item.throw_range, item.throw_speed, src) /mob/living/carbon/can_use_hands() if(handcuffed) @@ -507,3 +507,31 @@ var/const/GALOSHES_DONT_HELP = 8 /mob/living/carbon/check_ear_prot() if(head && (head.flags & HEADBANGPROTECT)) return 1 + +/mob/living/carbon/proc/accident(var/obj/item/I) + if(!I || (I.flags & NODROP)) + return + + unEquip(I) + + var/modifier = 0 + if(disabilities & CLUMSY) + modifier -= 40 //Clumsy people are more likely to hit themselves -Honk! + + switch(rand(1,100)+modifier) //91-100=Nothing special happens + if(-INFINITY to 0) //attack yourself + I.attack(src,src) + if(1 to 30) //throw it at yourself + I.throw_impact(src) + if(31 to 60) //Throw object in facing direction + var/turf/target = get_turf(loc) + var/range = rand(2,I.throw_range) + for(var/i = 1; i < range; i++) + var/turf/new_turf = get_step(target, dir) + target = new_turf + if(new_turf.density) + break + I.throw_at(target,I.throw_range,I.throw_speed,src) + if(61 to 90) //throw it down to the floor + var/turf/target = get_turf(loc) + I.throw_at(target,I.throw_range,I.throw_speed,src) \ No newline at end of file diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index af8b231f78a..d050141cd8d 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -44,7 +44,7 @@ else return 0 -/mob/living/hitby(atom/movable/AM)//Standardization and logging -Sieve +/mob/living/hitby(atom/movable/AM,mob/thrower)//Standardization and logging -Sieve if(istype(AM, /obj/item)) var/obj/item/I = AM var/zone = ran_zone("chest", 65)//Hits a random part of the body, geared towards the chest @@ -71,12 +71,9 @@ "[src] has been hit by [I].") var/armor = run_armor_check(zone, "melee", "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].",I.armour_penetration) apply_damage(I.throwforce, dtype, zone, armor, I) - if(!I.fingerprintslast) - return - var/client/assailant = directory[ckey(I.fingerprintslast)] - if(assailant && assailant.mob && istype(assailant.mob,/mob)) - var/mob/M = assailant.mob - add_logs(M, src, "hit", object="[I]") + + if(thrower) + add_logs(thrower, src, "hit", object="[I]") /mob/living/mech_melee_attack(obj/mecha/M) if(M.occupant.a_intent == "harm") diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_sword_recall.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_sword_recall.dm index c117cd40d8e..fb38a3fbdd7 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_sword_recall.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_sword_recall.dm @@ -41,7 +41,7 @@ energyKatana.spark_system.start() playsound(H, "sparks", 50, 1) H.visible_message("\the [energyKatana] flies towards [H]!","You hold out your hand and \the [energyKatana] flies towards you!") - energyKatana.throw_at(H, distance+1, energyKatana.throw_speed) + energyKatana.throw_at(H, distance+1, energyKatana.throw_speed,H) else //Else just TP it to us. energyKatana.returnToOwner(H,1) diff --git a/code/modules/projectiles/guns/grenade_launcher.dm b/code/modules/projectiles/guns/grenade_launcher.dm index 0853efd907f..20fa083d6e0 100644 --- a/code/modules/projectiles/guns/grenade_launcher.dm +++ b/code/modules/projectiles/guns/grenade_launcher.dm @@ -51,7 +51,7 @@ var/obj/item/weapon/grenade/chem_grenade/F = grenades[1] //Now with less copypasta! grenades -= F F.loc = user.loc - F.throw_at(target, 30, 2) + F.throw_at(target, 30, 2,user) message_admins("[key_name_admin(user)] fired a grenade ([F.name]) from a grenade launcher ([src.name]).") log_game("[key_name(user)] fired a grenade ([F.name]) from a grenade launcher ([src.name]).") F.active = 1 diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index c3108ddeb0c..76c234716ca 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -76,4 +76,35 @@ /obj/item/weapon/reagent_containers/fire_act() reagents.chem_temp += 30 reagents.handle_reactions() - ..() \ No newline at end of file + ..() + +/obj/item/weapon/reagent_containers/throw_impact(atom/target,mob/thrower) + ..() + + if(!reagents.total_volume || !is_open_container()) + return + + if(ismob(target) && target.reagents) + reagents.total_volume *= rand(5,10) * 0.1 //Not all of it makes contact with the target + var/mob/M = target + var/R + target.visible_message("[M] has been splashed with something!", \ + "[M] has been splashed with something!") + if(reagents) + for(var/datum/reagent/A in reagents.reagent_list) + R += A.id + " (" + R += num2text(A.volume) + ")," + + if(thrower) + add_logs(thrower, M, "splashed", object="[R]") + reagents.reaction(target, TOUCH) + + else if(!target.density || target.throwpass) + if(thrower && thrower.mind && thrower.mind.assigned_role == "Bartender") + visible_message("[src] lands onto the [target.name] without spilling a single drop.") + return + + else + visible_message("[src] spills its contents all over [target].") + reagents.reaction(target, TOUCH) + reagents.clear_reagents() diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index f454e23ef49..f4be6cdd2d4 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -34,7 +34,7 @@ /obj/item/weapon/reagent_containers/glass/afterattack(obj/target, mob/user, proximity) - if((!proximity) || !check_allowed_items(target)) return + if((!proximity) || !check_allowed_items(target,1)) return if(ismob(target) && target.reagents && reagents.total_volume) var/mob/M = target diff --git a/html/changelogs/ikarrus-workplacesafety.yml b/html/changelogs/ikarrus-workplacesafety.yml new file mode 100644 index 00000000000..bace06864d8 --- /dev/null +++ b/html/changelogs/ikarrus-workplacesafety.yml @@ -0,0 +1,6 @@ +author: Ikarrus +delete-after: True + +changes: + - rscadd: "Throwing reagent containers such as drinks or beakers may spill their contents onto whatever they hit" + - rscadd: "Slipping while carrying items in your hand may cause ~accidents~" \ No newline at end of file