Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into RingRingHello

This commit is contained in:
Aurorablade
2018-03-25 23:15:37 -04:00
329 changed files with 9590 additions and 2396 deletions

View File

@@ -127,9 +127,7 @@
if(A == loc || (A in loc) || (sdepth != -1 && sdepth <= 2))
// No adjacency needed
if(W)
var/resolved = A.attackby(W,src)
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1 indicates adjacency
W.melee_attack_chain(src, A, params)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
@@ -145,10 +143,7 @@
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
if(A.Adjacent(src)) // see adjacent.dm
if(W)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example, params)
var/resolved = A.attackby(W,src,params)
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1: clicking something Adjacent
W.melee_attack_chain(src, A, params)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)

View File

@@ -81,10 +81,7 @@
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents)
if(A == loc || (A in loc) || (A in contents))
// No adjacency checks
var/resolved = A.attackby(W,src,params, params)
if(!resolved && A && W)
W.afterattack(A,src,1,params)
W.melee_attack_chain(src, A, params)
return
if(!isturf(loc))
@@ -93,9 +90,7 @@
// cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc))
if(isturf(A) || isturf(A.loc))
if(A.Adjacent(src)) // see adjacent.dm
var/resolved = A.attackby(W, src, params, params)
if(!resolved && A && W)
W.afterattack(A, src, 1, params)
W.melee_attack_chain(src, A, params)
return
else
W.afterattack(A, src, 0, params)

View File

@@ -16,6 +16,9 @@
var/datum/hud/hud = null
appearance_flags = NO_CLIENT_COLOR
/obj/screen/take_damage()
return
/obj/screen/Destroy()
master = null
return ..()

View File

