mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-06 15:32:25 +00:00
Hit things with things with zero force (#10722)
This commit is contained in:
@@ -64,22 +64,41 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/attackby(obj/item/I, mob/living/user)
|
||||
if(I.damtype == PAIN)
|
||||
playsound(loc, 'sound/weapons/tap.ogg', I.get_clamped_volume(), 1, -1)
|
||||
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
|
||||
|
||||
//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 = BP_CHEST)
|
||||
|
||||
if(!force || (flags & NOBLUDGEON))
|
||||
if(flags & NOBLUDGEON)
|
||||
return 0
|
||||
if(M == user && user.a_intent != I_HURT)
|
||||
return 0
|
||||
|
||||
if(user.is_pacified())
|
||||
if(force && user.is_pacified())
|
||||
to_chat(user, "<span class='warning'>You don't want to harm other living beings!</span>")
|
||||
return 0
|
||||
|
||||
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
|
||||
@@ -103,9 +122,6 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
|
||||
//Called when a weapon is used to make a successful melee attack on a mob. Returns the blocked result
|
||||
/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
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
if (istype(W, /obj/item)) //is it even possible to get into attackby() with non-items?
|
||||
var/obj/item/I = W
|
||||
if (I.hitsound)
|
||||
playsound(loc, I.hitsound, 50, 1, -1)
|
||||
playsound(loc, I.hitsound, I.get_clamped_volume(), 1, -1)
|
||||
take_damage(W.force)
|
||||
|
||||
else
|
||||
@@ -450,4 +450,3 @@
|
||||
wires.MendAll()
|
||||
update_icon()
|
||||
update_coverage()
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ for reference:
|
||||
src.health -= W.force * 0.75
|
||||
else
|
||||
animate_shake()
|
||||
playsound(src.loc, material.hitsound, 100, 1)
|
||||
playsound(src.loc, material.hitsound, W.get_clamped_volume(), 1)
|
||||
if (src.health <= 0)
|
||||
visible_message("<span class='danger'>The barricade is smashed apart!</span>")
|
||||
dismantle()
|
||||
|
||||
@@ -365,7 +365,7 @@
|
||||
user.visible_message("<span class='danger'>\The [user] hits \the [src] with \the [W] with no visible effect.</span>")
|
||||
else
|
||||
user.visible_message("<span class='danger'>\The [user] forcefully strikes \the [src] with \the [W]!</span>")
|
||||
playsound(src.loc, hitsound, 100, 1)
|
||||
playsound(src.loc, hitsound, W.get_clamped_volume(), 1)
|
||||
take_damage(W.force)
|
||||
return
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
user.do_attack_animation(src)
|
||||
animate_shake()
|
||||
user.visible_message("<span class='danger'>\The [user] forcefully strikes \the [src] with \the [I]!</span>")
|
||||
playsound(src.loc, material.hitsound, 100, 1)
|
||||
playsound(src.loc, material.hitsound, W.get_clamped_volume(), 1)
|
||||
src.health -= W.force * 1
|
||||
CheckHealth()
|
||||
|
||||
@@ -242,4 +242,4 @@
|
||||
|
||||
/obj/structure/simple_door/cult/New(var/newloc, var/material_name)
|
||||
..(newloc, MATERIAL_CULT)
|
||||
color = COLOR_CULT_DOOR // looks better than the standard cult colours
|
||||
color = COLOR_CULT_DOOR // looks better than the standard cult colours
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
user.visible_message("<b>[user]</b> starts scraping the rot away with \the [W].", SPAN_NOTICE("You start scraping the rot away with \the [W]."))
|
||||
if(do_after(user, rand(3 SECONDS, 5 SECONDS), TRUE))
|
||||
user.visible_message("<b>[user]</b> scrapes away the rot with \the [W].", SPAN_NOTICE("You start scraping away the rot with \the [W]."))
|
||||
playsound(src, W.hitsound, 10, TRUE)
|
||||
playsound(src, W.hitsound, W.get_clamped_volume(), TRUE)
|
||||
for(var/obj/effect/overlay/wallrot/WR in src)
|
||||
WR.scrape(user)
|
||||
return
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
user.visible_message("<span class='danger'>\The [user] cuts [src]'s neck open with \the [W]!</span>")
|
||||
|
||||
if(W.hitsound)
|
||||
playsound(loc, W.hitsound, 50, 1, -1)
|
||||
playsound(loc, W.hitsound, W.get_clamped_volume(), 1, -1)
|
||||
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
@@ -207,4 +207,4 @@
|
||||
|
||||
/mob/living/carbon/Resting(amount)
|
||||
help_up_offer = 0
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
var/blocked = run_armor_check(hit_zone, "melee")
|
||||
standard_weapon_hit_effects(I, user, effective_force, blocked, hit_zone)
|
||||
|
||||
if(I.damtype == BRUTE && prob(33)) // Added blood for whacking non-humans too
|
||||
if(I.damtype == BRUTE && prob(33) && I.force) // Added blood for whacking non-humans too
|
||||
var/turf/simulated/location = get_turf(src)
|
||||
if(istype(location)) location.add_blood_floor(src)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
user.do_attack_animation(src)
|
||||
if(W.force)
|
||||
user.visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W]!"), SPAN_NOTICE("You [pick(W.attack_verb)] \the [src] with \the [W]!"))
|
||||
playsound(loc, W.hitsound, 60, TRUE)
|
||||
playsound(loc, W.hitsound, W.get_clamped_volume(), TRUE)
|
||||
playsound(loc, /decl/sound_category/wood_break_sound, 50, TRUE)
|
||||
health -= W.force
|
||||
if(health <= 0)
|
||||
|
||||
Reference in New Issue
Block a user