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

Plasma cutter fixes #804

Merged
merged 20 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@

#define iscrowbar(I) (istype(I, /obj/item/tool/crowbar))

#define isplasmacutter(I) (istype(I, /obj/item/tool/pickaxe/plasmacutter))

#define iscell(I) (istype(I, /obj/item/cell))

#define islascell(I) (istype(I, /obj/item/cell/lasgun))
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define TOOL_WIRECUTTER "wirecutter"
#define TOOL_WRENCH "wrench"
#define TOOL_WELDER "welder"
#define TOOL_WELD_CUTTER "weld_cutter"
#define TOOL_PLASMACUTTER "plasmacutter"
#define TOOL_ANALYZER "analyzer"
#define TOOL_MINING "mining"
#define TOOL_SHOVEL "shovel"
Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
return target.wirecutter_act(user, src)
if(TOOL_WELDER)
return target.welder_act(user, src)
if(TOOL_WELD_CUTTER)
return target.weld_cut_act(user, src)
if(TOOL_PLASMACUTTER)
return target.plasmacutter_act(user, src)
if(TOOL_ANALYZER)
return target.analyzer_act(user, src)
if(TOOL_FULTON)
Expand Down Expand Up @@ -336,7 +336,7 @@
return FALSE

if(!force)
return FALSE
return FALSE

if(!M)
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ directive is properly returned.
/atom/proc/welder_act(mob/living/user, obj/item/I)
return FALSE

/atom/proc/weld_cut_act(mob/living/user, obj/item/I)
/atom/proc/plasmacutter_act(mob/living/user, obj/item/I)
return FALSE

/atom/proc/analyzer_act(mob/living/user, obj/item/I)
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/effects/weeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
SSblackbox.record_feedback(FEEDBACK_TALLY, "round_statistics", 1, "weeds_destroyed")
return ..()

/obj/alien/weeds/plasmacutter_act(mob/living/user, obj/item/I)
return FALSE // Just attack normally.

