mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Replaced some attack() overrides with apply_hit_effect() or other attack procs where appropriate. Removed the attack() override from reagent_containers.
65 lines
2.4 KiB
Plaintext
65 lines
2.4 KiB
Plaintext
|
|
// 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
|
|
|
|
//I would prefer to rename this to attack(), but that would involve touching hundreds of files.
|
|
/obj/item/proc/resolve_attackby(atom/A, mob/user)
|
|
add_fingerprint(user)
|
|
return A.attackby(src, user)
|
|
|
|
// No comment
|
|
/atom/proc/attackby(obj/item/W, mob/user)
|
|
return
|
|
|
|
/atom/movable/attackby(obj/item/W, mob/user)
|
|
if(!(W.flags & NOBLUDGEON))
|
|
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
|
|
|
|
/mob/living/attackby(obj/item/I, mob/user)
|
|
if(!ismob(user))
|
|
return 0
|
|
if(can_operate(src) && do_surgery(src,user,I)) //Surgery
|
|
return 1
|
|
return I.attack(src, user, user.zone_sel.selecting)
|
|
|
|
// 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
|
|
|
|
//I would prefer to rename this attack_as_weapon(), but that would involve touching hundreds of files.
|
|
/obj/item/proc/attack(mob/living/M, mob/living/user, var/target_zone)
|
|
if(!force || (flags & NOBLUDGEON))
|
|
return 0
|
|
|
|
/////////////////////////
|
|
user.lastattacked = M
|
|
M.lastattacker = user
|
|
|
|
if(!no_attack_log)
|
|
user.attack_log += "\[[time_stamp()]\]<font color='red'> Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
|
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])</font>"
|
|
msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" )
|
|
/////////////////////////
|
|
|
|
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
|
user.do_attack_animation(M)
|
|
|
|
var/hit_zone = M.resolve_item_attack(src, user, target_zone)
|
|
if(hit_zone)
|
|
apply_hit_effect(M, user, hit_zone)
|
|
|
|
return 1
|
|
|
|
//Called when a weapon is used to make a successful melee attack on a mob.
|
|
/obj/item/proc/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
|
|
if(hitsound)
|
|
playsound(loc, hitsound, 50, 1, -1)
|
|
|
|
var/power = force
|
|
if(HULK in user.mutations)
|
|
power *= 2
|
|
return target.hit_with_weapon(src, user, power, hit_zone)
|
|
|