Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: welder sword #5976

Open
wants to merge 10 commits into
base: master220
Choose a base branch
from
20 changes: 14 additions & 6 deletions code/game/objects/items/tools/welder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,23 @@
remove_fuel(maximum_fuel)

/obj/item/weldingtool/attack_self(mob/user)
if(try_toggle_welder(user))
. = ..()

/obj/item/weldingtool/proc/try_toggle_welder(mob/user, manual_toggle = TRUE)
if(tool_enabled) //Turn off the welder if it's on
to_chat(user, "<span class='notice'>You switch off [src].</span>")
toggle_welder()
return
to_chat(user, span_notice("You switch off [src]."))
if(manual_toggle)
toggle_welder()
return TRUE
else if(GET_FUEL) //The welder is off, but we need to check if there is fuel in the tank
to_chat(user, "<span class='notice'>You switch on [src].</span>")
toggle_welder()
to_chat(user, span_notice("You switch on [src]."))
if(manual_toggle)
toggle_welder()
return TRUE
else //The welder is off and unfuelled
to_chat(user, "<span class='notice'>[src] is out of fuel!</span>")
to_chat(user, span_notice("[src] is out of fuel!"))
return FALSE

/obj/item/weldingtool/proc/toggle_welder(turn_off = FALSE) //Turn it on or off, forces it to deactivate
tool_enabled = turn_off ? FALSE : !tool_enabled
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items/weapons/cigs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ LIGHTERS ARE IN LIGHTERS.DM


/obj/item/clothing/mask/cigarette/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weldingtool/sword))
if(I.tool_enabled)
light(span_notice("[user] casually lights the [name] with [I], what a badass."))
return ATTACK_CHAIN_PROCEED_SUCCESS

if(istype(I, /obj/item/lighter/zippo))
add_fingerprint(user)
var/obj/item/lighter/zippo/zippo = I
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@
return .

if(prob(50))
INVOKE_ASYNC(src, PROC_REF(jedi_spin), user)
INVOKE_ASYNC(src, GLOBAL_PROC_REF(jedi_spin), user)


/obj/item/twohanded/dualsaber/proc/jedi_spin(mob/living/user)
/proc/jedi_spin(mob/living/user)
for(var/i in list(NORTH, SOUTH, EAST, WEST, EAST, SOUTH, NORTH, SOUTH, EAST, WEST, EAST, SOUTH))
user.setDir(i)
if(i == WEST)
Expand Down
128 changes: 128 additions & 0 deletions code/game/objects/items/weapons/welder_sword.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/obj/item/weldingtool/sword
name = "welding sword"
desc = "Аналог энергетического меча, изготовленный из сварки неизвестным мастером из Грейтайда. Он имеет аналогичные характеристики, но наносит ожоги вместо травм в активном состоянии. Во время атаки расходует сварочное топливо."
icon = 'icons/obj/items.dmi'
icon_state = "fuelsword"
item_state = "fuelsword"
needs_permit = 1
belt_icon = null
force_enabled = 30
low_fuel_changes_icon = FALSE
block_chance = 50
item_flags = NOSHARPENING
sharp = 1
tool_behaviour = NONE
maximum_fuel = 50
origin_tech = "combat=3;magnets=4;plasmatech=5;"
/// Сan be combined with other similar item
var/combinable = TRUE


/obj/item/weldingtool/sword/toggle_welder(turn_off)
. = ..()
if(tool_enabled)
tool_behaviour = NONE
else
tool_behaviour = TOOL_WELDER

/obj/item/weldingtool/sword/update_icon_state()
. = ..()
if(tool_enabled)
icon_state = "[initial(item_state)]1"
else
icon_state = "[initial(item_state)]"

/obj/item/weldingtool/sword/tool_use_check(mob/living/user, amount, silent)
return FALSE

/obj/item/weldingtool/sword/afterattack(atom/target, mob/user, proximity, params, status)
. = ..()
if(ATTACK_CHAIN_SUCCESS_CHECK(status))
remove_fuel(1)

/obj/item/weldingtool/sword/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/weldingtool/sword) && combinable)
add_fingerprint(user)
var/obj/item/weldingtool/sword/sword = I

if(!sword.combinable)
return ATTACK_CHAIN_PROCEED

if(I == src)
to_chat(user, span_warning("You try to attach the end of sword to... itself. You're not very smart, are you?"))
user.apply_damage(10, BRAIN)
return ATTACK_CHAIN_PROCEED

