Fix runtime when mech punching objects (#34951)

This commit is contained in:
OctoKing-dev
2023-08-29 16:55:28 -04:00
committed by GitHub
parent e8b0e69d18
commit 9b27a50e70
2 changed files with 16 additions and 1 deletions

View File

@@ -102,7 +102,7 @@
src.occupant_message("You hit [target].") src.occupant_message("You hit [target].")
src.visible_message("<span class='red'><b>[src.name] hits [target]</b></span>") src.visible_message("<span class='red'><b>[src.name] hits [target]</b></span>")
if(!istype(target, /turf/simulated/wall)) if(!istype(target, /turf/simulated/wall))
target:attackby(src,src.occupant) target:attackby(src.fist,src.occupant)
else if(prob(5)) else if(prob(5))
target:dismantle_wall(1) target:dismantle_wall(1)
src.occupant_message("<span class='notice'>You smash through the wall.</span>") src.occupant_message("<span class='notice'>You smash through the wall.</span>")

View File

@@ -86,6 +86,8 @@
var/obj/item/mecha_parts/mecha_equipment/selected var/obj/item/mecha_parts/mecha_equipment/selected
var/max_equip = 3 //The maximum amount of equipment this mecha an hold at one time. var/max_equip = 3 //The maximum amount of equipment this mecha an hold at one time.
var/obj/item/weapon/mecha_fist/fist = null
var/turf/crashing = null var/turf/crashing = null
var/list/mech_parts = list() var/list/mech_parts = list()
@@ -113,6 +115,7 @@
removeVerb(/obj/mecha/verb/connect_to_port) removeVerb(/obj/mecha/verb/connect_to_port)
removeVerb(/obj/mecha/verb/toggle_internal_tank) removeVerb(/obj/mecha/verb/toggle_internal_tank)
add_cell() add_cell()
add_fist()
if(starts_with_tracking_beacon) if(starts_with_tracking_beacon)
add_tracking_beacon() add_tracking_beacon()
add_iterators() add_iterators()
@@ -174,6 +177,8 @@
connected_port = null connected_port = null
if(radio) if(radio)
QDEL_NULL(radio) QDEL_NULL(radio)
if(fist)
QDEL_NULL(fist)
if(electropack) if(electropack)
QDEL_NULL(electropack) QDEL_NULL(electropack)
if(tracking) if(tracking)
@@ -225,6 +230,11 @@
mech_parts.Add(cabin_air) mech_parts.Add(cabin_air)
return cabin_air return cabin_air
/obj/mecha/proc/add_fist()
fist = new
fist.name = "[src]'s fist"
fist.force = src.force
/obj/mecha/proc/add_radio() /obj/mecha/proc/add_radio()
radio = new(src) radio = new(src)
radio.name = "[src] radio" radio.name = "[src] radio"
@@ -2294,6 +2304,11 @@
mecha.cell.charge -= min(20,mecha.cell.charge) mecha.cell.charge -= min(20,mecha.cell.charge)
mecha.cell.maxcharge -= min(20,mecha.cell.maxcharge) mecha.cell.maxcharge -= min(20,mecha.cell.maxcharge)
/////////////
/obj/item/weapon/mecha_fist/ // An invisible weapon representing the mech's punching force. Used for melee attacks.
name = "mecha fist"
desc = "The fist of a powerful mech. You probably shouldn't be seeing this."
abstract = TRUE
///////////// /////////////