@@ -1,36 +1,33 @@
/obj/item/proc/melee_attack_chain(mob/user, atom/target, params)
if(pre_attackby(target, user, params))
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = target.attackby(src, user, params)
if(!resolved && target && !qdeleted(src))
afterattack(target, user, 1, params) // 1: clicking something Adjacent
// Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown.
/obj/item/proc/attack_self(mob/user)
return
/obj/item/proc/pre_attackby(atom/A, mob/living/user, params) //do stuff before attackby!
return TRUE //return FALSE to avoid calling attackby after this proc does stuff
// No comment
/atom/proc/attackby(obj/item/W, mob/living/user, params)
/atom/proc/attackby(obj/item/W, mob/user, params)
return
/atom/movable/attackby(obj/item/W, mob/living/user, params)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
if(!(W.flags&NOBLUDGEON))
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
/obj/attackby(obj/item/I, mob/living/user, params)
return I.attack_obj(src, user)
/mob/living/attackby(obj/item/I, mob/user, params)
/mob/living/attackby(obj/item/I, mob/living/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(attempt_harvest(I, user))
return
I.attack(src, user)
return 1
return I.attack(src, user)
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
// Click parameters is the params string from byond Click() code, see that documentation.
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
return
/obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone)
if(!istype(M)) // not sure if this is the right thing...
/obj/item/proc/attack(mob/living/M, mob/living/user, def_zone)
if(flags & (NOBLUDGEON))
return 0
var/messagesource = M
if(can_operate(M)) //Checks if mob is lying down on table for surgery
if(istype(src,/obj/item/robot_parts))//popup override for direct attach
@@ -46,7 +43,7 @@
else
return 1
if(istype(src,/obj/item/weapon/screwdriver) && M.get_species() == "Machine")
if(isscrewdriver(src) && M.get_species() == "Machine")
if(!attempt_initiate_surgery(src, M, user))
return 0
else
@@ -57,136 +54,87 @@
else
return 1
if(istype(M,/mob/living/carbon/brain))
var/mob/living/carbon/brain/B = M
messagesource = B.container
if(hitsound && force > 0)
playsound(loc, hitsound, 50, 1, -1)
/////////////////////////
if(!force)
playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)
else if(hitsound)
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
user.lastattacked = M
M.lastattacker = user
add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
if(user != M)
user.do_attack_animation(M)
M.attacked_by(src, user, def_zone)
/////////////////////////
if(isanimal(M))
var/mob/living/simple_animal/S = M
S.attacked_by(src, user)
return 0 // No sanic-speed double-attacks for you - simple mobs will handle being attacked on their own
var/power = force
if(!istype(M, /mob/living/carbon/human))
if(istype(M, /mob/living/carbon/slime))
var/mob/living/carbon/slime/slime = M
if(prob(25))
to_chat(user, "<span class='warning'>[src] passes right through [M]!</span>")
return
if(power > 0)
slime.attacked += 10
if(slime.Discipline && prob(50)) // wow, buddy, why am I getting attacked??
slime.Discipline = 0
if(power >= 3)
if(slime.is_adult)
if(prob(5 + round(power/2)))
if(slime.Victim)
if(prob(80) && !slime.client)
slime.Discipline++
slime.Victim = null
slime.anchored = 0
spawn()
if(slime)
slime.SStun = 1
sleep(rand(5,20))
if(slime)
slime.SStun = 0
spawn(0)
if(slime)
slime.canmove = 0
step_away(slime, user)
if(prob(25 + power))
sleep(2)
if(slime && user)
step_away(slime, user)
slime.canmove = 1
else
if(prob(10 + power*2))
if(slime)
if(slime.Victim)
if(prob(80) && !slime.client)
slime.Discipline++
if(slime.Discipline == 1)
slime.attacked = 0
spawn()
if(slime)
slime.SStun = 1
sleep(rand(5,20))
if(slime)
slime.SStun = 0
slime.Victim = null
slime.anchored = 0
spawn(0)
if(slime && user)
step_away(slime, user)
slime.canmove = 0
if(prob(25 + power*4))
sleep(2)
if(slime && user)
step_away(slime, user)
slime.canmove = 1
var/showname = "."
if(user)
showname = " by [user]."
user.do_attack_animation(src)
if(!(user in viewers(M, null)))
showname = "."
for(var/mob/O in viewers(messagesource, null))
if(attack_verb.len)
O.show_message("<span class='combat danger'>[M] has been [pick(attack_verb)] with [src][showname] </span>", 1)
else
O.show_message("<span class='combat danger'>[M] has been attacked with [src][showname] </span>", 1)
if(!showname && user)
if(user.client)
to_chat(user, "<span class='combat danger'>You attack [M] with [src]. </span>")
if(istype(M, /mob/living/carbon/human))
return M:attacked_by(src, user, def_zone) //make sure to return whether we have hit or miss
else
switch(damtype)
if("brute")
if(istype(src, /mob/living/carbon/slime))
M.adjustBrainLoss(power)
else
M.take_organ_damage(power)
if(prob(33)) // Added blood for whacking non-humans too
M.add_splatter_floor()
if("fire")
M.take_organ_damage(0, power)
to_chat(M, "Aargh it burns!")
M.updatehealth()
add_logs(user, M, "attacked", name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", print_attack_log = (force > 0))//print it if stuff deals damage
add_fingerprint(user)
//the equivalent of the standard version of attack() but for object targets.
/obj/item/proc/attack_obj(obj/O, mob/living/user)
if(flags & (NOBLUDGEON))
return
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(O)
O.attacked_by(src, user)
/atom/movable/proc/attacked_by()
return
/obj/attacked_by(obj/item/I, mob/living/user)
if(I.force)
user.visible_message("<span class='danger'>[user] has hit [src] with [I]!</span>", "<span class='danger'>You hit [src] with [I]!</span>")
take_damage(I.force, I.damtype, "melee", 1)
/mob/living/attacked_by(obj/item/I, mob/living/user, def_zone)
send_item_attack_message(I, user)
if(I.force)
apply_damage(I.force, I.damtype, def_zone)
if(I.damtype == BRUTE)
if(prob(33))
I.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
return TRUE //successful attack
/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user)
if(!I.force)
user.visible_message("<span class='warning'>[user] gently taps [src] with [I].</span>",\
"<span class='warning'>This weapon is ineffective, it does no damage!</span>")
else if(I.force < force_threshold || I.damtype == STAMINA)
visible_message("<span class='warning'>[I] bounces harmlessly off of [src].</span>",\
"<span class='warning'>[I] bounces harmlessly off of [src]!</span>")
else
return ..()
// Proximity_flag is 1 if this afterattack was called on something adjacent, in your square, or on your person.
// Click parameters is the params string from byond Click() code, see that documentation.
/obj/item/proc/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
return
/obj/item/proc/get_clamped_volume()
if(w_class)
if(force)
return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
else
return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
if(I.discrete)
return
var/message_verb = "attacked"
if(I.attack_verb && I.attack_verb.len)
message_verb = "[pick(I.attack_verb)]"
else if(!I.force)
return
var/message_hit_area = ""
if(hit_area)
message_hit_area = " in the [hit_area]"
var/attack_message = "[src] has been [message_verb][message_hit_area] with [I]."
if(user in viewers(src, null))
attack_message = "[user] has [message_verb] [src][message_hit_area] with [I]!"
visible_message("<span class='combat danger'>[attack_message]</span>",\
"<span class='combat userdanger'>[attack_message]</span>")
return 1