fix incorrect match path

can butcher with any sharp item on harm intent
simple_animal/attacked_by()
moved var/foldable to box level
some fixes with attack code
updated slime code, can now mousedrop as a slime to feed on mobs
adds sound to simple_animal/attackby
This commit is contained in:
uraniummeltdown
2018-03-04 13:52:53 +05:00
parent 01551ec248
commit d6a277a224
9 changed files with 96 additions and 88 deletions
+13 -6
View File
@@ -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("<span class='combat danger'>[src] has been attacked with [I][showname]</span>",
"<span class='userdanger'>[src] has been attacked with [I][showname]</span>")
if(!showname && user)
if(user.client)
to_chat(user, "<span class='combat danger'>You attack [M] with [src]. </span>")
/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)
..()
else
visible_message("<span class='danger'>[I] bounces harmlessly off of [src].</span>",\
"<span class='userdanger'>[I] bounces harmlessly off of [src].</span>")
// 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
+4 -4
View File
@@ -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()
. = ..()
@@ -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, "<span class='warning'>You can't fold this box with items still inside!</span>")
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, "<span class='notice'>You fold [src] flat.</span>")
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
@@ -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, "<span class='notice'>You fold [src] flat.</span>")
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.
@@ -219,15 +219,12 @@ emp_act
if(I.attack_verb && I.attack_verb.len)
visible_message("<span class='combat danger'>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!</span>",
"<span class='combat userdanger'>[src] has been [pick(I.attack_verb)] in the [hit_area] with [I] by [user]!</span>"))
else if(I.force == 0)
visible_message("<span class='combat danger'>[src] has been [pick("tapped","patted")] on the [hit_area] with [I] by [user]!</span>", \
"<span class='combat userdanger'>[src] has been [pick("tapped","patted")] on the [hit_area] with [I] by [user]!</span>")
else
else if(I.force)
visible_message("<span class='combat danger'>[src] has been attacked in the [hit_area] with [I] by [user]!</span>",
"<span class='combat userdanger'>[src] has been attacked in the [hit_area] with [I] by [user]!</span>"))
else
return 0
if(!I.force)
return 0
var/armor = run_armor_check(affecting, "melee", "<span class='warning'>Your armour has protected your [hit_area].</span>", "<span class='warning'>Your armour has softened hit to your [hit_area].</span>", armour_penetration = I.armour_penetration)
var/weapon_sharp = is_sharp(I)
if(weapon_sharp && prob(getarmor(user.zone_sel.selecting, "melee")))
+26 -36
View File
@@ -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("<span class='danger'> The [M.name] has glomped [src]!</span>", \
"<span class='userdanger'> The [M.name] has glomped [src]!</span>")
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("<span class='danger'> The [M.name] has glomped [src]!</span>", \
"<span class='userdanger'> The [M.name] has glomped [src]!</span>")
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("<span class='warning'>[src] has been touched with the stun gloves by [M]!</span>")
return
else
to_chat(M, "<span class='warning'>Not enough charge! </span>")
return
*/
switch(M.a_intent)
if(INTENT_HELP)
@@ -373,9 +362,9 @@
playsound(loc, "punch", 25, 1, -1)
visible_message("<span class='danger'>[M] has punched [src]!</span>", \
"<span class='userdanger'>[M] has punched [src]!</span>")
adjustBruteLoss(damage)
updatehealth()
if(health > -100)
adjustBruteLoss(damage)
updatehealth()
else
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
visible_message("<span class='danger'>[M] has attempted to punch [src]!</span>")
@@ -404,13 +393,14 @@
var/damage = rand(15, 30)
if(damage >= 25)
damage = rand(20, 40)
visible_message("<span class='danger'>[M] has attacked [name]!</span>", \
"<span class='userdanger'>[M] has attacked [name]!</span>")
visible_message("<span class='danger'>[M] has slashed [name]!</span>", \
"<span class='userdanger'>[M] has slashed [name]!</span>")
else
visible_message("<span class='danger'>[M] has wounded [name]!</span>", \
"<span class='userdanger'>)[M] has wounded [name]!</span>")
adjustBruteLoss(damage)
updatehealth()
if(health > -100)
adjustBruteLoss(damage)
updatehealth()
else
playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1)
visible_message("<span class='danger'>[M] has attempted to lunge at [name]!</span>", \
+4 -3
View File
@@ -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, "<span class='notice'>You begin to butcher [src]...</span>")
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
@@ -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
@@ -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("<span class='danger'>[O] bounces harmlessly off of [src].</span>",\
"<span class='userdanger'>[O] bounces harmlessly off of [src].</span>")
playsound(loc, O.hitsound, 50, 1, -1)
else
user.visible_message("<span class='warning'>[user] gently taps [src] with [O].</span>",\
"<span class='warning'>This weapon is ineffective, it does no damage.</span>")