/obj/alien/weeds/Initialize(mapload, obj/alien/weeds/node/node, swapped = FALSE)
. = ..()
var/static/list/connections = list(
Expand Down
19 changes: 1 addition & 18 deletions code/game/objects/items/tools/mining_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
light_range = 2
light_power = 0.6
light_color = LIGHT_COLOR_PURPLE
tool_behaviour = TOOL_PLASMACUTTER
var/cutting_sound = 'sound/items/welder2.ogg'
var/powered = FALSE
var/dirt_amt_per_dig = 5
var/obj/item/cell/rtg/large/cell //The plasma cutter cell is unremovable and recharges over time
tool_behaviour = TOOL_WELD_CUTTER

/obj/item/tool/pickaxe/plasmacutter/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -282,20 +282,3 @@
ST.update_appearance()
ST.update_sides()
cut_apart(user, target.name, target, 0, "You melt the snow with [src]. ") //costs nothing



/obj/item/tool/pickaxe/plasmacutter/attack_obj(obj/O, mob/living/user)
if(!powered || user.do_actions || CHECK_BITFIELD(O.resistance_flags, INDESTRUCTIBLE) || CHECK_BITFIELD(O.resistance_flags, PLASMACUTTER_IMMUNE))
..()
return TRUE

if(!start_cut(user, O.name, O))
return TRUE

if(!do_after(user, calc_delay(user), NONE, O, BUSY_ICON_HOSTILE))
return TRUE

cut_apart(user, O.name, O)
O.deconstruct(TRUE)
return TRUE
19 changes: 19 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,22 @@
playsound(loc, 'sound/items/welder2.ogg', 25, TRUE)
handle_weldingtool_overlay(TRUE)
return TRUE

/obj/plasmacutter_act(mob/living/user, obj/item/I)
if(user.do_actions)
return FALSE
if(!(obj_flags & CAN_BE_HIT) || CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE) || CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/plasmacutter = I
if(!plasmacutter.powered || (plasmacutter.flags_item & NOBLUDGEON))
return FALSE
if(user.a_intent == INTENT_HARM) // Attack normally.
return FALSE
if(!plasmacutter.start_cut(user, name, src))
return FALSE
if(!do_after(user, plasmacutter.calc_delay(user), NONE, src, BUSY_ICON_HOSTILE))
return TRUE

plasmacutter.cut_apart(user, name, src)
deconstruct(FALSE)
return TRUE
70 changes: 57 additions & 13 deletions code/game/objects/structures/mineral_doors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,75 @@
else
icon_state = "[base_icon_state][smoothing_flags ? "-[smoothing_junction]" : ""]"

/obj/structure/mineral_door/attackby(obj/item/W, mob/living/user)
/obj/structure/mineral_door/attackby(obj/item/attacking_item, mob/living/user)
. = ..()
if(QDELETED(src))
return

var/multiplier = 1
if(istype(W, /obj/item/tool/pickaxe/plasmacutter) && !user.do_actions)
var/obj/item/tool/pickaxe/plasmacutter/P = W
if(P.start_cut(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD))
if(istype(src, /obj/structure/mineral_door/resin))
multiplier += PLASMACUTTER_RESIN_MULTIPLIER //Plasma cutters are particularly good at destroying resin structures.
else
multiplier += PLASMACUTTER_RESIN_MULTIPLIER * 0.5
P.cut_apart(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Minimal energy cost.
if(W.damtype == BURN && istype(src, /obj/structure/mineral_door/resin)) //Burn damage deals extra vs resin structures (mostly welders).
multiplier += 1 //generally means we do double damage to resin doors
if(user.a_intent == INTENT_HARM)
return

if(!(obj_flags & CAN_BE_HIT))
return

return attacking_item.attack_obj(src, user)

take_damage(max(0, W.force * multiplier - W.force), W.damtype, MELEE)
/obj/structure/mineral_door/attacked_by(obj/item/attacking_item, mob/living/user, def_zone)
. = ..()
if(attacking_item.damtype != BURN)
return
var/damage_multiplier = get_burn_damage_multiplier(attacking_item, user, def_zone)

take_damage(max(0, attacking_item.force * damage_multiplier), attacking_item.damtype, MELEE)

/obj/structure/mineral_door/Destroy()
if(material_type)
for(var/i in 1 to rand(1,5))
new material_type(get_turf(src))
return ..()

///Takes extra damage if our attacking item does burn damage
/obj/structure/mineral_door/proc/get_burn_damage_multiplier(obj/item/attacking_item, mob/living/user, def_zone, bonus_damage = 0)
if(!isplasmacutter(attacking_item))
return bonus_damage

var/obj/item/tool/pickaxe/plasmacutter/attacking_pc = attacking_item
if(attacking_pc.start_cut(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD, no_string = TRUE))
bonus_damage += PLASMACUTTER_RESIN_MULTIPLIER * 0.5
attacking_pc.cut_apart(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Minimal energy cost.

return bonus_damage

/obj/structure/mineral_door/resin/get_burn_damage_multiplier(obj/item/attacking_item, mob/living/user, def_zone, bonus_damage = 1)
if(!isplasmacutter(attacking_item))
return bonus_damage

var/obj/item/tool/pickaxe/plasmacutter/attacking_pc = attacking_item
if(attacking_pc.start_cut(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD, no_string = TRUE))
bonus_damage += PLASMACUTTER_RESIN_MULTIPLIER
attacking_pc.cut_apart(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Minimal energy cost.

return bonus_damage

/obj/structure/mineral_door/resin/plasmacutter_act(mob/living/user, obj/item/I)
if(user.do_actions)
return FALSE
if(!(obj_flags & CAN_BE_HIT) || CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE) || CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/plasmacutter = I
if(!plasmacutter.powered || (plasmacutter.flags_item & NOBLUDGEON))
return FALSE
var/charge_cost = PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD
if(!plasmacutter.start_cut(user, name, src, charge_cost, no_string = TRUE))
return FALSE

user.changeNext_move(plasmacutter.attack_speed)
user.do_attack_animation(src, used_item = plasmacutter)
plasmacutter.cut_apart(user, name, src, charge_cost)
take_damage(max(0, plasmacutter.force * (1 + PLASMACUTTER_RESIN_MULTIPLIER)), plasmacutter.damtype, MELEE)
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)
return TRUE

/obj/structure/mineral_door/get_explosion_resistance()
if(CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
return EXPLOSION_MAX_POWER
Expand Down
37 changes: 19 additions & 18 deletions code/game/turfs/closed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@
"The stone. The rock. The boulder. Its name matters not when we consume it.",
"Delicious, delectable, simply exquisite. Just a few more minerals and it'd be perfect...")), null, 5)

/turf/closed/plasmacutter_act(mob/living/user, obj/item/I)
if(user.do_actions)
return FALSE
if(CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE) || CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
to_chat(user, span_warning("[I] can't cut through this!"))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/plasmacutter = I
if(!plasmacutter.powered || (plasmacutter.flags_item & NOBLUDGEON))
return FALSE
if(!plasmacutter.start_cut(user, name, src))
return FALSE
if(!do_after(user, PLASMACUTTER_CUT_DELAY, NONE, src, BUSY_ICON_FRIENDLY))
return FALSE

plasmacutter.cut_apart(user, name, src)
// Change targetted turf to a new one to simulate deconstruction.
ChangeTurf(open_turf_type)
return TRUE

/turf/closed/mineral/smooth
name = "rock"
icon = 'icons/turf/walls/lvwall.dmi'
Expand Down Expand Up @@ -292,24 +311,6 @@
/turf/closed/glass/thin/intersection
icon_state = "Intersection"

/turf/closed/attackby(obj/item/I, mob/user, params)
. = ..()

if(istype(I, /obj/item/tool/pickaxe/plasmacutter) && !user.do_actions)
var/obj/item/tool/pickaxe/plasmacutter/P = I
if(CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE))
to_chat(user, span_warning("[P] can't cut through this!"))
return
else if(!P.start_cut(user, name, src))
return
else if(!do_after(user, PLASMACUTTER_CUT_DELAY, NONE, src, BUSY_ICON_FRIENDLY))
return
else
P.cut_apart(user, name, src) //purely a cosmetic effect