if(loc == user && !user.can_unEquip(src))
return ATTACK_CHAIN_PROCEED

if(!user.drop_transfer_item_to_loc(I, src))
return ATTACK_CHAIN_PROCEED

to_chat(user, span_notice("You attach the ends of the two welder swords, making a single double-bladed weapon! You're cool."))
var/obj/item/weldingtool/sword/double/dual_sword = new(drop_location())
user.temporarily_remove_item_from_inventory(src)
user.put_in_hands(dual_sword, ignore_anim = FALSE)
qdel(I)
qdel(src)
return ATTACK_CHAIN_BLOCKED_ALL

return ..()

/obj/item/weldingtool/sword/double
name = "double-bladed welding sword"
desc = "Оружие, полученное путем объединения двух мечей из сварки в один. В отличие от двухклинкового энергетического меча, не способен отражать лазеры. Во время атаки расходует сварочное топливо."
icon_state = "fuelsworddouble"
item_state = "fuelsworddouble"
force_enabled = 40
force = 5
block_chance = 75
maximum_fuel = 70
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
origin_tech = "combat=5;magnets=5;plasmatech=6;"
combinable = FALSE

/obj/item/weldingtool/sword/double/ComponentInitialize()
AddComponent(/datum/component/two_handed, \
force_unwielded = force, \
force_wielded = force_enabled, \
wieldsound = activation_sound, \
unwieldsound = deactivation_sound, \
sharp_when_wielded = TRUE, \
wield_callback = CALLBACK(src, PROC_REF(wield)), \
unwield_callback = CALLBACK(src, PROC_REF(unwield)), \
)


/obj/item/weldingtool/sword/double/proc/wield(obj/item/source, mob/living/carbon/user)
toggle_welder()


/obj/item/weldingtool/sword/double/proc/unwield(obj/item/source, mob/living/carbon/user)
toggle_welder()


/obj/item/weldingtool/sword/double/remove_fuel(amount)
reagents.remove_reagent("fuel", amount * requires_fuel)
if(!GET_FUEL && tool_enabled)
attack_self(usr)


/obj/item/weldingtool/sword/double/try_toggle_welder(mob/user, manual_toggle = TRUE)
return ..(user, manual_toggle = FALSE)


/obj/item/weldingtool/sword/double/attack(mob/living/target, mob/living/user, params, def_zone, skip_attack_anim = FALSE)
. = ..()
if(!ATTACK_CHAIN_SUCCESS_CHECK(.) || !HAS_TRAIT(src, TRAIT_WIELDED))
return .

if(prob(50))
INVOKE_ASYNC(src, GLOBAL_PROC_REF(jedi_spin), user)


/obj/item/weldingtool/sword/double/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = ITEM_ATTACK)
if(tool_enabled)
return ..()
return FALSE

7 changes: 7 additions & 0 deletions code/modules/reagents/reagent_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
investigate_log("[key_name_log(P.firer)] triggered a fueltank explosion with [P.name]", INVESTIGATE_BOMB)
..()


/obj/structure/reagent_dispensers/fueltank/boom(rigtrigger = FALSE, log_attack = FALSE) // Prevent case where someone who rigged the tank is blamed for the explosion when the rig isn't what triggered the explosion
if(rigtrigger) // If the explosion is triggered by an assembly holder
add_attack_logs(lastrigger, src, "rigged fuel tank exploded", ATKLOG_FEW)
Expand Down Expand Up @@ -151,6 +152,12 @@


/obj/structure/reagent_dispensers/fueltank/attackby(obj/item/I, mob/user, params)

if(istype(I, /obj/item/weldingtool/sword))
if(I.tool_enabled)
boom(FALSE, TRUE)
return ATTACK_CHAIN_BLOCKED_ALL

if(istype(I, /obj/item/assembly_holder))
add_fingerprint(user)
var/obj/item/assembly_holder/assembly = I
Expand Down
Binary file modified icons/mob/inhands/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/items.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions paradise.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,7 @@
#include "code\game\objects\items\weapons\twohanded.dm"
#include "code\game\objects\items\weapons\vending_items.dm"
#include "code\game\objects\items\weapons\weaponry.dm"
#include "code\game\objects\items\weapons\welder_sword.dm"
#include "code\game\objects\items\weapons\whetstone.dm"
#include "code\game\objects\items\weapons\grenades\atmosgrenade.dm"
#include "code\game\objects\items\weapons\grenades\bananade.dm"
Expand Down