Merge pull request #10244 from Ikarrus/workplacesafety

Workplace "Accidents"
This commit is contained in:
Razharas
2015-07-03 05:05:36 +03:00
17 changed files with 104 additions and 34 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -225,7 +225,7 @@
"<span class='userdanger'>[A] has hit [D] with Plasma Punch!</span>")
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
+1 -1
View File
@@ -343,4 +343,4 @@
var/mob/living/M = AM
M.Weaken(2)
M << "<span class='userdanger'>You're thrown back by a mystical force!</span>"
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.
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.
+2 -2
View File
@@ -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
+4 -4
View File
@@ -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++
+2 -2
View File
@@ -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
@@ -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 << "<span class='boldannounce'>\The [src]'s recoil knocks you down!</span>"
user.Weaken(2)
+13 -5
View File
@@ -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 << "<span class='notice'>You slipped on the [O.name]!</span>"
else
M << "<span class='notice'>You slipped!</span>"
M.attack_log += "\[[time_stamp()]\] <font color='orange'>Slipped[O ? " on the [O.name]" : ""][(lube&SLIDE)? " (LUBE)" : ""]!</font>"
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 << "<span class='notice'>You slipped on the [O.name]!</span>"
else
M << "<span class='notice'>You slipped!</span>"
playsound(M.loc, 'sound/misc/slip.ogg', 50, 1, -3)
return 1
return 0 // no success. Used in clown pda and wet floors
+4 -4
View File
@@ -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)
+1 -1
View File
@@ -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 */
+29 -1
View File
@@ -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)
+4 -7
View File
@@ -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 @@
"<span class='userdanger'>[src] has been hit by [I].</span>")
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")
@@ -41,7 +41,7 @@
energyKatana.spark_system.start()
playsound(H, "sparks", 50, 1)
H.visible_message("<span class='danger'>\the [energyKatana] flies towards [H]!</span>","<span class='warning'>You hold out your hand and \the [energyKatana] flies towards you!</span>")
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)
@@ -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
+32 -1
View File
@@ -76,4 +76,35 @@
/obj/item/weapon/reagent_containers/fire_act()
reagents.chem_temp += 30
reagents.handle_reactions()
..()
..()
/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("<span class='danger'>[M] has been splashed with something!</span>", \
"<span class='userdanger'>[M] has been splashed with something!</span>")
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("<span class='notice'>[src] lands onto the [target.name] without spilling a single drop.</span>")
return
else
visible_message("<span class='notice'>[src] spills its contents all over [target].</span>")
reagents.reaction(target, TOUCH)
reagents.clear_reagents()
@@ -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
@@ -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~"