diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 841b82f8530..968582443ae 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -20,7 +20,7 @@ I.attack(src, user) /mob/living/proc/attacked_by(obj/item/I, mob/living/user, def_zone) - apply_damage(I.force, I.damtype) + apply_damage(I.force, I.damtype, def_zone) if(I.damtype == "brute") if(prob(33) && I.force) add_splatter_floor() @@ -29,7 +29,7 @@ if(user) showname = " by [user]!" user.do_attack_animation(src) - if(!(user in viewers(I, null))) + if(!(user in viewers(src, null))) showname = "." if(I.attack_verb && I.attack_verb.len) @@ -38,9 +38,16 @@ 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]. ") + +/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user) + if(!I.force) + user.visible_message("[user] gently taps [src] with [I].",\ + "This weapon is ineffective, it does no damage.") + else if(I.force >= force_threshold && I.damtype != STAMINA) + ..() + else + visible_message("[I] bounces harmlessly off of [src].",\ + "[I] bounces harmlessly off of [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. @@ -85,7 +92,7 @@ ///////////////////////// 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 + 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 if(!iscarbon(user)) M.LAssailant = null diff --git a/code/game/objects/items/weapons/lighters.dm b/code/game/objects/items/weapons/lighters.dm index 3f165060b5d..f269542d5c8 100644 --- a/code/game/objects/items/weapons/lighters.dm +++ b/code/game/objects/items/weapons/lighters.dm @@ -168,10 +168,10 @@ location.hotspot_expose(700, 5) return -/obj/item/match/fire_act() +/obj/item/weapon/match/fire_act() matchignite() -/obj/item/match/proc/matchignite() +/obj/item/weapon/match/proc/matchignite() if(!lit && !burnt) lit = TRUE icon_state = "match_lit" @@ -185,7 +185,7 @@ processing_objects.Add(src) update_icon() -/obj/item/match/proc/matchburnout() +/obj/item/weapon/match/proc/matchburnout() if(lit) lit = FALSE burnt = TRUE @@ -198,7 +198,7 @@ attack_verb = list("flicked") processing_objects.Remove(src) -/obj/item/match/dropped(mob/user) +/obj/item/weapon/match/dropped(mob/user) matchburnout() . = ..() diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 23dbff92d33..302fa1bd0bc 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -25,14 +25,40 @@ icon_state = "box" item_state = "syringe_kit" burn_state = FLAMMABLE - foldable = /obj/item/stack/sheet/cardboard //BubbleWrap + var/foldable = /obj/item/stack/sheet/cardboard + +/obj/item/weapon/storage/box/attack_self(mob/user) + ..() + + if(!foldable) + return + if(contents.len) + to_chat(user, "You can't fold this box with items still inside!") + return + if(!ispath(foldable)) + return + + // Close any open UI windows first + var/found = 0 + for(var/mob/M in range(1)) + if(M.s_active == src) + close(M) + if(M == user) + found = 1 + if(!found) // User is too far away + return + + to_chat(user, "You fold [src] flat.") + var/obj/item/I = new foldable(get_turf(src)) + user.put_in_hands(I) + qdel(src) /obj/item/weapon/storage/box/large name = "large box" desc = "You could build a fort with this." icon_state = "largebox" w_class = 42 // Big, bulky. - foldable = /obj/item/stack/sheet/cardboard //BubbleWrap + foldable = /obj/item/stack/sheet/cardboard storage_slots = 21 max_combined_w_class = 42 // 21*2 @@ -678,7 +704,7 @@ icon_state = "light" desc = "This box is shaped on the inside so that only light tubes and bulbs fit." item_state = "syringe_kit" - foldable = /obj/item/stack/sheet/cardboard //BubbleWrap + foldable = /obj/item/stack/sheet/cardboard storage_slots=21 can_hold = list(/obj/item/weapon/light/tube, /obj/item/weapon/light/bulb) max_combined_w_class = 21 diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index f08fc81aaa5..fb888dfeefa 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -22,7 +22,6 @@ var/allow_quick_empty //Set this variable to allow the object to have the 'empty' verb, which dumps all the contents on the floor. var/allow_quick_gather //Set this variable to allow the object to have the 'toggle mode' verb, which quickly collects all items from a tile. var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile - var/foldable = null // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard var/use_sound = "rustle" //sound played when used. null for no sound. /obj/item/weapon/storage/MouseDrop(obj/over_object as obj) @@ -474,35 +473,12 @@ for(var/obj/O in contents) O.hear_message(M, msg) -// BubbleWrap - A box can be folded up to make card -/obj/item/weapon/storage/attack_self(mob/user as mob) +/obj/item/weapon/storage/attack_self(mob/user) //Clicking on itself will empty it, if it has the verb to do that. if(user.is_in_active_hand(src)) - if(src.verbs.Find(/obj/item/weapon/storage/verb/quick_empty)) - src.quick_empty() - return - - //Otherwise we'll try to fold it. - if( contents.len ) - return - - if( !ispath(src.foldable) ) - return - var/found = 0 - // Close any open UI windows first - for(var/mob/M in range(1)) - if(M.s_active == src) - src.close(M) - if( M == user ) - found = 1 - if( !found ) // User is too far away - return - // Now make the cardboard - to_chat(user, "You fold [src] flat.") - new src.foldable(get_turf(src)) - qdel(src) -//BubbleWrap END + if(verbs.Find(/obj/item/weapon/storage/verb/quick_empty)) + quick_empty() //Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area). //Returns -1 if the atom was not found on container. diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 2401cb2a21b..3e73b1ca5c0 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -219,15 +219,12 @@ emp_act 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 + else if(I.force) 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]!")) + else + return 0 - 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"))) diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index d1bcb196c0e..f7e22f60b35 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -193,6 +193,12 @@ updatehealth() return +/mob/living/carbon/slime/MouseDrop(atom/movable/A) + if(isliving(A) && A != usr) + var/mob/living/Food = A + if(Food.Adjacent(usr) && !stat && Food.stat != DEAD) //messy + Feedon(Food) + ..() /mob/living/carbon/slime/unEquip(obj/item/W as obj) return @@ -200,28 +206,25 @@ /mob/living/carbon/slime/attack_ui(slot) return -/mob/living/carbon/slime/attack_slime(mob/living/carbon/slime/M as mob) +/mob/living/carbon/slime/attack_slime(mob/living/carbon/slime/M) if(!ticker) to_chat(M, "You cannot attack people before the game has started.") return - if(Victim) return // can't attack while eating! + if(Victim) + return // can't attack while eating! + M.do_attack_animation(src) + visible_message(" The [M.name] has glomped [src]!", \ + " The [M.name] has glomped [src]!") + var/damage = rand(1, 3) + attacked += 5 + if(M.is_adult) + damage = rand(1, 6) + else + damage = rand(1, 3) if(health > -100) - - M.do_attack_animation(src) - visible_message(" The [M.name] has glomped [src]!", \ - " The [M.name] has glomped [src]!") - var/damage = rand(1, 3) - attacked += 5 - - if(M.is_adult) - damage = rand(1, 6) - else - damage = rand(1, 3) - adjustBruteLoss(damage) - updatehealth() return @@ -327,20 +330,6 @@ if(S.next_step(M, src)) return 1 -/* - if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) - var/obj/item/clothing/gloves/G = M.gloves - if(G.cell) - if(M.a_intent == "hurt")//Stungloves. Any contact will stun the alien. - if(G.cell.charge >= 2500) - G.cell.use(2500) - visible_message("[src] has been touched with the stun gloves by [M]!") - return - else - to_chat(M, "Not enough charge! ") - return -*/ - switch(M.a_intent) if(INTENT_HELP) @@ -373,9 +362,9 @@ playsound(loc, "punch", 25, 1, -1) visible_message("[M] has punched [src]!", \ "[M] has punched [src]!") - - adjustBruteLoss(damage) - updatehealth() + if(health > -100) + adjustBruteLoss(damage) + updatehealth() else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to punch [src]!") @@ -404,13 +393,14 @@ var/damage = rand(15, 30) if(damage >= 25) damage = rand(20, 40) - visible_message("[M] has attacked [name]!", \ - "[M] has attacked [name]!") + visible_message("[M] has slashed [name]!", \ + "[M] has slashed [name]!") else visible_message("[M] has wounded [name]!", \ ")[M] has wounded [name]!") - adjustBruteLoss(damage) - updatehealth() + if(health > -100) + adjustBruteLoss(damage) + updatehealth() else playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to lunge at [name]!", \ diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index e38b2e6fd4e..f2849c1813d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -983,11 +983,12 @@ return 0 /mob/living/proc/attempt_harvest(obj/item/I, mob/user) - if(stat == DEAD && !isnull(butcher_results)) //can we butcher it? - if(istype(I, /obj/item/weapon/kitchen/knife)) + if(user.a_intent == INTENT_HARM && stat == DEAD && butcher_results) //can we butcher it? + var/sharpness = is_sharp(I) + if(sharpness) to_chat(user, "You begin to butcher [src]...") playsound(loc, 'sound/weapons/slice.ogg', 50, 1, -1) - if(do_mob(user, src, 80)) + if(do_mob(user, src, 80/sharpness) && Adjacent(I)) harvest(user) return 1 diff --git a/code/modules/mob/living/silicon/damage_procs.dm b/code/modules/mob/living/silicon/damage_procs.dm new file mode 100644 index 00000000000..aa225f0741b --- /dev/null +++ b/code/modules/mob/living/silicon/damage_procs.dm @@ -0,0 +1,13 @@ +/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE) + blocked = (100-blocked)/100 + if(!damage || (blocked <= 0)) + return 0 + switch(damagetype) + if(BRUTE) + adjustBruteLoss(damage * blocked) + if(BURN) + adjustFireLoss(damage * blocked) + else + return 1 + updatehealth() + return 1 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 461b5193b69..0acbadbffa6 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -276,9 +276,6 @@ var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) attack_threshold_check(damage,M.melee_damage_type) -/mob/living/simple_animal/proc/attacked_by(obj/item/I, mob/living/user) // Handled in _onclick/click.dm - return - /mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) if(!Proj) return @@ -422,6 +419,7 @@ else visible_message("[O] bounces harmlessly off of [src].",\ "[O] bounces harmlessly off of [src].") + playsound(loc, O.hitsound, 50, 1, -1) else user.visible_message("[user] gently taps [src] with [O].",\ "This weapon is ineffective, it does no damage.")