Merge pull request #4475 from Neerti/12/31/2017

Adds Visual Cleavage
This commit is contained in:
Anewbe
2018-01-02 20:04:50 -05:00
committed by GitHub
6 changed files with 48 additions and 2 deletions
+20 -1
View File
@@ -5,4 +5,23 @@
icon = 'icons/obj/items.dmi'
icon_state = "strangepresent"
density = 1
anchored = 0
anchored = 0
// Shown really briefly when attacking with axes.
/obj/effect/temporary_effect/cleave_attack
name = "cleaving attack"
desc = "Something swinging really wide."
icon = 'icons/effects/96x96.dmi'
icon_state = "cleave"
layer = 6
time_to_die = 6
alpha = 140
invisibility = 0
mouse_opacity = 0
new_light_range = 0
new_light_power = 0
pixel_x = -32
pixel_y = -32
/obj/effect/temporary_effect/cleave_attack/initialize() // Makes the slash fade smoothly. When completely transparent it should qdel itself.
animate(src, alpha = 0, time = time_to_die - 1)
@@ -100,3 +100,4 @@
icon_state = "survivalknife"
item_state = "knife"
applies_material_colour = FALSE
should_cleave = FALSE
@@ -32,6 +32,13 @@
origin_tech = list(TECH_MATERIAL = 2, TECH_COMBAT = 1)
attack_verb = list("chopped", "torn", "cut")
applies_material_colour = 0
var/should_cleave = TRUE // Because knives inherit from hatchets. For some reason.
// This cannot go into afterattack since some mobs delete themselves upon dying.
/obj/item/weapon/material/hatchet/pre_attack(var/mob/living/target, var/mob/living/user)
if(should_cleave && istype(target))
cleave(user, target)
..()
/obj/item/weapon/material/hatchet/unathiknife
name = "duelling knife"
@@ -39,6 +46,7 @@
icon = 'icons/obj/weapons.dmi'
icon_state = "unathiknife"
attack_verb = list("ripped", "torn", "cut")
should_cleave = FALSE
var hits = 0
/obj/item/weapon/material/hatchet/unathiknife/attack(mob/M as mob, mob/user as mob)
@@ -56,6 +64,7 @@
hits = initial(hits)
..()
// These probably shouldn't inherit from hatchets.
/obj/item/weapon/material/hatchet/tacknife
name = "tactical knife"
desc = "You'd be killing loads of people if this was Medal of Valor: Heroes of Space."
@@ -64,6 +73,7 @@
item_state = "knife"
attack_verb = list("stabbed", "chopped", "cut")
applies_material_colour = 1
should_cleave = FALSE
/obj/item/weapon/material/hatchet/tacknife/combatknife
name = "combat knife"
@@ -75,6 +85,7 @@
thrown_force_divisor = 1.75 // 20 with weight 20 (steel)
attack_verb = list("sliced", "stabbed", "chopped", "cut")
applies_material_colour = 1
should_cleave = FALSE
/obj/item/weapon/material/minihoe // -- Numbers
name = "mini hoe"
@@ -97,6 +97,12 @@
icon_state = initial(icon_state)
to_chat(user, "<span class='notice'>\The [src] is de-energised. It's just a regular axe now.</span>")
// This cannot go into afterattack since some mobs delete themselves upon dying.
/obj/item/weapon/melee/energy/axe/pre_attack(var/mob/living/target, var/mob/living/user)
if(istype(target))
cleave(user, target)
..()
/obj/item/weapon/melee/energy/axe/suicide_act(mob/user)
visible_message("<span class='warning'>\The [user] swings \the [src] towards \his head! It looks like \he's trying to commit suicide.</span>")
return (BRUTELOSS|FIRELOSS)
+10 -1
View File
@@ -19,6 +19,8 @@
/obj/item/weapon/proc/cleave(var/mob/living/user, var/mob/living/target)
if(cleaving)
return // We're busy.
if(get_turf(user) == get_turf(target))
return // Otherwise we would hit all eight surrounding tiles.
cleaving = TRUE
var/hit_mobs = 0
for(var/mob/living/simple_animal/SA in orange(get_turf(target), 1))
@@ -35,6 +37,13 @@
if(resolve_attackby(SA, user)) // Hit them with the weapon. This won't cause recursive cleaving due to the cleaving variable being set to true.
hit_mobs++
cleave_visual(user, target)
if(hit_mobs)
to_chat(user, "<span class='danger'>You used \the [src] to attack [hit_mobs] other thing\s!</span>")
cleaving = FALSE // We're done now.
cleaving = FALSE // We're done now.
// This is purely the visual effect of cleaving.
/obj/item/weapon/proc/cleave_visual(var/mob/living/user, var/mob/living/target)
var/obj/effect/temporary_effect/cleave_attack/E = new(get_turf(src))
E.dir = get_dir(user, target)