//change targetted turf to a new one to simulate deconstruction
ChangeTurf(open_turf_type)

//Ice Thin Wall
/turf/closed/ice/thin
name = "thin ice wall"
Expand Down
27 changes: 20 additions & 7 deletions code/game/turfs/walls/resin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@
ChangeTurf(/turf/closed/wall/resin/thick)
return TRUE

/turf/closed/wall/resin/plasmacutter_act(mob/living/user, obj/item/I)
if(user.do_actions)
return FALSE
if(CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE) || CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/plasmacutter = I
if(!plasmacutter.powered || (plasmacutter.flags_item & NOBLUDGEON))
return FALSE
var/charge_cost = PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD
if(!plasmacutter.start_cut(user, name, src, charge_cost, no_string = TRUE))
return FALSE

user.changeNext_move(plasmacutter.attack_speed)
user.do_attack_animation(src, used_item = plasmacutter)
plasmacutter.cut_apart(user, name, src, charge_cost)
take_damage(max(0, plasmacutter.force * (2 + PLASMACUTTER_RESIN_MULTIPLIER)), plasmacutter.damtype, MELEE)
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)
return TRUE

/turf/closed/wall/resin/thick
name = "thick resin wall"
desc = "Weird slime solidified into a thick wall."
Expand Down Expand Up @@ -101,14 +120,8 @@
if(I.damtype == BURN) //Burn damage deals extra vs resin structures (mostly welders).
multiplier += 1

if(istype(I, /obj/item/tool/pickaxe/plasmacutter) && !user.do_actions)
var/obj/item/tool/pickaxe/plasmacutter/P = I
if(P.start_cut(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD))
multiplier += PLASMACUTTER_RESIN_MULTIPLIER
P.cut_apart(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)

damage *= max(0, multiplier)
take_damage(damage, BRUTE, MELEE)
take_damage(damage, I.damtype, MELEE)
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)

/turf/closed/wall/resin/dismantle_wall()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@
else // pump_direction == SIPHONING
icon_state = "[base_icon_state]_in"

