mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
Converts two-handedness/wielding to a component (#21619)
* initial checkin * Add everything but maps * update paths * Patches some minor bugs across twohanded things * remove a stowaway * Update code/__DEFINES/dcs/signals.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> * Contra review * Fix kc * hopefully fix file perms * Fix file perms * revert line-endings * uh? * Trying once again to fix file formats * henri review 1 * henri review 2 * update from master * Removes override that breaks modsuits * re-add reference --------- Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
/*********************Mining Hammer****************/
|
||||
/obj/item/twohanded/kinetic_crusher
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "crusher"
|
||||
item_state = "crusher0"
|
||||
/obj/item/kinetic_crusher
|
||||
name = "proto-kinetic crusher"
|
||||
desc = "An early design of the proto-kinetic accelerator, it is little more than a combination of various mining tools cobbled together, forming a high-tech club. \
|
||||
While it is an effective mining tool, it did little to aid any but the most skilled and/or suicidal miners against local fauna."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
base_icon_state = "crusher"
|
||||
icon_state = "crusher"
|
||||
item_state = "crusher0"
|
||||
force = 0 //You can't hit stuff unless wielded
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
slot_flags = SLOT_BACK
|
||||
force_unwielded = 0
|
||||
force_wielded = 20
|
||||
throwforce = 5
|
||||
throw_speed = 4
|
||||
armour_penetration_flat = 10
|
||||
@@ -27,16 +26,22 @@
|
||||
var/light_on = FALSE
|
||||
var/brightness_on = 5
|
||||
var/adaptive_damage_bonus = 0
|
||||
/// Amount of force typically assigned when wielded
|
||||
var/base_force_wielded = 20
|
||||
/// Tracker for the current amount of force used when the item is wielded.
|
||||
/// Note that this isn't wired to anything, and must be updated with AddComponent to have value.
|
||||
var/force_wielded = 20
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/Initialize(mapload)
|
||||
/obj/item/kinetic_crusher/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = MELEE_ATTACK, _parry_cooldown = (7 / 3) SECONDS ) // 2.3333 seconds of cooldown for 30% uptime
|
||||
AddComponent(/datum/component/two_handed, force_wielded = force_wielded, force_unwielded = force)
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/Destroy()
|
||||
/obj/item/kinetic_crusher/Destroy()
|
||||
QDEL_LIST_CONTENTS(trophies)
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/examine(mob/living/user)
|
||||
/obj/item/kinetic_crusher/examine(mob/living/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Mark a large creature with the destabilizing force, then hit them in melee to do <b>[force + detonation_damage]</b> damage.</span>"
|
||||
. += "<span class='notice'>Does <b>[force + detonation_damage + backstab_bonus]</b> damage if the target is backstabbed, instead of <b>[force + detonation_damage]</b>.</span>"
|
||||
@@ -44,14 +49,14 @@
|
||||
var/obj/item/crusher_trophy/T = t
|
||||
. += "<span class='notice'>It has \a [T] attached, which causes [T.effect_desc()].</span>"
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/attackby(obj/item/I, mob/living/user)
|
||||
/obj/item/kinetic_crusher/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/crusher_trophy))
|
||||
var/obj/item/crusher_trophy/T = I
|
||||
T.add_to(src, user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/crowbar_act(mob/user, obj/item/I)
|
||||
/obj/item/kinetic_crusher/crowbar_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
@@ -63,9 +68,9 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There are no trophies on [src].</span>")
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/attack(mob/living/target, mob/living/carbon/user)
|
||||
if(!wielded)
|
||||
to_chat(user, "<span class='warning'>[src] is too heavy to use with one hand. You fumble and drop everything.")
|
||||
/obj/item/kinetic_crusher/attack(mob/living/target, mob/living/carbon/user)
|
||||
if(!HAS_TRAIT(src, TRAIT_WIELDED))
|
||||
to_chat(user, "<span class='warning'>[src] is too heavy to use with one hand. You fumble and drop everything.</span>")
|
||||
user.drop_r_hand()
|
||||
user.drop_l_hand()
|
||||
return
|
||||
@@ -90,9 +95,9 @@
|
||||
if(!QDELETED(C) && !QDELETED(target))
|
||||
C.total_damage += target_health - target.health //we did some damage, but let's not assume how much we did
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/afterattack(atom/target, mob/living/user, proximity_flag, clickparams)
|
||||
/obj/item/kinetic_crusher/afterattack(atom/target, mob/living/user, proximity_flag, clickparams)
|
||||
. = ..()
|
||||
if(!wielded)
|
||||
if(!HAS_TRAIT(src, TRAIT_WIELDED))
|
||||
return
|
||||
if(user.has_status_effect(STATUS_EFFECT_DASH) && user.a_intent == INTENT_HELP)
|
||||
if(user.throw_at(target, range = 3, speed = 3, spin = FALSE, diagonals_first = TRUE))
|
||||
@@ -148,28 +153,28 @@
|
||||
C.total_damage += detonation_damage
|
||||
L.apply_damage(detonation_damage, BRUTE, blocked = def_check)
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/proc/Recharge()
|
||||
/obj/item/kinetic_crusher/proc/Recharge()
|
||||
if(!charged)
|
||||
charged = TRUE
|
||||
update_icon()
|
||||
playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, 1)
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/ui_action_click(mob/user, actiontype)
|
||||
/obj/item/kinetic_crusher/ui_action_click(mob/user, actiontype)
|
||||
light_on = !light_on
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, TRUE)
|
||||
update_brightness(user)
|
||||
update_icon()
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/proc/update_brightness(mob/user = null)
|
||||
/obj/item/kinetic_crusher/proc/update_brightness(mob/user = null)
|
||||
if(light_on)
|
||||
set_light(brightness_on)
|
||||
else
|
||||
set_light(0)
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/update_icon_state()
|
||||
item_state = "crusher[wielded]"
|
||||
/obj/item/kinetic_crusher/update_icon_state()
|
||||
item_state = "crusher[HAS_TRAIT(src, TRAIT_WIELDED)]"
|
||||
|
||||
/obj/item/twohanded/kinetic_crusher/update_overlays()
|
||||
/obj/item/kinetic_crusher/update_overlays()
|
||||
. = ..()
|
||||
if(!charged)
|
||||
. += "[icon_state]_uncharged"
|
||||
@@ -190,7 +195,7 @@
|
||||
flag = BOMB
|
||||
range = 6
|
||||
log_override = TRUE
|
||||
var/obj/item/twohanded/kinetic_crusher/hammer_synced
|
||||
var/obj/item/kinetic_crusher/hammer_synced
|
||||
|
||||
/obj/item/projectile/destabilizer/Destroy()
|
||||
hammer_synced = null
|
||||
@@ -232,12 +237,12 @@
|
||||
return "errors"
|
||||
|
||||
/obj/item/crusher_trophy/attackby(obj/item/A, mob/living/user)
|
||||
if(istype(A, /obj/item/twohanded/kinetic_crusher))
|
||||
if(istype(A, /obj/item/kinetic_crusher))
|
||||
add_to(A, user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/crusher_trophy/proc/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/proc/add_to(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
for(var/t in H.trophies)
|
||||
var/obj/item/crusher_trophy/T = t
|
||||
if(istype(T, denied_type) || istype(src, T.denied_type))
|
||||
@@ -250,14 +255,14 @@
|
||||
to_chat(user, "<span class='notice'>You attach [src] to [H].</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/crusher_trophy/proc/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/proc/remove_from(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
forceMove(get_turf(H))
|
||||
H.trophies -= src
|
||||
return TRUE
|
||||
|
||||
/obj/item/crusher_trophy/Destroy()
|
||||
if(istype(loc, /obj/item/twohanded/kinetic_crusher))
|
||||
var/obj/item/twohanded/kinetic_crusher/crusher = loc
|
||||
if(istype(loc, /obj/item/kinetic_crusher))
|
||||
var/obj/item/kinetic_crusher/crusher = loc
|
||||
crusher.trophies -= src
|
||||
return ..()
|
||||
|
||||
@@ -353,12 +358,12 @@
|
||||
/obj/item/crusher_trophy/legion_skull/effect_desc()
|
||||
return "a kinetic crusher to recharge <b>[bonus_value*0.1]</b> second\s faster"
|
||||
|
||||
/obj/item/crusher_trophy/legion_skull/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/legion_skull/add_to(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.charge_time -= bonus_value
|
||||
|
||||
/obj/item/crusher_trophy/legion_skull/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/legion_skull/remove_from(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.charge_time += bonus_value
|
||||
@@ -425,20 +430,21 @@
|
||||
/obj/item/crusher_trophy/demon_claws/effect_desc()
|
||||
return "melee hits to do <b>[bonus_value * 0.2]</b> more damage and heal you for <b>[bonus_value * 0.1]</b>, with <b>5X</b> effect on mark detonation"
|
||||
|
||||
/obj/item/crusher_trophy/demon_claws/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/demon_claws/add_to(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.force += bonus_value * 0.2
|
||||
H.force_unwielded += bonus_value * 0.2
|
||||
H.force_wielded += bonus_value * 0.2
|
||||
// don't update force since KCs have 0 force by default
|
||||
H.AddComponent(/datum/component/two_handed, force_wielded = H.force_wielded, force_unwielded = H.force)
|
||||
H.detonation_damage += bonus_value * 0.8
|
||||
|
||||
/obj/item/crusher_trophy/demon_claws/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/demon_claws/remove_from(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.force -= bonus_value * 0.2
|
||||
H.force_unwielded -= bonus_value * 0.2
|
||||
H.force_wielded -= bonus_value * 0.2
|
||||
H.AddComponent(/datum/component/two_handed, force_wielded = H.force_wielded, force_unwielded = H.force)
|
||||
H.detonation_damage -= bonus_value * 0.8
|
||||
|
||||
/obj/item/crusher_trophy/demon_claws/on_melee_hit(mob/living/target, mob/living/user)
|
||||
@@ -504,12 +510,12 @@
|
||||
/obj/item/crusher_trophy/adaptive_intelligence_core/effect_desc()
|
||||
return "melee hits deal <b>[bonus_value]</b> more damage per hit after hitting a target, up to <b>[bonus_value * 10]</b> extra damage to that target"
|
||||
|
||||
/obj/item/crusher_trophy/adaptive_intelligence_core/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/adaptive_intelligence_core/add_to(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.adaptive_damage_bonus += bonus_value
|
||||
|
||||
/obj/item/crusher_trophy/adaptive_intelligence_core/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
|
||||
/obj/item/crusher_trophy/adaptive_intelligence_core/remove_from(obj/item/kinetic_crusher/H, mob/living/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
H.adaptive_damage_bonus -= bonus_value
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
name = "champion's hardsuit"
|
||||
desc = "Voices echo from the hardsuit, driving the user insane. Is not space-proof."
|
||||
icon_state = "hardsuit-berserker"
|
||||
allowed = list(/obj/item/flashlight, /obj/item/tank/internals, /obj/item/resonator, /obj/item/mining_scanner, /obj/item/t_scanner/adv_mining_scanner, /obj/item/gun/energy/kinetic_accelerator, /obj/item/pickaxe, /obj/item/twohanded/spear)
|
||||
allowed = list(/obj/item/flashlight, /obj/item/tank/internals, /obj/item/resonator, /obj/item/mining_scanner, /obj/item/t_scanner/adv_mining_scanner, /obj/item/gun/energy/kinetic_accelerator, /obj/item/pickaxe, /obj/item/spear)
|
||||
armor = list(MELEE = 30, BULLET = 15, LASER = 10, ENERGY = 10, BOMB = 150, RAD = 0, FIRE = INFINITY, ACID = INFINITY)
|
||||
hoodtype = /obj/item/clothing/head/hooded/berserker
|
||||
flags_inv = HIDEGLOVES | HIDESHOES | HIDEJUMPSUIT | HIDETAIL
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
prize_list["Digging Tools"] = list(
|
||||
EQUIPMENT("Diamond Pickaxe", /obj/item/pickaxe/diamond, 2000),
|
||||
EQUIPMENT("Kinetic Accelerator", /obj/item/gun/energy/kinetic_accelerator, 750),
|
||||
EQUIPMENT("Kinetic Crusher", /obj/item/twohanded/kinetic_crusher, 750),
|
||||
EQUIPMENT("Kinetic Crusher", /obj/item/kinetic_crusher, 750),
|
||||
EQUIPMENT("Resonator", /obj/item/resonator, 800),
|
||||
EQUIPMENT("Silver Pickaxe", /obj/item/pickaxe/silver, 1000),
|
||||
EQUIPMENT("Super Resonator", /obj/item/resonator/upgraded, 2500),
|
||||
@@ -261,7 +261,7 @@
|
||||
new /obj/item/stack/marker_beacon/thirty(drop_location)
|
||||
if("Crusher Kit")
|
||||
new /obj/item/extinguisher/mini(drop_location)
|
||||
new /obj/item/twohanded/kinetic_crusher(drop_location)
|
||||
new /obj/item/kinetic_crusher(drop_location)
|
||||
if("Mining Conscription Kit")
|
||||
new /obj/item/storage/backpack/duffel/mining_conscript(drop_location)
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
icon_state = "slag"
|
||||
singular_name = "slag chunk"
|
||||
|
||||
/obj/item/twohanded/required/gibtonite
|
||||
/obj/item/gibtonite
|
||||
name = "gibtonite ore"
|
||||
desc = "Extremely explosive if struck with mining equipment, Gibtonite is often used by miners to speed up their work by using it as a mining charge. This material is illegal to possess by unauthorized personnel under space law."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
@@ -236,13 +236,17 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
var/attacher = "UNKNOWN"
|
||||
var/datum/wires/explosive/gibtonite/wires
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/Destroy()
|
||||
/obj/item/gibtonite/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/two_handed, require_twohands = TRUE)
|
||||
|
||||
/obj/item/gibtonite/Destroy()
|
||||
if(wires)
|
||||
SStgui.close_uis(wires)
|
||||
QDEL_NULL(wires)
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/attackby(obj/item/I, mob/user, params)
|
||||
/obj/item/gibtonite/attackby(obj/item/I, mob/user, params)
|
||||
if(!wires && istype(I, /obj/item/assembly/igniter))
|
||||
user.visible_message("[user] attaches [I] to [src].", "<span class='notice'>You attach [I] to [src].</span>")
|
||||
wires = new(src)
|
||||
@@ -268,24 +272,24 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/attack_ghost(mob/user)
|
||||
/obj/item/gibtonite/attack_ghost(mob/user)
|
||||
if(wires)
|
||||
wires.Interact(user)
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/attack_self(mob/user)
|
||||
/obj/item/gibtonite/attack_self(mob/user)
|
||||
if(wires)
|
||||
wires.Interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/bullet_act(obj/item/projectile/P)
|
||||
/obj/item/gibtonite/bullet_act(obj/item/projectile/P)
|
||||
GibtoniteReaction(P.firer)
|
||||
..()
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/ex_act()
|
||||
/obj/item/gibtonite/ex_act()
|
||||
GibtoniteReaction(null, 1)
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
||||
/obj/item/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
||||
if(!primed)
|
||||
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1)
|
||||
primed = 1
|
||||
|
||||
Reference in New Issue
Block a user