mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[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:
committed by
GitHub
parent
7e9ad48982
commit
ad5a944c8a
@@ -74,7 +74,8 @@
|
|||||||
|
|
||||||
/datum/construction/proc/spawn_result()
|
/datum/construction/proc/spawn_result()
|
||||||
if(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()
|
spawn()
|
||||||
qdel(holder)
|
qdel(holder)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/ripley
|
/datum/construction/reversible/mecha/ripley
|
||||||
result = "/obj/mecha/working/ripley"
|
result = /obj/mecha/working/ripley
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -307,7 +307,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/gygax
|
/datum/construction/reversible/mecha/gygax
|
||||||
result = "/obj/mecha/combat/gygax"
|
result = /obj/mecha/combat/gygax
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -589,7 +589,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/serenity
|
/datum/construction/reversible/mecha/serenity
|
||||||
result = "/obj/mecha/combat/gygax/serenity"
|
result = /obj/mecha/combat/gygax/serenity
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -872,7 +872,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/firefighter
|
/datum/construction/reversible/mecha/firefighter
|
||||||
result = "/obj/mecha/working/ripley/firefighter"
|
result = /obj/mecha/working/ripley/firefighter
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -1092,7 +1092,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/durand
|
/datum/construction/reversible/mecha/durand
|
||||||
result = "/obj/mecha/combat/durand"
|
result = /obj/mecha/combat/durand
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -1374,7 +1374,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/odysseus
|
/datum/construction/reversible/mecha/odysseus
|
||||||
result = "/obj/mecha/medical/odysseus"
|
result = /obj/mecha/medical/odysseus
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -1554,7 +1554,7 @@
|
|||||||
// Phazon
|
// Phazon
|
||||||
//////////////////////
|
//////////////////////
|
||||||
/datum/construction/mecha/phazon_chassis
|
/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
|
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_left_arm),//2
|
||||||
list("key"=/obj/item/mecha_parts/part/phazon_right_arm),//3
|
list("key"=/obj/item/mecha_parts/part/phazon_right_arm),//3
|
||||||
@@ -1583,7 +1583,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/phazon
|
/datum/construction/reversible/mecha/phazon
|
||||||
result = "/obj/mecha/combat/phazon"
|
result = /obj/mecha/combat/phazon
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -1833,7 +1833,7 @@
|
|||||||
// Janus
|
// Janus
|
||||||
//////////////////////
|
//////////////////////
|
||||||
/datum/construction/mecha/janus_chassis
|
/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
|
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_left_arm),//2
|
||||||
list("key"=/obj/item/mecha_parts/part/janus_right_arm),//3
|
list("key"=/obj/item/mecha_parts/part/janus_right_arm),//3
|
||||||
@@ -1862,7 +1862,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/janus
|
/datum/construction/reversible/mecha/janus
|
||||||
result = "/obj/mecha/combat/phazon/janus"
|
result = /obj/mecha/combat/phazon/janus
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -2138,7 +2138,7 @@
|
|||||||
// Pinnace
|
// Pinnace
|
||||||
//////////////////////
|
//////////////////////
|
||||||
/datum/construction/mecha/fighter/pinnace_chassis
|
/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
|
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_cockpit),//2
|
||||||
list("key"=/obj/item/mecha_parts/fighter/part/pinnace_main_engine),//3
|
list("key"=/obj/item/mecha_parts/fighter/part/pinnace_main_engine),//3
|
||||||
@@ -2168,7 +2168,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/fighter/pinnace
|
/datum/construction/reversible/mecha/fighter/pinnace
|
||||||
result = "/obj/mecha/combat/fighter/pinnace"
|
result = /obj/mecha/combat/fighter/pinnace
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -2421,7 +2421,7 @@
|
|||||||
// Baron
|
// Baron
|
||||||
//////////////////////
|
//////////////////////
|
||||||
/datum/construction/mecha/fighter/baron_chassis
|
/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
|
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_cockpit),//2
|
||||||
list("key"=/obj/item/mecha_parts/fighter/part/baron_main_engine),//3
|
list("key"=/obj/item/mecha_parts/fighter/part/baron_main_engine),//3
|
||||||
@@ -2451,7 +2451,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/fighter/baron
|
/datum/construction/reversible/mecha/fighter/baron
|
||||||
result = "/obj/mecha/combat/fighter/baron"
|
result = /obj/mecha/combat/fighter/baron
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/scarab
|
/datum/construction/reversible/mecha/scarab
|
||||||
result = "/obj/mecha/combat/scarab"
|
result = /obj/mecha/combat/scarab
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/polecat
|
/datum/construction/reversible/mecha/polecat
|
||||||
result = "/obj/mecha/micro/sec/polecat"
|
result = /obj/mecha/micro/sec/polecat
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/gopher
|
/datum/construction/reversible/mecha/gopher
|
||||||
result = "/obj/mecha/micro/utility/gopher"
|
result = /obj/mecha/micro/utility/gopher
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
@@ -514,7 +514,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/weasel
|
/datum/construction/reversible/mecha/weasel
|
||||||
result = "/obj/mecha/micro/sec/weasel"
|
result = /obj/mecha/micro/sec/weasel
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
|
|||||||
@@ -91,6 +91,7 @@
|
|||||||
#include "autowiki.dm"
|
#include "autowiki.dm"
|
||||||
//#include "clothing_tests.dm" // FIXME
|
//#include "clothing_tests.dm" // FIXME
|
||||||
#include "component_tests.dm"
|
#include "component_tests.dm"
|
||||||
|
#include "construction_tests.dm"
|
||||||
#include "cosmetic_tests.dm"
|
#include "cosmetic_tests.dm"
|
||||||
#include "dcs_check_list_arguments.dm"
|
#include "dcs_check_list_arguments.dm"
|
||||||
#include "dcs_get_id_from_elements.dm"
|
#include "dcs_get_id_from_elements.dm"
|
||||||
|
|||||||
11
code/modules/unit_tests/construction_tests.dm
Normal file
11
code/modules/unit_tests/construction_tests.dm
Normal 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.")
|
||||||
@@ -112,7 +112,8 @@
|
|||||||
while(S.cores)
|
while(S.cores)
|
||||||
playsound(src, 'sound/machines/juicer.ogg', 25, 1)
|
playsound(src, 'sound/machines/juicer.ogg', 25, 1)
|
||||||
if(do_after(user, 15, target = src))
|
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)
|
playsound(src, 'sound/effects/splat.ogg', 50, 1)
|
||||||
S.cores--
|
S.cores--
|
||||||
qdel(S)
|
qdel(S)
|
||||||
|
|||||||
@@ -82,7 +82,8 @@
|
|||||||
if(istype(AM, /mob/living/simple_mob/slime))
|
if(istype(AM, /mob/living/simple_mob/slime))
|
||||||
var/mob/living/simple_mob/slime/S = AM
|
var/mob/living/simple_mob/slime/S = AM
|
||||||
while(S.cores)
|
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)
|
playsound(src, 'sound/effects/splat.ogg', 50, 1)
|
||||||
S.cores--
|
S.cores--
|
||||||
sleep(1 SECOND)
|
sleep(1 SECOND)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//Hades Construction//
|
//Hades Construction//
|
||||||
/datum/construction/mecha/hades_chassis
|
/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
|
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_left_arm),//2
|
||||||
list("key"=/obj/item/mecha_parts/part/hades_right_arm),//3
|
list("key"=/obj/item/mecha_parts/part/hades_right_arm),//3
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/datum/construction/reversible/mecha/hades
|
/datum/construction/reversible/mecha/hades
|
||||||
result = "/obj/mecha/combat/phazon"
|
result = /obj/mecha/combat/phazon
|
||||||
steps = list(
|
steps = list(
|
||||||
//1
|
//1
|
||||||
list("key"=IS_WELDER,
|
list("key"=IS_WELDER,
|
||||||
|
|||||||
Reference in New Issue
Block a user