fixed some buggies

This commit is contained in:
Cheese 2015-07-05 15:26:56 +10:00
parent bde58fcad9
commit e24890d292

View File

@ -26,19 +26,13 @@ class WorldComponent implements Listener
private $world; private $world;
private $worldName; private $worldName;
private $mapName; private $mapName;
private $mapAuthor; private $mapAuthor;
private $mapTeams = array(); private $mapTeams = array();
private $mapData = array(); private $mapData = array();
private $minX = -256; private $mapSettings = array();
private $maxX = 256;
private $minY = -256;
private $maxY = 256;
private $minZ = -256;
private $maxZ = 256;
public function __construct(Arena $arena) public function __construct(Arena $arena)
{ {
@ -91,43 +85,28 @@ class WorldComponent implements Listener
{ {
$this->mapName = $tokens[1]; $this->mapName = $tokens[1];
} }
else if (strcmp($tokens[0], "MAP_AUTHOR") === 0) elseif (strcmp($tokens[0], "MAP_AUTHOR") === 0)
{ {
$this->mapAuthor = $tokens[1]; $this->mapAuthor = $tokens[1];
} }
//Map Boundaries //Map Boundaries
else if (strcmp($tokens[0], "MIN_X") === 0) elseif (strcmp($tokens[0], "MIN_X") === 0 ||
strcmp($tokens[0], "MAX_X") === 0 ||
strcmp($tokens[0], "MIN_Y") === 0 ||
strcmp($tokens[0], "MAX_Y") === 0 ||
strcmp($tokens[0], "MIN_Z") === 0 ||
strcmp($tokens[0], "MAX_Z") === 0)
{ {
$this->minX = $tokens[1]; $this->mapSettings[$tokens[0]] = $tokens[1];
}
else if (strcmp($tokens[0], "MAX_X") === 0)
{
$this->maxX = $tokens[1];
}
else if (strcmp($tokens[0], "MIN_Y") === 0)
{
$this->minY = $tokens[1];
}
else if (strcmp($tokens[0], "MAX_Y") === 0)
{
$this->maxY = $tokens[1];
}
else if (strcmp($tokens[0], "MIN_Z") === 0)
{
$this->minZ = $tokens[1];
}
else if (strcmp($tokens[0], "MAX_Z") === 0)
{
$this->maxZ = $tokens[1];
} }
//Team Spawns //Team Spawns
else if (strcmp($tokens[0], "TEAM_NAME") === 0) elseif (strcmp($tokens[0], "TEAM_NAME") === 0)
{ {
$currentTeamName = $tokens[1]; $currentTeamName = $tokens[1];
} }
else if (strcmp($tokens[0], "TEAM_SPAWNS") === 0) elseif (strcmp($tokens[0], "TEAM_SPAWNS") === 0)
{ {
$positions = array(); $positions = array();
@ -145,11 +124,11 @@ class WorldComponent implements Listener
} }
//Data //Data
else if (strcmp($tokens[0], "DATA_NAME") === 0) elseif (strcmp($tokens[0], "DATA_NAME") === 0)
{ {
$currentDataName = $tokens[1]; $currentDataName = $tokens[1];
} }
else if (strcmp($tokens[0], "DATA_LOCS") === 0) elseif (strcmp($tokens[0], "DATA_LOCS") === 0)
{ {
$positions = array(); $positions = array();
@ -180,9 +159,14 @@ class WorldComponent implements Listener
return $this->mapTeams; return $this->mapTeams;
} }
public function getSetting($key)
{
return $this->mapSettings[$key];
}
public function getData($key) public function getData($key)
{ {
return $this->worldData[$key]; return $this->mapData[$key];
} }
protected function strToLoc($str) protected function strToLoc($str)
@ -199,12 +183,12 @@ class WorldComponent implements Listener
} }
return null; return null;
} }
//This will return a UID for the game //This will return a UID for the game
public function getNewGameId() public function getNewGameId()
{ {
return rand(0, 999999); //Make this acutally unique return rand(0, 999999); //Make this acutally unique
} }
} }