Skip to content

Commit

Permalink
add: welder sword (#5976)
Browse files Browse the repository at this point in the history
* add: welder sword

* fix

* bugfix

* text fixes

* fix

* fix

* Правки перевода по замечаниям ведущего кодера

* remove double desc
  • Loading branch information
dageavtobusnick authored Jan 2, 2025
1 parent 3ad262c commit bde72a0
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 8 deletions.
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))
return ..()

/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
balloon_alert(user, "выключено")
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()
balloon_alert(user, "включено")
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>")
balloon_alert(user, "нет топлива!")
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] непринуждённо зажига[pluralize_ru(user, "ет", "ют")] [declent_ru(ACCUSATIVE)] с помощью [I.declent_ru(GENITIVE)]. Чёрт, как же он[genderize_ru(user.gender, "", "а", "о", "и")] крут[genderize_ru(user.gender, "", "а", "о", "ы")]."))
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
144 changes: 144 additions & 0 deletions code/game/objects/items/weapons/welder_sword.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/obj/item/weldingtool/sword
name = "welding sword"
desc = "Сварочный аппарат, кустарно модифицированный каким-то умельцем. Судя по всему, автор этого творения черпал вдохновение от энергетических мечей."
ru_names = list(
NOMINATIVE = "сварочный меч",
GENITIVE = "сварочного меча",
DATIVE = "сварочному мечу",
ACCUSATIVE = "сварочный меч",
INSTRUMENTAL = "сварочным мечом",
PREPOSITIONAL = "сварочном мече"
)
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("Вы пытаетесь приделать конец меча к... мечу. Это было очень глупо."))
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

balloon_alert(user, "скреплено вместе")
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 = "Два кустарно модифицированных сварочных аппарата, скреплённых вместе, образуя некое подобие двойного энергетического меча. Настоящее чудо ассистентской мысли."
ru_names = list(
NOMINATIVE = "двойной сварочный меч",
GENITIVE = "двойного сварочного меча",
DATIVE = "двойному сварочному мечу",
ACCUSATIVE = "двойной сварочный меч",
INSTRUMENTAL = "двойным сварочным мечом",
PREPOSITIONAL = "двойном сварочном мече"
)
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

6 changes: 6 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,11 @@


/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 @@ -1297,6 +1297,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

0 comments on commit bde72a0

Please sign in to comment.