I've just added multiplayer to my game and blocks won't place anymore after trying to get them to show up for both players. The indentical code structure worked for erasing cells on both screens so I don't get what has happened.
In player's physics process:
private void HandleMouseInput()
{
if (Input.IsActionPressed("mb_left") /*&& tileTimer.IsStopped()*/)
{
Vector2I tile = tileMap.LocalToMap(GetGlobalMousePosition());
if (!CheckTile(tile))
return;
tileMap.Rpc("SetTile", tile, atlasCoords);
}
else if (Input.IsActionPressed("mb_right"))
{
Vector2I tile = tileMap.LocalToMap(GetGlobalMousePosition());
var tileData = tileMap.GetCellTileData(0, tile);
if (gameManager.Instance.TileMap.Buildables.ContainsKey(tile) || tileData != null)
{
bool isBedrock = false;
if (tileData != null)
isBedrock = tileData.GetCustomData("isBedrock").As<bool>();
if (!IsTileInRange(tile) || isBedrock)
return;
tileMap.Rpc("CellEraser", 0, tile);
blocks++;
}
}
}```