Skip to content

Commit

Permalink
Merge pull request DS-13-Dev-Team#184 from MisterGrimm/BlockTheWorld
Browse files Browse the repository at this point in the history
Blocking for melee and ranged weapons
  • Loading branch information
blackwolf602 authored Oct 26, 2023
2 parents 6aa2086 + 3d128ad commit 26addc9
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 63 deletions.
6 changes: 3 additions & 3 deletions _maps/map_files/AegisVII/AegisVII_Low.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@
/area/station/cargo/warehouse)
"mD" = (
/obj/structure/table/reinforced,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/turf/open/floor/plating,
/area/station/maintenance/fore/lesser)
"mG" = (
Expand Down Expand Up @@ -2629,7 +2629,7 @@
/area/station/maintenance/fore/lesser)
"um" = (
/obj/structure/rack,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/turf/open/floor/plating,
/area/station/maintenance/fore/lesser)
"un" = (
Expand Down Expand Up @@ -2878,7 +2878,7 @@
/area/station/maintenance/port/lesser)
"wT" = (
/obj/structure/rack,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/obj/effect/spawner/random/deadspace/ammo,
/turf/open/floor/plating,
/area/station/maintenance/fore/lesser)
Expand Down
6 changes: 3 additions & 3 deletions _maps/map_files/AegisVII/AegisVII_Middle.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -11666,7 +11666,7 @@
/obj/effect/turf_decal/box,
/obj/structure/closet/crate/large/ds,
/obj/effect/spawner/random/maintenance/two,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/turf/open/floor/deadspace/grater,
/area/station/cargo/warehouse/upper)
"fwj" = (
Expand Down Expand Up @@ -19134,7 +19134,7 @@
/obj/effect/spawner/random/medical/minor_healing,
/obj/effect/spawner/random/food_or_drink/snack,
/obj/effect/turf_decal/box,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/turf/open/floor/plating,
/area/station/cargo/warehouse/upper)
"laZ" = (
Expand Down Expand Up @@ -35298,7 +35298,7 @@
"xEG" = (
/obj/effect/spawner/random/structure/closet_maintenance,
/obj/effect/turf_decal/bot,
/obj/item/plasma_modified,
/obj/item/chainsaw/plasma_industrial,
/turf/open/floor/deadspace/mono,
/area/station/commons/storage/primary)
"xEM" = (
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/items/fireaxe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?"
force = 5
throwforce = 15
block_chance = 40 //Truely a engineers favorite chopping stick
w_class = WEIGHT_CLASS_BULKY
slot_flags = ITEM_SLOT_BACK
attack_verb_continuous = list("attacks", "chops", "cleaves", "tears", "lacerates", "cuts")
Expand Down Expand Up @@ -57,6 +58,11 @@
var/obj/structure/W = A
W.atom_destruction("fireaxe")

/obj/item/fireaxe/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(wielded) //Can only block if being wielded
return ..()
return 0

/*
* Bone Axe
*/
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/melee/baton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
stamina_cost = 21
stamina_critical_chance = 5
force = 12
block_chance = 20

/// Whether this baton is active or not
var/active = TRUE
Expand Down
38 changes: 25 additions & 13 deletions code/game/objects/items/spear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
force = 10
w_class = WEIGHT_CLASS_BULKY
slot_flags = ITEM_SLOT_BACK
var/wielded = FALSE
block_chance = 20 //Doesn't get as much block as other twohanded due to makeshift creation
throwforce = 20
throw_speed = 4
embedding = list("impact_pain_mult" = 2, "remove_pain_mult" = 4, "jostle_chance" = 2.5)
Expand All @@ -29,6 +31,17 @@
AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]1")
update_appearance()

/obj/item/spear/proc/on_wield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = TRUE

/// triggered on unwield of two handed item
/obj/item/spear/proc/on_unwield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = FALSE

/obj/item/spear/update_icon_state()
icon_state = "[icon_prefix]0"
return ..()
Expand All @@ -37,26 +50,34 @@
user.visible_message(span_suicide("[user] begins to sword-swallow \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
return BRUTELOSS

/obj/item/spear/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(wielded) //Can only block if being wielded
return ..()
return 0

/obj/item/spear/CheckParts(list/parts_list)
var/obj/item/shard/tip = locate() in parts_list
if(tip)
if (istype(tip, /obj/item/shard/plasma))
force = 11
throwforce = 21
block_chance = 22
icon_prefix = "spearplasma"
AddComponent(/datum/component/two_handed, force_unwielded=11, force_wielded=19, icon_wielded="[icon_prefix]1")
else if (istype(tip, /obj/item/shard/titanium))
force = 13
throwforce = 21
throw_range = 8
throw_speed = 5
block_chance = 25
icon_prefix = "speartitanium"
AddComponent(/datum/component/two_handed, force_unwielded=13, force_wielded=18, icon_wielded="[icon_prefix]1")
else if (istype(tip, /obj/item/shard/plastitanium))
force = 13
throwforce = 22
throw_range = 9
throw_speed = 5
block_chance = 26 //Ever so slightly more nimble then titanium
icon_prefix = "spearplastitanium"
AddComponent(/datum/component/two_handed, force_unwielded=13, force_wielded=20, icon_wielded="[icon_prefix]1")
update_appearance()
Expand All @@ -69,8 +90,9 @@
icon_state = "spearbomb0"
base_icon_state = "spearbomb"
icon_prefix = "spearbomb"
block_chance = 0 //You probably don't want to block with a explosive
var/obj/item/grenade/explosive = null
var/wielded = FALSE // track wielded status on item
wielded = FALSE // track wielded status on item

/obj/item/spear/explosive/Initialize(mapload)
. = ..()
Expand All @@ -79,18 +101,6 @@
set_explosive(new /obj/item/grenade/iedcasing/spawned()) //For admin-spawned explosive lances
AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]1")

/// triggered on wield of two handed item
/obj/item/spear/explosive/proc/on_wield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = TRUE

/// triggered on unwield of two handed item
/obj/item/spear/explosive/proc/on_unwield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = FALSE

/obj/item/spear/explosive/proc/set_explosive(obj/item/grenade/G)
if(explosive)
QDEL_NULL(explosive)
Expand Down Expand Up @@ -191,6 +201,7 @@
desc = "A haphazardly-constructed yet still deadly weapon. The pinnacle of modern technology."
force = 12
throwforce = 22
block_chance = 23 //Slightly better then makeshift glass spear
armour_penetration = 15 //Enhanced armor piercing

/obj/item/spear/bonespear/Initialize(mapload)
Expand All @@ -207,6 +218,7 @@
name = "bamboo spear"
desc = "A haphazardly-constructed bamboo stick with a sharpened tip, ready to poke holes into unsuspecting people."
throwforce = 22 //Better to throw
block_chance = 10 //And you thought glass and rods were flimsy

/obj/item/spear/bamboospear/Initialize(mapload)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/tools/crowbar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
name = "crowbar"
desc = "It's a big crowbar. It doesn't fit in your pockets, because it's big."
force = 12
block_chance = 12 //You could use this to block in a emergency, maybe
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 3
throw_range = 3
Expand Down
1 change: 1 addition & 0 deletions code/modules/hydroponics/hydroitemdefines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
flags_1 = CONDUCT_1
force = 12
block_chance = 15
w_class = WEIGHT_CLASS_SMALL
throwforce = 15
throw_speed = 4
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mining/equipment/mining_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
icon_state = "handdrill"
slot_flags = ITEM_SLOT_BELT
toolspeed = 0.6 //available from roundstart, faster than a pickaxe.
block_chance = 15 //It's big, but pretty unwieldy in a fight
usesound = 'sound/weapons/drill.ogg'
hitsound = 'sound/weapons/drill.ogg'
desc = "An electric mining drill for the especially scrawny."
Expand Down Expand Up @@ -118,6 +119,7 @@
slot_flags = ITEM_SLOT_BELT
force = 8
throwforce = 4
block_chance = 18 //It's basically a quarterstaff with a metal bit on the end
tool_behaviour = TOOL_SHOVEL
toolspeed = 1
usesound = 'sound/effects/shovel_dig.ogg'
Expand Down
1 change: 1 addition & 0 deletions code/modules/surgery/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
item_flags = SURGICAL_TOOL

force = 15
block_chance = 10 //You could probably block with this in a emergency
w_class = WEIGHT_CLASS_NORMAL
throwforce = 9
throw_speed = 2
Expand Down
6 changes: 4 additions & 2 deletions deadspace/code/modules/tools/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
hitsound = 'sound/weapons/blade1.ogg'
slot_flags = ITEM_SLOT_POCKETS | ITEM_SLOT_BELT
force = 2

block_chance = 0 //handled in on_transform
tool_behaviour = null
toolspeed = null

/obj/item/circular_saw/bonecutter/Initialize(mapload)
. = ..()
AddComponent(/datum/component/transforming, \
force_on = 15, \
force_on = 18, \
throwforce_on = 8, \
hitsound_on = hitsound, \
w_class_on = WEIGHT_CLASS_NORMAL, \
Expand All @@ -29,12 +29,14 @@
if(active)
tool_behaviour = TOOL_SAW
sharpness = SHARP_EDGED
block_chance = 20
toolspeed = 1
icon_state = "bonecutter_on"
else
icon_state = "bonecutter_off"
tool_behaviour = initial(tool_behaviour)
toolspeed = initial(toolspeed)
block_chance = initial(block_chance)

playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE
54 changes: 24 additions & 30 deletions deadspace/code/modules/tools/mining.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
hitsound = 'sound/weapons/blade1.ogg'
w_class = WEIGHT_CLASS_NORMAL
slot_flags = ITEM_SLOT_BELT
block_chance = 0
force = 2

tool_behaviour = null
Expand All @@ -30,26 +31,30 @@
if(active)
tool_behaviour = TOOL_MINING
sharpness = SHARP_EDGED
block_chance = 20
toolspeed = 0.5
icon_state = "plasma_saw_on"
else
icon_state = "plasma_saw_off"
tool_behaviour = initial(tool_behaviour)
toolspeed = initial(toolspeed)
block_chance = initial(block_chance)

playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE

/obj/item/plasma_modified
name = "Modified Plasma Saw"
desc = "This modified Plasma Saw is designed to cut through the strongest materials. Flesh and bone stands no chance."
/obj/item/chainsaw/plasma_industrial
name = "Industrial Plasma Saw"
desc = "This industrial grade Plasma Saw is designed to cut through the strongest materials. Flesh and bone stands no chance."
icon = 'deadspace/icons/obj/tools/mining.dmi'
icon_state = "plasmasaw_off"
lefthand_file = 'deadspace/icons/mob/onmob/items/lefthand.dmi'
righthand_file = 'deadspace/icons/mob/onmob/items/righthand.dmi'
flags_1 = CONDUCT_1
block_chance = 0
var/block_on = 35 //Can only block when it is on
force = 1
var/force_on = 24
force_on = 24
w_class = WEIGHT_CLASS_HUGE
throwforce = 13
throw_speed = 2
Expand All @@ -58,33 +63,13 @@
attack_verb_continuous = list("saws", "tears", "lacerates", "cuts", "chops", "dices")
attack_verb_simple = list("saw", "tear", "lacerate", "cut", "chop", "dice")
sharpness = SHARP_EDGED
actions_types = list(/datum/action/item_action/startplasma_modified)
actions_types = list(/datum/action/item_action/chainsaw/startplasma_industrial)
tool_behaviour = TOOL_SAW
toolspeed = 0.5
var/on = FALSE
var/wielded = FALSE // track wielded status on item

/obj/item/plasma_modified/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield))
RegisterSignal(src, COMSIG_TWOHANDED_UNWIELD, PROC_REF(on_unwield))

AddComponent(/datum/component/butchering, 30, 100, 0, 'sound/weapons/blade1.ogg', TRUE)
AddComponent(/datum/component/two_handed, require_twohands=TRUE)

/// triggered on wield of two handed item
/obj/item/plasma_modified/proc/on_wield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = TRUE

/// triggered on unwield of two handed item
/obj/item/plasma_modified/proc/on_unwield(obj/item/source, mob/user)
SIGNAL_HANDLER

on = FALSE
wielded = FALSE

/obj/item/plasma_modified/suicide_act(mob/living/carbon/user)
/obj/item/chainsaw/plasma_industrial/suicide_act(mob/living/carbon/user)
if(on)
user.visible_message(span_suicide("[user] begins to tear [user.p_their()] head off with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
playsound(src, 'sound/weapons/blade1.ogg', 100, TRUE)
Expand All @@ -96,11 +81,17 @@
playsound(src, 'sound/weapons/genhit1.ogg', 100, TRUE)
return(BRUTELOSS)

/obj/item/plasma_modified/attack_self(mob/user)
/obj/item/chainsaw/plasma_industrial/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(wielded | on) //Can only block if being wielded and on
return ..()
return 0

/obj/item/chainsaw/plasma_industrial/attack_self(mob/user)
on = !on
to_chat(user, "As you press the power button from [src], [on ? "it begins to whirr." : "the energy retracts."]")
to_chat(user, "You press the power button on the [src], [on ? "producing a spinning blade of energy." : "the energy retracts."]")
force = on ? force_on : initial(force)
throwforce = on ? force_on : initial(force)
block_chance = on ? block_on : initial(block_chance)
icon_state = "plasmasaw_[on ? "on" : "off"]"
var/datum/component/butchering/butchering = src.GetComponent(/datum/component/butchering)
butchering.butchering_enabled = on
Expand All @@ -114,7 +105,7 @@
user.update_held_items()
update_action_buttons()

/datum/action/item_action/startplasma_modified
/datum/action/item_action/chainsaw/startplasma_industrial
name = "Press the power button"

/obj/item/pickaxe/rock
Expand All @@ -129,6 +120,7 @@
slot_flags = ITEM_SLOT_POCKETS | ITEM_SLOT_BELT
w_class = WEIGHT_CLASS_NORMAL
force = 2
block_chance = 0 //handled in the on_transform
custom_materials = list(/datum/material/iron=1000)
attack_verb_continuous = list("hits", "pierces", "slices", "attacks")
attack_verb_simple = list("hit", "pierce", "slice", "attack")
Expand All @@ -152,12 +144,14 @@
if(active)
tool_behaviour = TOOL_MINING
sharpness = SHARP_EDGED
block_chance = 25 //Rock saws in lore were good at blocking necro attacks, so it gets more then usual
toolspeed = 0.5
icon_state = "rocksaw_on"
else
icon_state = "rocksaw_off"
tool_behaviour = initial(tool_behaviour)
toolspeed = initial(toolspeed)
block_chance = initial(block_chance)

playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE
Loading

0 comments on commit 26addc9

Please sign in to comment.