From c5590d851aed39adb3930777896aee14ece8bffe Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Sun, 1 Jan 2017 11:02:32 +0100 Subject: [PATCH] add liquid test which causes an error on material change --- planet/Tests.ocf/LiquidSystem.ocs/Script.c | 49 ++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/planet/Tests.ocf/LiquidSystem.ocs/Script.c b/planet/Tests.ocf/LiquidSystem.ocs/Script.c index ac457c9f5..7ca0e2d32 100644 --- a/planet/Tests.ocf/LiquidSystem.ocs/Script.c +++ b/planet/Tests.ocf/LiquidSystem.ocs/Script.c @@ -281,8 +281,44 @@ global func Test3_OnFinished() return; } - global func Test4_OnStart(int plr) +{ + DrawMatBasin("DuroLava", 20, 120); + + var foundry = CreateObjectAbove(Foundry, 110, 160, plr); + foundry->CreateContents(Earth, 10); + foundry->AddToQueue(Loam, 2); + + var pump = CreateObjectAbove(Pump, 84, 160, plr); + var source = CreateObject(Pipe, 168, 292, plr); + source->ConnectPipeTo(pump, PIPE_STATE_Source); + var drain = CreateObjectAbove(Pipe, 240, 100, plr); + drain->ConnectPipeTo(pump, PIPE_STATE_Drain); + drain->ConnectPipeTo(foundry, PIPE_STATE_Drain); + + ScheduleCall(source, "SetPosition", 100, 0, 20, 120); + ScheduleCall(foundry, "DoCutPipe", 200, 0, drain); + + // Log what the test is about. + Log("Test air switching pumping materials after connection changes."); + return true; +} + +global func Test4_Completed() +{ + + return false; +} + +global func Test4_OnFinished() +{ + RemoveAll(Find_Or(Find_ID(Foundry), Find_ID(Pump), Find_ID(Loam))); + RestoreWaterLevels(); + return; +} + + +global func Test5_OnStart(int plr) { RemoveAll(Find_ID(Rule_NoPowerNeed)); @@ -300,14 +336,14 @@ global func Test4_OnStart(int plr) return true; } -global func Test4_Completed() +global func Test5_Completed() { if (ObjectCount(Find_ID(DivingHelmet), Find_NoContainer()) >= 1) return true; return false; } -global func Test4_OnFinished() +global func Test5_OnFinished() { RemoveAll(Find_Or(Find_ID(DivingHelmet), Find_ID(Pump), Find_ID(Pipe), Find_ID(SteamEngine))); RestoreWaterLevels(); @@ -329,6 +365,13 @@ global func RestoreWaterLevels() return; } +global func DrawMatBasin(string mat, int x, int y) +{ + DrawMaterialQuad("Brick", x - 10, y - 10, x - 10, y + 10, x + 10, y + 10, x + 10, y - 10); + DrawMaterialQuad(mat, x - 6, y - 6, x - 6, y + 6, x + 6, y + 6, x + 6, y - 6); + return; +} + global func RemoveWater() { for (var x = 144; x <= 208 + 1; x++)