/obj/machinery/atmospherics/components/unary/vent_pump/weld_cut_act(mob/living/user, obj/item/W)
if(istype(W, /obj/item/tool/pickaxe/plasmacutter))
var/obj/item/tool/pickaxe/plasmacutter/P = W
if(!welded)
to_chat(user, span_warning("\The [P] can only cut open welds!"))
return FALSE
if(!(P.start_cut(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)))
return FALSE
if(do_after(user, P.calc_delay(user) * PLASMACUTTER_VLOW_MOD, NONE, src, BUSY_ICON_BUILD))
P.cut_apart(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Vents require much less charge
welded = FALSE
update_icon()
return TRUE
return FALSE
/obj/machinery/atmospherics/components/unary/vent_pump/plasmacutter_act(mob/living/user, obj/item/W)
if(!isplasmacutter(W))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/P = W
if(!welded)
to_chat(user, span_warning("\The [P] can only cut open welds!"))
return FALSE
if(!(P.start_cut(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)))
return FALSE
if(do_after(user, P.calc_delay(user) * PLASMACUTTER_VLOW_MOD, NONE, src, BUSY_ICON_BUILD))
CheBokJam marked this conversation as resolved.
Show resolved Hide resolved
P.cut_apart(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Vents require much less charge
welded = FALSE
update_icon()
return TRUE

/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I)
if(iswelder(I))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@
..()
update_icon_nopipes()

/obj/machinery/atmospherics/components/unary/vent_scrubber/weld_cut_act(mob/living/user, obj/item/W)
if(istype(W, /obj/item/tool/pickaxe/plasmacutter))
var/obj/item/tool/pickaxe/plasmacutter/P = W

if(!welded)
to_chat(user, span_warning("\The [P] can only cut open welds!"))
return FALSE
if(!(P.start_cut(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)))
return FALSE
if(do_after(user, P.calc_delay(user) * PLASMACUTTER_VLOW_MOD, NONE, src, BUSY_ICON_BUILD))
P.cut_apart(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Vents require much less charge
welded = FALSE
update_icon()
return TRUE
return FALSE
/obj/machinery/atmospherics/components/unary/vent_scrubber/plasmacutter_act(mob/living/user, obj/item/W)
if(!isplasmacutter(W))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/P = W

if(!welded)
to_chat(user, span_warning("\The [P] can only cut open welds!"))
return FALSE
if(!(P.start_cut(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)))
return FALSE
if(do_after(user, P.calc_delay(user) * PLASMACUTTER_VLOW_MOD, NONE, src, BUSY_ICON_BUILD))
CheBokJam marked this conversation as resolved.
Show resolved Hide resolved
P.cut_apart(user, src.name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD) //Vents require much less charge
welded = FALSE
update_icon()
return TRUE

/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/W)
if(iswelder(W))
Expand Down
19 changes: 19 additions & 0 deletions code/modules/xenomorph/_xeno_structure.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,22 @@
balloon_alert_to_viewers("\The [xeno_attacker] tears down \the [src]!", "We tear down \the [src].")
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)
take_damage(max_integrity) // Ensure its destroyed

/obj/structure/xeno/plasmacutter_act(mob/living/user, obj/item/I)
if(user.do_actions)
return FALSE
if(!(obj_flags & CAN_BE_HIT) || CHECK_BITFIELD(resistance_flags, PLASMACUTTER_IMMUNE) || CHECK_BITFIELD(resistance_flags, INDESTRUCTIBLE))
return FALSE
var/obj/item/tool/pickaxe/plasmacutter/plasmacutter = I
CheBokJam marked this conversation as resolved.
Show resolved Hide resolved
if(!plasmacutter.powered || (plasmacutter.flags_item & NOBLUDGEON))
return FALSE
var/charge_cost = PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD
if(!plasmacutter.start_cut(user, name, src, charge_cost, no_string = TRUE))
return FALSE

user.changeNext_move(plasmacutter.attack_speed)
user.do_attack_animation(src, used_item = plasmacutter)
plasmacutter.cut_apart(user, name, src, charge_cost)
take_damage(max(0, plasmacutter.force * (1 + PLASMACUTTER_RESIN_MULTIPLIER)), plasmacutter.damtype, MELEE)
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)
return TRUE
2 changes: 1 addition & 1 deletion code/modules/xenomorph/turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
P.cut_apart(user, name, src, PLASMACUTTER_BASE_COST * PLASMACUTTER_VLOW_MOD)

damage *= max(0, multiplier)
take_damage(damage, BRUTE, MELEE)
take_damage(damage, I.damtype, MELEE)
playsound(src, SFX_ALIEN_RESIN_BREAK, 25)

///Signal handler for hard del of hostile
Expand Down
Loading