[MIRROR] Mech construction fix and unittest (#12062)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
Co-authored-by: C.L. <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-11-29 22:05:21 -07:00
committed by GitHub
parent 7e9ad48982
commit ad5a944c8a
9 changed files with 38 additions and 23 deletions

View File

@@ -74,7 +74,8 @@
/datum/construction/proc/spawn_result()
if(result)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MECH_CONSTRUCTED, new result(get_turf(holder)))
var/atom/spawned_construct = new result(get_turf(holder))
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MECH_CONSTRUCTED, spawned_construct)
spawn()
qdel(holder)
return

View File

@@ -99,7 +99,7 @@
/datum/construction/reversible/mecha/ripley
result = "/obj/mecha/working/ripley"
result = /obj/mecha/working/ripley
steps = list(
//1
list("key"=IS_WELDER,
@@ -307,7 +307,7 @@
/datum/construction/reversible/mecha/gygax
result = "/obj/mecha/combat/gygax"
result = /obj/mecha/combat/gygax
steps = list(
//1
list("key"=IS_WELDER,
@@ -589,7 +589,7 @@
/datum/construction/reversible/mecha/serenity
result = "/obj/mecha/combat/gygax/serenity"
result = /obj/mecha/combat/gygax/serenity
steps = list(
//1
list("key"=IS_WELDER,
@@ -872,7 +872,7 @@
/datum/construction/reversible/mecha/firefighter
result = "/obj/mecha/working/ripley/firefighter"
result = /obj/mecha/working/ripley/firefighter
steps = list(
//1
list("key"=IS_WELDER,
@@ -1092,7 +1092,7 @@
/datum/construction/reversible/mecha/durand
result = "/obj/mecha/combat/durand"
result = /obj/mecha/combat/durand
steps = list(
//1
list("key"=IS_WELDER,
@@ -1374,7 +1374,7 @@
/datum/construction/reversible/mecha/odysseus
result = "/obj/mecha/medical/odysseus"
result = /obj/mecha/medical/odysseus
steps = list(
//1
list("key"=IS_WELDER,
@@ -1554,7 +1554,7 @@
// Phazon
//////////////////////
/datum/construction/mecha/phazon_chassis
result = "/obj/mecha/combat/phazon"
result = /obj/mecha/combat/phazon
steps = list(list("key"=/obj/item/mecha_parts/part/phazon_torso),//1
list("key"=/obj/item/mecha_parts/part/phazon_left_arm),//2
list("key"=/obj/item/mecha_parts/part/phazon_right_arm),//3
@@ -1583,7 +1583,7 @@
return
/datum/construction/reversible/mecha/phazon
result = "/obj/mecha/combat/phazon"
result = /obj/mecha/combat/phazon
steps = list(
//1
list("key"=IS_WELDER,
@@ -1833,7 +1833,7 @@
// Janus
//////////////////////
/datum/construction/mecha/janus_chassis
result = "/obj/mecha/combat/phazon/janus"
result = /obj/mecha/combat/phazon/janus
steps = list(list("key"=/obj/item/mecha_parts/part/janus_torso),//1
list("key"=/obj/item/mecha_parts/part/janus_left_arm),//2
list("key"=/obj/item/mecha_parts/part/janus_right_arm),//3
@@ -1862,7 +1862,7 @@
return
/datum/construction/reversible/mecha/janus
result = "/obj/mecha/combat/phazon/janus"
result = /obj/mecha/combat/phazon/janus
steps = list(
//1
list("key"=IS_WELDER,
@@ -2138,7 +2138,7 @@
// Pinnace
//////////////////////
/datum/construction/mecha/fighter/pinnace_chassis
result = "/obj/mecha/combat/fighter/pinnace"
result = /obj/mecha/combat/fighter/pinnace
steps = list(list("key"=/obj/item/mecha_parts/fighter/part/pinnace_core),//1
list("key"=/obj/item/mecha_parts/fighter/part/pinnace_cockpit),//2
list("key"=/obj/item/mecha_parts/fighter/part/pinnace_main_engine),//3
@@ -2168,7 +2168,7 @@
return
/datum/construction/reversible/mecha/fighter/pinnace
result = "/obj/mecha/combat/fighter/pinnace"
result = /obj/mecha/combat/fighter/pinnace
steps = list(
//1
list("key"=IS_WELDER,
@@ -2421,7 +2421,7 @@
// Baron
//////////////////////
/datum/construction/mecha/fighter/baron_chassis
result = "/obj/mecha/combat/fighter/baron"
result = /obj/mecha/combat/fighter/baron
steps = list(list("key"=/obj/item/mecha_parts/fighter/part/baron_core),//1
list("key"=/obj/item/mecha_parts/fighter/part/baron_cockpit),//2
list("key"=/obj/item/mecha_parts/fighter/part/baron_main_engine),//3
@@ -2451,7 +2451,7 @@
return
/datum/construction/reversible/mecha/fighter/baron
result = "/obj/mecha/combat/fighter/baron"
result = /obj/mecha/combat/fighter/baron
steps = list(
//1
list("key"=IS_WELDER,

View File

@@ -28,7 +28,7 @@
/datum/construction/reversible/mecha/scarab
result = "/obj/mecha/combat/scarab"
result = /obj/mecha/combat/scarab
steps = list(
//1
list("key"=IS_WELDER,

View File

@@ -29,7 +29,7 @@
/datum/construction/reversible/mecha/polecat
result = "/obj/mecha/micro/sec/polecat"
result = /obj/mecha/micro/sec/polecat
steps = list(
//1
list("key"=IS_WELDER,
@@ -308,7 +308,7 @@
/datum/construction/reversible/mecha/gopher
result = "/obj/mecha/micro/utility/gopher"
result = /obj/mecha/micro/utility/gopher
steps = list(
//1
list("key"=IS_WELDER,
@@ -514,7 +514,7 @@
/datum/construction/reversible/mecha/weasel
result = "/obj/mecha/micro/sec/weasel"
result = /obj/mecha/micro/sec/weasel
steps = list(
//1
list("key"=IS_WELDER,

View File

@@ -91,6 +91,7 @@
#include "autowiki.dm"
//#include "clothing_tests.dm" // FIXME
#include "component_tests.dm"
#include "construction_tests.dm"
#include "cosmetic_tests.dm"
#include "dcs_check_list_arguments.dm"
#include "dcs_get_id_from_elements.dm"

View File

@@ -0,0 +1,11 @@
/datum/unit_test/mech_construction/Run()
var/failed = FALSE
for(var/datum/construction/C as anything in subtypesof(/datum/construction))
// We check for null, as null is legal here... For now... Mech construction needs a full refactor to make them unittest-able in a not ugly way.
if(!C.result)
continue
if(!ispath(C.result))
TEST_NOTICE(src, "[C.type]: Mech Construction - Had invalid result \"[C.result]\", must be a path.")
failed = TRUE
if(failed)
TEST_FAIL("Mech Construction - A construction datum had incorrect data.")

View File

@@ -112,7 +112,8 @@
while(S.cores)
playsound(src, 'sound/machines/juicer.ogg', 25, 1)
if(do_after(user, 15, target = src))
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_HARVEST_SLIME_CORE, new S.coretype(get_turf(AM)))
var/atom/new_core = new S.coretype(get_turf(AM))
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_HARVEST_SLIME_CORE, new_core)
playsound(src, 'sound/effects/splat.ogg', 50, 1)
S.cores--
qdel(S)

View File

@@ -82,7 +82,8 @@
if(istype(AM, /mob/living/simple_mob/slime))
var/mob/living/simple_mob/slime/S = AM
while(S.cores)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_HARVEST_SLIME_CORE, new S.coretype(get_turf(src)))
var/atom/new_core = new S.coretype(get_turf(src))
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_HARVEST_SLIME_CORE, new_core)
playsound(src, 'sound/effects/splat.ogg', 50, 1)
S.cores--
sleep(1 SECOND)

View File

@@ -1,6 +1,6 @@
//Hades Construction//
/datum/construction/mecha/hades_chassis
result = "/obj/mecha/combat/hades"
result = /obj/mecha/combat/hades
steps = list(list("key"=/obj/item/mecha_parts/part/hades_torso),//1
list("key"=/obj/item/mecha_parts/part/hades_left_arm),//2
list("key"=/obj/item/mecha_parts/part/hades_right_arm),//3
@@ -29,7 +29,7 @@
return
/datum/construction/reversible/mecha/hades
result = "/obj/mecha/combat/phazon"
result = /obj/mecha/combat/phazon
steps = list(
//1
list("key"=IS_WELDER,