cleanup cellar01

master
Stephan Messlinger 2021-02-16 04:51:02 +01:00
parent cd9ca9500f
commit cb1c39e7dc
8 changed files with 52 additions and 39 deletions

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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, 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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],
"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",

View File

@ -1,4 +1,4 @@
{
"switch":0 ,
"switch_open":0,
"foo": "bar"
}

View File

@ -1,6 +1,6 @@
<?php
$state = json_decode(file_get_contents("state.json"), true);
$state["switch"] = 1;
$state["switch_open"] = 1;
file_put_contents("state.json", json_encode($state));
# Load current level and patch exits to target the copy

View File

@ -3,12 +3,14 @@
"height": 4300,
"width": 2
},
"activeFile": "garden.json",
"activeFile": "cellar/01/room_open.json",
"expandedProjectPaths": [
"randmaze",
"gmaze",
"cellar/01",
"cellar",
"tiles",
".",
"cellar/01"
"randmaze"
],
"file.lastUsedOpenFilter": "Alle Dateien (*)",
"fileStates": {
@ -88,7 +90,7 @@
"scale": 1.5,
"selectedLayer": 9,
"viewCenter": {
"x": 3826.333333333333,
"x": 3825.6666666666665,
"y": 127.66666666666669
}
},
@ -142,6 +144,17 @@
"cellar/01/02_open.json#mapUtilities": {
"scaleInDock": 1
},
"cellar/01/room_open.json": {
"scale": 0.8465435606060606,
"selectedLayer": 13,
"viewCenter": {
"x": 528.6201689132502,
"y": 401.0425639017842
}
},
"cellar/01/room_open.json#mapUtilities": {
"scaleInDock": 1
},
"garden.json": {
"scale": 0.5,
"selectedLayer": 18,
@ -864,23 +877,26 @@
"cellar/01/01.json",
"tiles/mapUtilities.json",
"cellar/01/01_closed.json",
"tiles/cija.json"
"tiles/cija.json",
"gmaze/gmaze.json",
"gmaze/right.json",
"cellar/01/room_open.json"
],
"project": "ir.tiled-project",
"property.type": "string",
"recentFiles": [
"cellar.json",
"lobby.json",
"tiles/cija.json",
"cellar/01/01_closed.json",
"tiles/mapUtilities.json",
"cellar/01/01.json",
"warp.json",
"garden.json",
"cellar/01/02_open.json",
"cellar/01/02_closed.json",
"warp.json",
"cellar/01/01.json",
"tiles/mapUtilities.json",
"cellar/01/01_closed.json",
"tiles/cija.json",
"gmaze/gmaze.json",
"tiles/warntape.json"
"gmaze/right.json",
"cellar/01/room_open.json",
"cellar/01/02_open.json"
],
"tileset.lastUsedFormat": "json"
}