Files
Paradise/code/game/objects/items/tools/welder.dm
PollardTheDragon cd7cb01a1f Meet the Smith - New Supply Role (#28273)
* Smith role, access, access helpers, spawn point, comms, and IDs

* Area defines

* Hammertime

* Cyberiad Smith's office

* Forgot some atmos stuff

* Autolathable Hammers

* Formatting

* Toolbelts can hold hammers

* Initial work on smith machines

* Farragus Smith Office

* Placeholder sprites, mapping

* Smart hopper points and console messages

* More work on smithing machines

* Fixed mapping, added qualities, added smithed items, fixed sizing, fixed access

* Smith components, new materials

* New ores, material datums, furnace, power hammer, kinetic assembler, hammer act, item creation

* Missed one

* Grrr map conflicts begone

* Dirt begone

* Casts and smelting

* Linters

* Attack chain linters!

* Better grip to throw people into your industrial machines

* Placeholder spots in the DMIs

* UpdatePaths - Space ruins now spawn new space ores in their rocks

* Small changes - removed excess tgui code from hopper

* Fixed a button on emerald

* Attaching inserts and lenses. Tool bits are pain.

* Tool bit initial implementation

* Merge conflict resolution

* Attack chain grrr

* Fixed a pair of minor mapping issues

* Tool bit implementation, efficiency, failure rate

* Hot things burn hands

* Points fix on hopper

* New mining rocks for space exploration

* Areas on asteroids

* Machinery icons 1

Adds basic icons for the new machinery

* Vendor iconstate update

* Crucible touchups

* Hammer touchups

* Crucible Input Animation

Adds an animation when you deposit ores

* Added scanning the crucible with multitool to get mineral count

* clothing sprites part 1

* locker sprite

* job icons

* garment bag

* Smith locker mapping

* Insert and Bit removal fix

* Job menu alignment fix, Allowed_items and small spriting path fixes

* Adds new asteroid ruins to config

* Ore Sprites

* Hammer Sprite

* Item Sprites 1

* Sheets, Wall Ores and Trim

* Sheet iconstate names

* species uniforms

* Tabs

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Lens spelling fix

* Signalizes attaching and detaching modifications, fixes inserting items into smith machines, fixes cast bugs

* Fixed type lists

* Smithing machine bug fixes.

* Fixed adding modifications to items

* Crucible Lava Idle

Adds an idle animation for the crucible, but it needs overlay code to work.

* Fixed eguns

* Magma Crucible overlays and animations

* Machine broken/Off states

Adds broken, wires exposed (and on/off where appropriate) states to machines.

* Castivend recolor and Hot Items

* Overlays for all machines, new sprites for hot items, new checks, fixes

* Woe, farragus merge conflict

* update_appearance linters

* I have fat fingers.

* Forgot one

* transfer_item_to and qdel null check

* Usr to User

* Modsuits should not have inserts.

* Adds casting lip overlay

* Balance pass on movement debuffs and buffs

* Material movespeed changes

* Config Adjustments - USED FOR TESTMERGING. REVERT BEFORE FULL MERGE

* Math fixes for lenses and bits.

* Mobility suit no longer speeds you up, but negates suit-based slowdown like an oil slick potion. Fixed movement mods in material datums

* Bad var. Bad.

* Various fixes to bugs revealed in initial TM

* TYPO

* Lavaland base turf fix

* Paths in examine fix

* Adds an intercom to the workshop.

* Stamina-hybrid damage oversight fix for det revolver, uion, etc.

* Currently Operating Message fix

* Allows glass to show different turfs beneath. Adds plasmaglass section to workshop.

* Armor and upgrade fixes

* RCD tool bit equip fix

* Adds smith access to a few lists in access.dm that were missed in an oversight

* Indent fixes

* Fixes vending machine, allows tool bit use on mining equipment

* CI, you make me mad sometimes

* Removed duplicate code

* Name fix for CI again

* ORM now can handle space ores

* Adds space ores to Vetus drop and to trader inventories

* Fixes runtime with open hand attacking a lava furnace with nothing in it

* Adds crewvend kit to Castivend

* Fixes not being able to see new ores

* Adds drill and RCS to smith locker

* Map changes. Added cargo pad. Expanded catwalk. Moved vendors. Added recharger.

* Plant fixes

* Fixes doubled-up catwalk

* Emerald cargo windoor fix, small lavaland adjustment

* Small oversight for overlay fix

* Missing lightswitches

* Fixed stock parts mismatch in casting basin recipe

* Better support for power tools, grrr attackchain

* Better attack chain handling. Better handling for bit insertion

* Fixes handling of inserts with storage suits (like labcoats)

* sprites for bomber + plasmeme outfit

* Adds missing adjacency checks

* Buffs speed boost from upgrade - max upgrade reduces cycle to 2 seconds.

* Fixed floating lights, brightened the explorer's new room, expanded smith workshop slightly.

* Small hallway adjustment

* Illuminates metastation smith office

* Removes excessive decimals in magma crucible scan output

* Berserker should not have inserts.

* Buffs bit durability significantly, nerfs amplifier lens and densifier lense slightly

* Adds smith bomber jacket to loadout panel

* Adds random spawners for smithed items, adds random low-quality items to maints loot

* Adds traitor version of bulldog shotgun

* Revert "Adds traitor version of bulldog shotgun"

This reverts commit 1d39c59f07.

* Added check to assembler, moved desc changes to examine()

* plasmaman suit fix

* Fixed hot check when removing items from hammer and furnace

* Remaps lavaland workshop, fixed deltastation light switch

* Improper's the smith office name

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Compacts extra ore drops from Vetus

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* better looping

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Better loop

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Multitools don't need tool bits.

* Better variable names, fixed missing parenthesis

* Recursive hammering, removed attack animations when inserting items or using multitool on smithing machines

* window

* Update deltastation.dmm

* Update deltastation.dmm

* Update deltastation.dmm

* Fixes small oversights

* Minor lavaland remap

* Reverts TM-required changes in preparation for full merge

* Begone, stray font!

* Damn you cable CI

---------

Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Co-authored-by: ExusA <67055922+ExusA@users.noreply.github.com>
Co-authored-by: Christasmurf <25437893+Christasmurf@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Fordoxia <143041327+Fordoxia@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2025-03-15 21:35:21 +00:00

337 lines
11 KiB
Plaintext

#define GET_FUEL reagents.get_reagent_amount("fuel")
/obj/item/weldingtool
name = "welding tool"
desc = "A basic, handheld welding tool. Useful for welding bits together, and cutting them apart."
icon = 'icons/obj/tools.dmi'
icon_state = "welder"
item_state = "welder"
belt_icon = "welder"
flags = CONDUCT
slot_flags = ITEM_SLOT_BELT
force = 3
throwforce = 5
throw_speed = 3
throw_range = 5
hitsound = "swing_hit"
w_class = WEIGHT_CLASS_NORMAL
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 100, ACID = 30)
resistance_flags = FIRE_PROOF
materials = list(MAT_METAL = 400, MAT_GLASS = 100)
origin_tech = "engineering=1;plasmatech=1"
tool_behaviour = TOOL_WELDER
toolspeed = 1
tool_enabled = FALSE
usesound = 'sound/items/welder.ogg'
drop_sound = 'sound/items/handling/weldingtool_drop.ogg'
pickup_sound = 'sound/items/handling/weldingtool_pickup.ogg'
var/maximum_fuel = 20
/// Set to FALSE if it doesn't need fuel, but serves equally well as a cost modifier.
var/requires_fuel = TRUE
/// If TRUE, fuel will regenerate over time.
var/refills_over_time = FALSE
/// Sound played when turned on.
var/activation_sound = 'sound/items/welderactivate.ogg'
/// Sound played when turned off.
var/deactivation_sound = 'sound/items/welderdeactivate.ogg'
/// The brightness of the active flame.
var/light_intensity = 2
/// Does the icon_state change if the fuel is low?
var/low_fuel_changes_icon = TRUE
/// How often does the tool flash the user's eyes?
var/progress_flash_divisor = 1 SECONDS
/obj/item/weldingtool/Initialize(mapload)
. = ..()
create_reagents(maximum_fuel)
reagents.add_reagent("fuel", maximum_fuel)
update_icon()
RegisterSignal(src, COMSIG_BIT_ATTACH, PROC_REF(add_bit))
RegisterSignal(src, COMSIG_CLICK_ALT, PROC_REF(remove_bit))
/obj/item/weldingtool/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/weldingtool/examine(mob/user)
. = ..()
if(get_dist(user, src) <= 0)
. += "It contains [GET_FUEL] unit\s of fuel out of [maximum_fuel]."
/obj/item/weldingtool/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] welds [user.p_their()] every orifice closed! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return FIRELOSS
/obj/item/weldingtool/can_enter_storage(obj/item/storage/S, mob/user)
if(tool_enabled)
to_chat(user, "<span class='warning'>[S] can't hold [src] while it's lit!</span>")
return FALSE
else
return TRUE
/obj/item/weldingtool/process()
if(tool_enabled)
var/turf/T = get_turf(src)
if(T) // Implants for instance won't find a turf
T.hotspot_expose(2500, 1)
if(prob(5))
remove_fuel(1)
if(refills_over_time)
if(GET_FUEL < maximum_fuel)
reagents.add_reagent("fuel", 1)
..()
/obj/item/weldingtool/extinguish_light(force)
if(!force)
return
if(!tool_enabled)
return
remove_fuel(maximum_fuel)
/obj/item/weldingtool/attack_self__legacy__attackchain(mob/user)
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
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()
else //The welder is off and unfuelled
to_chat(user, "<span class='notice'>[src] is out of fuel!</span>")
/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
if(tool_enabled)
START_PROCESSING(SSobj, src)
damtype = BURN
force = 15
hitsound = 'sound/items/welder.ogg'
playsound(loc, activation_sound, 50, 1)
set_light(light_intensity)
else
if(!refills_over_time)
STOP_PROCESSING(SSobj, src)
damtype = BRUTE
force = 3
hitsound = "swing_hit"
playsound(loc, deactivation_sound, 50, 1)
set_light(0)
update_icon()
if(ismob(loc))
var/mob/M = loc
M.update_inv_r_hand()
M.update_inv_l_hand()
// If welding tool ran out of fuel during a construction task, construction fails.
/obj/item/weldingtool/tool_use_check(mob/living/user, amount, silent = FALSE)
if(!tool_enabled)
if(!silent)
to_chat(user, "<span class='notice'>[src] has to be on to complete this task!</span>")
return FALSE
if(GET_FUEL >= amount * requires_fuel)
return TRUE
else
if(!silent)
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task!</span>")
return FALSE
// When welding is about to start, run a normal tool_use_check, then flash a mob if it succeeds.
/obj/item/weldingtool/tool_start_check(atom/target, mob/living/user, amount=0)
. = tool_use_check(user, amount)
if(. && user && !ismob(target)) // Don't flash the user if they're repairing robo limbs or repairing a borg etc. Only flash them if the target is an object
user.flash_eyes(light_intensity)
/obj/item/weldingtool/use(amount)
amount = amount * bit_efficiency_mod
if(GET_FUEL < amount * requires_fuel)
return
remove_fuel(amount)
return TRUE
/obj/item/weldingtool/afterattack__legacy__attackchain(atom/target, mob/user, proximity, params)
. = ..()
if(!tool_enabled)
return
if(!proximity || isturf(target)) // We don't want to take away fuel when we hit something far away
return
remove_fuel(0.5)
/obj/item/weldingtool/attack__legacy__attackchain(mob/living/target, mob/living/user, def_zone)
if(cigarette_lighter_act(user, target))
return
if(tool_enabled && target.IgniteMob())
message_admins("[key_name_admin(user)] set [key_name_admin(target)] on fire")
log_game("[key_name(user)] set [key_name(target)] on fire")
return ..()
/obj/item/weldingtool/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
var/obj/item/clothing/mask/cigarette/cig = ..()
if(!cig)
return !isnull(cig)
if(!tool_enabled)
to_chat(user, "<span class='warning'>You need to activate [src] before you can light anything with it!</span>")
return TRUE
if(target == user)
user.visible_message(
"<span class='notice'>[user] casually lights [cig] with [src], what a badass.</span>",
"<span class='notice'>You light [cig] with [src].</span>"
)
else
user.visible_message(
"<span class='notice'>[user] holds out [src] out for [target], and casually lights [cig]. What a badass.</span>",
"<span class='notice'>You light [cig] for [target] with [src].</span>"
)
cig.light(user, target)
return TRUE
/obj/item/weldingtool/use_tool(atom/target, user, delay, amount, volume, datum/callback/extra_checks)
target.add_overlay(GLOB.welding_sparks)
var/did_thing = ..()
if(did_thing)
remove_fuel(1) //Consume some fuel after we do a welding action
if(delay)
progress_flash_divisor = initial(progress_flash_divisor)
target.cut_overlay(GLOB.welding_sparks)
return did_thing
/obj/item/weldingtool/tool_check_callback(mob/living/user, amount, datum/callback/extra_checks)
. = ..()
if(!. && user)
if(progress_flash_divisor == 0)
user.flash_eyes(min(light_intensity, 1))
progress_flash_divisor = initial(progress_flash_divisor)
else
progress_flash_divisor--
/obj/item/weldingtool/proc/remove_fuel(amount) //NB: doesn't check if we have enough fuel, it just removes however much is left if there's not enough
reagents.remove_reagent("fuel", amount * requires_fuel)
if(!GET_FUEL)
toggle_welder(TRUE)
/obj/item/weldingtool/refill(mob/user, atom/A, amount)
if(!A.reagents)
return
if(GET_FUEL >= maximum_fuel)
to_chat(user, "<span class='notice'>[src] is already full!</span>")
return
var/amount_transferred = A.reagents.trans_id_to(src, "fuel", amount)
if(amount_transferred)
to_chat(user, "<span class='notice'>You refuel [src] by [amount_transferred] unit\s.</span>")
playsound(src, 'sound/effects/refill.ogg', 50, 1)
update_icon()
return amount_transferred
else
to_chat(user, "<span class='warning'>There's not enough fuel in [A] to refuel [src]!</span>")
/obj/item/weldingtool/update_icon_state()
if(low_fuel_changes_icon)
var/ratio = GET_FUEL / maximum_fuel
ratio = CEILING(ratio*4, 1) * 25
if(ratio == 100)
icon_state = initial(icon_state)
else
icon_state = "[initial(icon_state)][ratio]"
if(tool_enabled)
item_state = "[initial(item_state)]1"
else
item_state = "[initial(item_state)]"
/obj/item/weldingtool/update_overlays()
. = ..()
if(tool_enabled)
. += "[initial(icon_state)]-on"
/obj/item/weldingtool/cyborg_recharge(coeff, emagged)
if(reagents.check_and_add("fuel", maximum_fuel, 2 * coeff))
update_icon()
/obj/item/weldingtool/get_heat()
return tool_enabled * 2500
/obj/item/weldingtool/largetank
name = "industrial welding tool"
desc = "A heavier welding tool with an expanded fuel reservoir. Otherwise identical to a normal welder."
icon_state = "indwelder"
belt_icon = "welder_ind"
maximum_fuel = 40
materials = list(MAT_METAL = 400, MAT_GLASS = 300)
origin_tech = "engineering=2;plasmatech=2"
/obj/item/weldingtool/largetank/cyborg
name = "integrated welding tool"
desc = "An integrated industrial welding tool used by construction and engineering robots. "
toolspeed = 0.5
/obj/item/weldingtool/research
name = "research welding tool"
desc = "A scratched-up welding tool that's been the subject of numerous aftermarket enhancements. It has a larger fuel tank, and a more focused torch than a standard welder. A label on the side reads, \"Property of Theseus\"."
icon_state = "welder_research"
item_state = "welder_research"
belt_icon = "welder_research"
maximum_fuel = 40
toolspeed = 0.75
light_intensity = 1
/obj/item/weldingtool/research/suicide_act(mob/living/user)
if(!user)
return
user.visible_message("<span class='suicide'>[user] is tinkering with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
to_chat(user, "<span class='notice'>You begin tinkering with [src]...")
user.Immobilize(10 SECONDS)
sleep(2 SECONDS)
add_fingerprint(user)
user.visible_message("<span class='danger'>[src] blows up in [user]'s face!</span>", "<span class='userdanger'>Oh, shit!</span>")
playsound(loc, "sound/effects/explosion1.ogg", 50, TRUE, -1)
user.gib()
return OBLITERATION
/obj/item/weldingtool/mini
name = "emergency welding tool"
desc = "A small, stripped down welding tool for emergency use only."
icon_state = "miniwelder"
maximum_fuel = 10
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL = 200, MAT_GLASS = 50)
low_fuel_changes_icon = FALSE
/obj/item/weldingtool/hugetank
name = "upgraded welding tool"
desc = "A large industrial welding tool with an even further upgraded fuel reservoir."
icon_state = "upindwelder"
item_state = "upindwelder"
belt_icon = "welder_upg"
maximum_fuel = 80
materials = list(MAT_METAL=70, MAT_GLASS=120)
origin_tech = "engineering=3;plasmatech=2"
/obj/item/weldingtool/experimental
name = "experimental welding tool"
desc = "A prototype welding tool which uses an experimental fuel breeder to create a near-infinite reserve of fuel. The unusual fuel mixture also means that the flame is less intense on the eyes."
icon_state = "exwelder"
item_state = "exwelder"
belt_icon = "welder_exp"
maximum_fuel = 40
materials = list(MAT_METAL=70, MAT_GLASS=120)
origin_tech = "materials=4;engineering=4;bluespace=3;plasmatech=4"
light_intensity = 1
toolspeed = 0.5
refills_over_time = TRUE
low_fuel_changes_icon = FALSE
/obj/item/weldingtool/experimental/brass
name = "brass welding tool"
desc = "A brass welder that seems to constantly refuel itself. It is faintly warm to the touch."
icon_state = "brasswelder"
item_state = "brasswelder"
belt_icon = "welder_brass"
resistance_flags = FIRE_PROOF | ACID_PROOF
#undef GET_FUEL