Attack Chain Migration: /turf (#27530)

* Attack Chain Migration: /turf

* don't clobber component/signal vars when copying holodeck turfs

* Attack Chain Migration: /turf

* don't clobber component/signal vars when copying holodeck turfs

* Fixes from first round of testing

* rename signals, add afterattack skip

* Update code/game/turfs/simulated/minerals.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: warriorstar-orion <orion@snowfrost.garden>

* Add some tests.

* Update code/game/turfs/simulated/minerals.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: warriorstar-orion <orion@snowfrost.garden>

* fix TM issues

* make soap instantaneous and remove hardcoded sleep

* add sentinel value for obj placement direction choice

* fix tests

---------

Signed-off-by: warriorstar-orion <orion@snowfrost.garden>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
warriorstar-orion
2025-01-10 21:15:19 +00:00
committed by GitHub
co-authored by Luc
parent 27db7ad209
commit 3db86c80ac
23 changed files with 349 additions and 235 deletions
+28 -4
View File
@@ -34,10 +34,17 @@
origin_test.Fail("could not spawn obj [obj_type] in hand of [puppet]")
/datum/test_puppeteer/proc/spawn_obj_nearby(obj_type)
for(var/turf/T in RANGE_TURFS(1, puppet.loc))
if(!is_blocked_turf(T, exclude_mobs = FALSE))
return origin_test.allocate(obj_type, T)
/datum/test_puppeteer/proc/spawn_obj_nearby(obj_type, direction = -1)
var/turf/T
if(direction >= 0)
T = get_step(puppet, direction)
else
for(var/turf/nearby in RANGE_TURFS(1, puppet.loc))
if(!is_blocked_turf(nearby, exclude_mobs = FALSE))
T = nearby
if(T)
return origin_test.allocate(obj_type, T)
origin_test.Fail("could not spawn obj [obj_type] near [src]")
@@ -56,6 +63,23 @@
var/mob/new_mob = origin_test.allocate(mob_type, T)
return new_mob
/datum/test_puppeteer/proc/change_turf_nearby(turf_type, direction = -1)
var/turf/T
if(direction >= 0)
T = get_step(puppet, direction)
else
// just check for any contents, not blocked_turf which includes turf density
// (which we don't really care about)
for(var/turf/nearby in RANGE_TURFS(1, puppet))
if(!length(nearby.contents))
T = nearby
if(T)
T.ChangeTurf(turf_type)
return T
origin_test.Fail("could not spawn turf [turf_type] near [src]")
/datum/test_puppeteer/proc/check_attack_log(snippet)
for(var/log_text in puppet.attack_log_old)
if(findtextEx(log_text, snippet))
@@ -0,0 +1,47 @@
/datum/game_test/attack_chain_turf/Run()
var/datum/test_puppeteer/player = new(src)
var/area/admin_area = get_area(player.puppet)
// So we can actually place a mounted frame here
admin_area.requires_power = TRUE
var/turf/wall = player.change_turf_nearby(/turf/simulated/wall, EAST)
player.spawn_obj_in_hand(/obj/item/mounted/frame/alarm_frame)
player.click_on(wall)
TEST_ASSERT(locate(/obj/machinery/alarm) in player.puppet.loc, "Did not find built air alarm frame")
admin_area.requires_power = FALSE
var/turf/plating = player.change_turf_nearby(/turf/simulated/floor/plating)
var/obj/item/stack/rods/rods = player.spawn_obj_in_hand(/obj/item/stack/rods/fifty)
rods.toolspeed = 0 // Don't want to try waiting this out in a test
player.click_on(plating)
var/turf/engine = get_turf(plating)
TEST_ASSERT(istype(engine, /turf/simulated/floor/engine), "Did not find plating converted to engine floor")
player.puppet.drop_item_to_ground(rods, force = TRUE)
var/obj/item/storage/bag/ore/ore_bag = player.spawn_obj_in_hand(/obj/item/storage/bag/ore)
var/obj/item/stack/ore/gold/gold = player.spawn_obj_nearby(/obj/item/stack/ore/gold, SOUTH)
var/turf/asteroid = player.change_turf_nearby(/turf/simulated/floor/plating/asteroid, SOUTH)
player.click_on(asteroid)
TEST_ASSERT(gold in ore_bag, "Did not find gold in ore bag")
qdel(ore_bag)
plating = player.change_turf_nearby(/turf/simulated/floor/plating)
var/obj/rpd = player.spawn_obj_in_hand(/obj/item/rpd)
player.click_on(plating)
TEST_ASSERT(locate(/obj/machinery/atmospherics/pipe) in plating, "Did not find pipe placed with RPD")
qdel(rpd)
var/obj/resonator = player.spawn_obj_in_hand(/obj/item/resonator)
var/turf/mineral_wall = player.change_turf_nearby(/turf/simulated/mineral/ancient)
player.click_on(mineral_wall)
sleep(3 SECONDS)
TEST_ASSERT(istype(get_turf(mineral_wall), /turf/simulated/floor/plating/asteroid), "Did not find mineral wall dug with resonator")
qdel(resonator)
var/obj/item/soap/soap = player.spawn_obj_in_hand(/obj/item/soap)
soap.cleanspeed = 0
var/turf/T = get_turf(player.puppet)
new/obj/effect/spawner/themed_mess/bloody(T)
TEST_ASSERT(locate(/obj/effect/decal/cleanable) in T, "Did not find any mess decal on turf")
player.click_on(T)
TEST_ASSERT_NOT(locate(/obj/effect/decal/cleanable) in T, "Mess decal remained on turf after soap use")
+1
View File
@@ -6,6 +6,7 @@
#include "_game_test.dm"
#include "atmos\test_ventcrawl.dm"
#include "attack_chain\test_attack_chain_cult_dagger.dm"
#include "attack_chain\test_attack_chain_turf.dm"
#include "attack_chain\test_attack_chain_vehicles.dm"
#include "games\test_cards.dm"
#include "jobs\test_job_globals.dm"