tModLoader

tModLoader

MultiMap World(Beta)
V0.13 Code discussion
Some things I wanted to point out and suggest.
< >
正在显示第 1 - 6 条,共 6 条留言
........WorldManageSystem.cs // adding a boolean value to simply which side the player was on.
public bool playerSideLeft = true;

........WorldMirror.cs // updates the boolean value for which side the player was on.
worldManageSystem.CurrentWorldIndex = index;
if (x <= 60)
{
........worldManageSystem.playerSideLeft = true;
........worldManageSystem.NextWorldIndex = index - 1;
........worldManageSystem.ChangeWorld();
}
else if ((Main.ActiveWorldFileData.WorldSizeX - x) <= 60)
{
........worldManageSystem.playerSideLeft = false;
........worldManageSystem.NextWorldIndex = index + 1;
........worldManageSystem.ChangeWorld();
}

........MultiWorld.cs // checks the side the player was on in oder to set position instead of comparing NextWorldIndex to 0 and or CurrentWorldIndex.
if (System.playerSideLeft == true)
{
........player.position.X = (float)((Main.maxTilesX - 50) * 16 + 8 - player.width / 2);
........while (!CanSpawn(Main.maxTilesX - 50, i)) { i++; }
........player.position.Y = (float)(i * 16 - player.height);
}
else
{
........player.position.X = (float)(50 * 16 + 8 - player.width / 2);
........while (!CanSpawn(50, i)) { i++; }
........player.position.Y = (float)(i * 16 - player.height);
}
最后由 minititan7200 编辑于; 9 月 5 日 上午 10:07
minititan7200 9 月 5 日 上午 10:03 
........WorldManageSystem.cs // I used a while statement to split the radius into 2 parts in order to allow for an even number of world.
if (Radius > 0)
{
........int rem = Radius;
........int pos1 = 0;
........int pos2 = 0;
........while (rem > 0)
........{
................pos1++;
................rem--;
................if (rem > 0)
................{
........................pos2--;
........................rem--;
................}
........}
........if (NextWorldIndex > pos1)
........{
................NextWorldIndex = pos2;
........}
........else if (NextWorldIndex < pos2)
........{
................NextWorldIndex = pos1;
........}
}
最后由 minititan7200 编辑于; 9 月 5 日 上午 10:05
Tine  [开发者] 9 月 7 日 上午 4:52 
playerSide
i think It's not necessary because it can use simple logic to check side.
but i will add it like this
public bool IsLeftSide => CurrentWorldIndex < 0; public bool IsRightSide => CurrentWorldIndex > 0; public bool IsCenter => CurrentWorldIndex == 0;
最后由 Tine 编辑于; 9 月 7 日 上午 4:55
Tine  [开发者] 9 月 7 日 上午 5:10 
Radius
i will change it with new concept.
Use "number of maps" it better.
because 0 is center and 1 side radius for circle is weird
最后由 Tine 编辑于; 9 月 7 日 上午 5:10
Tine  [开发者] 9 月 7 日 下午 11:16 
i have plan about big update after next update.
it is system for control all mod world generate and can config in world create menu.
can config world generate group. default group is global.
this system will random mod before generate world for enable generate only that mod and mod in the group it belongs to and mod in global group.
it update after next update because next update is UI update.
最后由 Tine 编辑于; 9 月 7 日 下午 11:16
Tine  [开发者] 9 月 7 日 下午 11:21 
if need to help me you can fork my repo. and pull request to main repo after done.
i will review and merge if it ok.
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50