diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 8d132ed2586..841b82f8530 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -19,6 +19,28 @@ return I.attack(src, user) +/mob/living/proc/attacked_by(obj/item/I, mob/living/user, def_zone) + apply_damage(I.force, I.damtype) + if(I.damtype == "brute") + if(prob(33) && I.force) + add_splatter_floor() + + var/showname = "." + if(user) + showname = " by [user]!" + user.do_attack_animation(src) + if(!(user in viewers(I, null))) + showname = "." + + if(I.attack_verb && I.attack_verb.len) + visible_message("[src] has been [pick(I.attack_verb)] with [I][showname]", + "[src] has been [pick(I.attack_verb)] with [I][showname]") + else if(I.force) + visible_message("[src] has been attacked with [I][showname]", + "[src] has been attacked with [I][showname]") + if(!showname && user) + if(user.client) + to_chat(user, "You attack [M] with [src]. ") // 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. @@ -26,11 +48,10 @@ return -/obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone) +/obj/item/proc/attack(mob/living/M, mob/living/user, def_zone) if(!istype(M)) // not sure if this is the right thing... 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 +67,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,11 +78,10 @@ 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(hitsound && force > 0) //If an item's hitsound is defined and the item's force is greater than zero... + playsound(loc, hitsound, get_clamped_volume(), 1, -1) //...play the item's hitsound at get_clamped_volume() with varying frequency and -1 extra range. + else if(force == 0)//Otherwise, if the item's force is zero... + playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1)//...play tap.ogg at get_clamped_volume() ///////////////////////// user.lastattacked = M M.lastattacker = user @@ -74,119 +94,13 @@ ///////////////////////// - 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, "[src] passes right through [M]!") - 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("[M] has been [pick(attack_verb)] with [src][showname] ", 1) - else - O.show_message("[M] has been attacked with [src][showname] ", 1) - - if(!showname && user) - if(user.client) - to_chat(user, "You attack [M] with [src]. ") - - - - 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() + M.attacked_by(src, user, def_zone) add_fingerprint(user) return 1 + +/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 \ No newline at end of file diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index 1447be96d4f..8b55d22274f 100644 --- a/code/game/machinery/computer/HolodeckControl.dm +++ b/code/game/machinery/computer/HolodeckControl.dm @@ -441,14 +441,14 @@ icon_state = "sword[item_color]" hitsound = "sound/weapons/blade1.ogg" w_class = WEIGHT_CLASS_BULKY - playsound(user, 'sound/weapons/saberon.ogg', 50, 1) + playsound(user, 'sound/weapons/saberon.ogg', 20, 1) to_chat(user, "[src] is now active.") else force = 3 icon_state = "sword0" hitsound = "swing_hit" w_class = WEIGHT_CLASS_SMALL - playsound(user, 'sound/weapons/saberoff.ogg', 50, 1) + playsound(user, 'sound/weapons/saberoff.ogg', 20, 1) to_chat(user, "[src] can now be concealed.") if(istype(user,/mob/living/carbon/human)) var/mob/living/carbon/human/H = user diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 4979b94eb92..5d4104f57ac 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -151,21 +151,21 @@ icon = 'icons/obj/weapons.dmi' icon_state = "sword0" item_state = "sword0" - var/active = 0.0 + var/active = FALSE w_class = WEIGHT_CLASS_SMALL attack_verb = list("attacked", "struck", "hit") -/obj/item/toy/sword/attack_self(mob/user as mob) - active = !(active) +/obj/item/toy/sword/attack_self(mob/user) + active = !active if(active) to_chat(user, "You extend the plastic blade with a quick flick of your wrist.") - playsound(user, 'sound/weapons/saberon.ogg', 50, 1) + playsound(user, 'sound/weapons/saberon.ogg', 20, 1) icon_state = "swordblue" item_state = "swordblue" w_class = WEIGHT_CLASS_BULKY else to_chat(user, "You push the plastic blade back down into the handle.") - playsound(user, 'sound/weapons/saberoff.ogg', 50, 1) + playsound(user, 'sound/weapons/saberoff.ogg', 20, 1) icon_state = "sword0" item_state = "sword0" w_class = WEIGHT_CLASS_SMALL diff --git a/code/game/objects/items/weapons/cigs.dm b/code/game/objects/items/weapons/cigs.dm index fde8461e2ec..303c6057962 100644 --- a/code/game/objects/items/weapons/cigs.dm +++ b/code/game/objects/items/weapons/cigs.dm @@ -22,7 +22,7 @@ LIGHTERS ARE IN LIGHTERS.DM slot_flags = SLOT_EARS|SLOT_MASK w_class = WEIGHT_CLASS_TINY body_parts_covered = null - attack_verb = list("burnt", "singed") + attack_verb = null var/lit = 0 var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi var/icon_off = "cigoff" @@ -128,7 +128,12 @@ LIGHTERS ARE IN LIGHTERS.DM /obj/item/clothing/mask/cigarette/proc/light(flavor_text = null) if(!src.lit) src.lit = 1 - damtype = "fire" + name = "lit [name]" + if(!istype(src, /obj/item/clothing/mask/cigarette/pipe)) //can't burn people with pipes + attack_verb = list("burnt", "singed") + hitsound = 'sound/items/welder.ogg' + damtype = "fire" + force = 4 if(reagents.get_reagent_amount("plasma")) // the plasma explodes when exposed to fire var/datum/effect_system/reagents_explosion/e = new() e.set_up(round(reagents.get_reagent_amount("plasma") / 2.5, 1), get_turf(src), 0, 0) diff --git a/code/game/objects/items/weapons/lighters.dm b/code/game/objects/items/weapons/lighters.dm index fb863582b83..f8e725fb04d 100644 --- a/code/game/objects/items/weapons/lighters.dm +++ b/code/game/objects/items/weapons/lighters.dm @@ -13,7 +13,7 @@ throwforce = 4 flags = CONDUCT slot_flags = SLOT_BELT - attack_verb = list("burnt", "singed") + attack_verb = null var/lit = 0 /obj/item/weapon/lighter/zippo @@ -38,6 +38,10 @@ w_class = WEIGHT_CLASS_BULKY icon_state = icon_on item_state = icon_on + force = 5 + damtype = "fire" + hitsound = 'sound/items/welder.ogg' + attack_verb = list("burnt", "singed") if(istype(src, /obj/item/weapon/lighter/zippo) ) user.visible_message("Without even breaking stride, [user] flips open and lights [src] in one smooth movement.") playsound(src.loc, 'sound/items/ZippoLight.ogg', 25, 1) @@ -62,6 +66,9 @@ w_class = WEIGHT_CLASS_TINY icon_state = icon_off item_state = icon_off + hitsound = "swing_hit" + force = 0 + attack_verb = null //human_defense.dm takes care of it if(istype(src, /obj/item/weapon/lighter/zippo) ) user.visible_message("You hear a quiet click, as [user] shuts off [src] without even looking at what they're doing. Wow.") playsound(src.loc, 'sound/items/ZippoClose.ogg', 25, 1) @@ -149,21 +156,27 @@ var/smoketime = 5 w_class = WEIGHT_CLASS_TINY origin_tech = "materials=1" - attack_verb = list("burnt", "singed") + attack_verb = null /obj/item/weapon/match/process() var/turf/location = get_turf(src) smoketime-- if(smoketime < 1) - icon_state = "match_burnt" lit = -1 + damtype = "brute" + force = 0 + icon_state = "match_burnt" + item_state = "cigoff" + name = "burnt match" + desc = "A match. This one has seen better days." + attack_verb = null processing_objects.Remove(src) return if(location) location.hotspot_expose(700, 5) return -/obj/item/weapon/match/dropped(mob/user as mob) +/obj/item/weapon/match/dropped(mob/user) if(lit == 1) lit = -1 damtype = "brute" @@ -171,6 +184,7 @@ item_state = "cigoff" name = "burnt match" desc = "A match. This one has seen better days." + attack_verb = null processing_objects.Remove(src) return ..() diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 16b8d302c7f..7decbea5e66 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -12,7 +12,7 @@ light_power = 2 var/brightness_on = 2 var/colormap = list(red=LIGHT_COLOR_RED, blue=LIGHT_COLOR_LIGHTBLUE, green=LIGHT_COLOR_GREEN, purple=LIGHT_COLOR_PURPLE, rainbow=LIGHT_COLOR_WHITE) - + /obj/item/weapon/melee/energy/suicide_act(mob/user) user.visible_message(pick("[user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku.", \ "[user] is falling on the [src.name]! It looks like \he's trying to commit suicide.")) @@ -70,7 +70,7 @@ throw_range = 5 w_class = WEIGHT_CLASS_NORMAL w_class_on = WEIGHT_CLASS_HUGE - hitsound = "swing_hit" + hitsound = 'sound/weapons/bladeslice.ogg' flags = CONDUCT armour_penetration = 100 origin_tech = "combat=4;magnets=3" diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 594028e4f1f..2191e3cb499 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -639,19 +639,25 @@ slot_flags = SLOT_BELT can_hold = list(/obj/item/weapon/match) - New() - ..() - for(var/i=1; i <= storage_slots; i++) - new /obj/item/weapon/match(src) +/obj/item/weapon/storage/box/matches/New() + ..() + for(var/i in 1 to storage_slots) + new /obj/item/weapon/match(src) - attackby(obj/item/weapon/match/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/weapon/match) && W.lit == 0) - W.lit = 1 - W.icon_state = "match_lit" - processing_objects.Add(W) - playsound(user.loc, 'sound/goonstation/misc/matchstick_light.ogg', 50, 1) - W.update_icon() - return +/obj/item/weapon/storage/box/matches/attackby(obj/item/weapon/match/W, mob/user, params) + if(istype(W, /obj/item/weapon/match) && W.lit == 0) + W.lit = 1 + W.icon_state = "match_lit" + W.damtype = "fire" + W.force = 3 + W.item_state = "cigon" + W.name = "lit match" + W.desc = "A match. This one is lit." + W.attack_verb = list("burnt","singed") + processing_objects.Add(W) + playsound(user.loc, 'sound/goonstation/misc/matchstick_light.ogg', 50, 1) + W.update_icon() + return /obj/item/weapon/storage/box/autoinjectors name = "box of injectors" diff --git a/code/game/objects/items/weapons/swords_axes_etc.dm b/code/game/objects/items/weapons/swords_axes_etc.dm index 7666e9f9851..a3fd0b992f5 100644 --- a/code/game/objects/items/weapons/swords_axes_etc.dm +++ b/code/game/objects/items/weapons/swords_axes_etc.dm @@ -7,9 +7,10 @@ /* * Banhammer */ -/obj/item/weapon/banhammer/attack(mob/M as mob, mob/user as mob) +/obj/item/weapon/banhammer/attack(mob/M, mob/user) to_chat(M, " You have been banned FOR NO REISIN by [user]") to_chat(user, " You have BANNED [M]") + playsound(loc, 'sound/effects/adminhelp.ogg', 15) //keep it at 15% volume so people don't jump out of their skin too much /* * Classic Baton diff --git a/code/game/objects/weapons.dm b/code/game/objects/weapons.dm index f35fa65b3c7..bc64a4ab8f3 100644 --- a/code/game/objects/weapons.dm +++ b/code/game/objects/weapons.dm @@ -1,4 +1,11 @@ /obj/item/weapon name = "weapon" icon = 'icons/obj/weapons.dmi' - hitsound = "swing_hit" + +/obj/item/weapon/New() + ..() + if(!hitsound) + if(damtype == "fire") + hitsound = 'sound/items/welder.ogg' + if(damtype == "brute") + hitsound = "swing_hit" \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 6f6bb6ade48..2401cb2a21b 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -176,21 +176,22 @@ emp_act return 1 //Returns 1 if the attack hit, 0 if it missed. -/mob/living/carbon/human/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone) - if(!I || !user) return 0 +/mob/living/carbon/human/attacked_by(obj/item/I, mob/living/user, def_zone) + if(!I || !user) + return 0 - if((istype(I, /obj/item/weapon/kitchen/knife/butcher/meatcleaver) || istype(I, /obj/item/weapon/twohanded/chainsaw)) && src.stat == DEAD && user.a_intent == INTENT_HARM) - var/obj/item/weapon/reagent_containers/food/snacks/meat/human/newmeat = new /obj/item/weapon/reagent_containers/food/snacks/meat/human(get_turf(src.loc)) - newmeat.name = src.real_name + newmeat.name - newmeat.subjectname = src.real_name - newmeat.subjectjob = src.job - newmeat.reagents.add_reagent ("nutriment", (src.nutrition / 15) / 3) - src.reagents.trans_to (newmeat, round ((src.reagents.total_volume) / 3, 1)) + if((istype(I, /obj/item/weapon/kitchen/knife/butcher/meatcleaver) || istype(I, /obj/item/weapon/twohanded/chainsaw)) && stat == DEAD && user.a_intent == INTENT_HARM) + var/obj/item/weapon/reagent_containers/food/snacks/meat/human/newmeat = new /obj/item/weapon/reagent_containers/food/snacks/meat/human(get_turf(loc)) + newmeat.name = real_name + newmeat.name + newmeat.subjectname = real_name + newmeat.subjectjob = job + newmeat.reagents.add_reagent("nutriment", (nutrition / 15) / 3) + reagents.trans_to(newmeat, round((reagents.total_volume) / 3, 1)) add_mob_blood(src) - --src.meatleft - to_chat(user, "You hack off a chunk of meat from [src.name]") - if(!src.meatleft) - src.create_attack_log("Was chopped up into meat by [key_name(user)]") + --meatleft + to_chat(user, "You hack off a chunk of meat from [name]") + if(!meatleft) + create_attack_log("Was chopped up into meat by [key_name(user)]") user.create_attack_log("Chopped up [key_name(src)] into meat") msg_admin_attack("[key_name_admin(user)] chopped up [key_name_admin(src)] into meat") if(!iscarbon(user)) @@ -214,19 +215,26 @@ emp_act if(istype(I,/obj/item/weapon/card/emag)) emag_act(user, affecting) - if(! I.discrete) - if(I.attack_verb.len) - visible_message("[src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!") + if(!I.discrete) + if(I.attack_verb && I.attack_verb.len) + visible_message("[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!", + "[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!")) + else if(I.force == 0) + visible_message("[src] has been [pick("tapped","patted")] on the [hit_area] with [I] by [user]!", \ + "[src] has been [pick("tapped","patted")] on the [hit_area] with [I] by [user]!") else - visible_message("[src] has been attacked in the [hit_area] with [I.name] by [user]!") + visible_message("[src] has been attacked in the [hit_area] with [I] by [user]!", + "[src] has been attacked in the [hit_area] with [I] by [user]!")) - var/armor = run_armor_check(affecting, "melee", "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].", armour_penetration = I.armour_penetration) + if(!I.force) + return 0 + var/armor = run_armor_check(affecting, "melee", "Your armour has protected your [hit_area].", "Your armour has softened hit to your [hit_area].", armour_penetration = I.armour_penetration) var/weapon_sharp = is_sharp(I) if(weapon_sharp && prob(getarmor(user.zone_sel.selecting, "melee"))) weapon_sharp = 0 - if(armor >= 100) return 0 - if(!I.force) return 0 + if(armor >= 100) + return 0 var/Iforce = I.force //to avoid runtimes on the forcesay checks at the bottom. Some items might delete themselves if you drop them. (stunning yourself, ninja swords) apply_damage(I.force, I.damtype, affecting, armor, sharp = weapon_sharp, used_weapon = I) @@ -234,8 +242,6 @@ emp_act var/bloody = 0 if(I.damtype == BRUTE && I.force && prob(25 + I.force * 2)) I.add_mob_blood(src) //Make the weapon bloody, not the person. -// if(user.hand) user.update_inv_l_hand() //updates the attacker's overlay for the (now bloodied) weapon -// else user.update_inv_r_hand() //removed because weapons don't have on-mob blood overlays if(prob(I.force * 2)) //blood spatter! bloody = 1 var/turf/location = loc