diff --git a/maps/ir/cellar.json b/maps/ir/cellar.json index 7abe4b2..a989487 100644 --- a/maps/ir/cellar.json +++ b/maps/ir/cellar.json @@ -157,7 +157,7 @@ { "name":"exitUrl", "type":"string", - "value":"cellar\/01\/01.php#start" + "value":"cellar\/01\/01.php#start_from_cellar" }], "type":"tilelayer", "visible":true, diff --git a/maps/ir/cellar/01/01.php b/maps/ir/cellar/01/01.php index 480836d..172dfc5 100644 --- a/maps/ir/cellar/01/01.php +++ b/maps/ir/cellar/01/01.php @@ -2,7 +2,7 @@ # Turn off switch $state = json_decode(file_get_contents("state.json"), true); -$state["switch"] = 0; +$state["switch_open"] = 0; file_put_contents("state.json", json_encode($state)); # Create unique copy of the complete level @@ -12,21 +12,18 @@ foreach (glob("*.*") as $f) copy($f, $sub."/".$f); copy(".htaccess", $sub."/.htaccess"); -// Replace level worker -copy("01_sub.php", $sub."/"."01.php"); - -# Patch paths of the copied level -$data = file_get_contents("$sub"."/01.json"); +# Patch paths of the copied maps +$data = file_get_contents("$sub"."/room_open.json"); $data = str_replace("..\/..", "..\/..\/..", $data); -file_put_contents("$sub"."/01.json", $data); +file_put_contents("$sub"."/room_open.json", $data); -$data = file_get_contents("$sub"."/01_closed.json"); +$data = file_get_contents("$sub"."/room_closed.json"); $data = str_replace("..\/..", "..\/..\/..", $data); -file_put_contents("$sub"."/01_closed.json", $data); +file_put_contents("$sub"."/room_closed.json", $data); # Load current level and patch exits to target the copy -$data = file_get_contents("01.json"); -$data = str_replace("01.php#", "$sub"."/"."01.php#", $data); +$data = file_get_contents("room_open.json"); +$data = str_replace("room.php#", "$sub"."/"."room.php#", $data); // Patch php filenames with timestamps to defeat cache // destination.php --> destination.number.php diff --git a/maps/ir/cellar/01/01_sub.php b/maps/ir/cellar/01/room.php similarity index 79% rename from maps/ir/cellar/01/01_sub.php rename to maps/ir/cellar/01/room.php index e7fd405..d9cdcf3 100644 --- a/maps/ir/cellar/01/01_sub.php +++ b/maps/ir/cellar/01/room.php @@ -2,10 +2,10 @@ # Load state and test switch $state = json_decode(file_get_contents("state.json"), true); -$switch = $state["switch"]; +$switch = $state["switch_open"]; # Load open/closed level depending on switch -$data = file_get_contents( $switch ? "01.json" : "01_closed.json"); +$data = file_get_contents( $switch ? "room_open.json" : "room_closed.json"); // Patch php filenames with timestamps to defeat cache // destination.php --> destination.number.php diff --git a/maps/ir/cellar/01/01_closed.json b/maps/ir/cellar/01/room_closed.json similarity index 99% rename from maps/ir/cellar/01/01_closed.json rename to maps/ir/cellar/01/room_closed.json index c96f4e2..d2fbf1b 100644 --- a/maps/ir/cellar/01/01_closed.json +++ b/maps/ir/cellar/01/room_closed.json @@ -67,7 +67,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_B_from_C" + "value":"room.php#start_B_from_C" }], "type":"tilelayer", "visible":true, @@ -103,7 +103,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_C_from_B" + "value":"room.php#start_C_from_B" }], "type":"tilelayer", "visible":true, @@ -139,7 +139,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_A_from_B" + "value":"room.php#start_A_from_B" }], "type":"tilelayer", "visible":true, @@ -175,7 +175,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_B_from_A" + "value":"room.php#start_B_from_A" }], "type":"tilelayer", "visible":true, diff --git a/maps/ir/cellar/01/01.json b/maps/ir/cellar/01/room_open.json similarity index 99% rename from maps/ir/cellar/01/01.json rename to maps/ir/cellar/01/room_open.json index 7b44058..6ce829b 100644 --- a/maps/ir/cellar/01/01.json +++ b/maps/ir/cellar/01/room_open.json @@ -67,7 +67,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_B_from_C" + "value":"room.php#start_B_from_C" }], "type":"tilelayer", "visible":true, @@ -103,7 +103,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_C_from_B" + "value":"room.php#start_C_from_B" }], "type":"tilelayer", "visible":true, @@ -139,7 +139,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_A_from_B" + "value":"room.php#start_A_from_B" }], "type":"tilelayer", "visible":true, @@ -175,7 +175,7 @@ { "name":"exitUrl", "type":"string", - "value":"01.php#start_B_from_A" + "value":"room.php#start_B_from_A" }], "type":"tilelayer", "visible":true, @@ -223,7 +223,7 @@ "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "height":25, "id":6, - "name":"switch_audio", + "name":"audio_switch_open", "opacity":1, "properties":[ { @@ -248,7 +248,7 @@ "x":0, "y":0 }], - "nextlayerid":15, + "nextlayerid":16, "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", diff --git a/maps/ir/cellar/01/state.json b/maps/ir/cellar/01/state.json index 0e6c398..65e812e 100644 --- a/maps/ir/cellar/01/state.json +++ b/maps/ir/cellar/01/state.json @@ -1,4 +1,4 @@ { - "switch":0 , + "switch_open":0, "foo": "bar" } \ No newline at end of file diff --git a/maps/ir/cellar/01/switch.php b/maps/ir/cellar/01/switch.php index 3a32779..3e9fead 100644 --- a/maps/ir/cellar/01/switch.php +++ b/maps/ir/cellar/01/switch.php @@ -1,6 +1,6 @@