Disable lighting by default via config.yaml
This commit is contained in:
parent
ff0ee58b37
commit
44e01d0fe7
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TrueCraft.API;
|
||||
using TrueCraft.API.World;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TrueCraft.Core.AI
|
||||
{
|
||||
@ -66,7 +67,6 @@ namespace TrueCraft.Core.AI
|
||||
public PathResult FindPath(IWorld world, BoundingBox subject, Coordinates3D start, Coordinates3D goal)
|
||||
{
|
||||
// Thanks to www.redblobgames.com/pathfinding/a-star/implementation.html
|
||||
|
||||
var parents = new Dictionary<Coordinates3D, Coordinates3D>();
|
||||
var costs = new Dictionary<Coordinates3D, double>();
|
||||
var openset = new PriorityQueue<Coordinates3D>();
|
||||
|
@ -24,8 +24,8 @@ namespace TrueCraft.Core.AI
|
||||
|
||||
public WanderState()
|
||||
{
|
||||
IdleChance = 5;
|
||||
Distance = 16;
|
||||
IdleChance = 20;
|
||||
Distance = 25;
|
||||
PathFinder = new AStarPathFinder();
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ using TrueCraft.Exceptions;
|
||||
using TrueCraft.Core.Logic;
|
||||
using TrueCraft.Core.Lighting;
|
||||
using TrueCraft.Core.World;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TrueCraft
|
||||
{
|
||||
@ -172,6 +174,8 @@ namespace TrueCraft
|
||||
}
|
||||
PendingBlockUpdates.Enqueue(new BlockUpdate { Coordinates = e.Position, World = sender as IWorld });
|
||||
ProcessBlockUpdates();
|
||||
if (Program.ServerConfiguration.EnableLighting)
|
||||
{
|
||||
var lighter = WorldLighters.SingleOrDefault(l => l.World == sender);
|
||||
if (lighter != null)
|
||||
{
|
||||
@ -180,8 +184,11 @@ namespace TrueCraft
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleChunkGenerated(object sender, ChunkLoadedEventArgs e)
|
||||
{
|
||||
if (Program.ServerConfiguration.EnableLighting)
|
||||
{
|
||||
var lighter = new WorldLighting(sender as IWorld, BlockRepository);
|
||||
var coords = e.Coordinates * new Coordinates2D(Chunk.Width, Chunk.Depth);
|
||||
@ -191,6 +198,14 @@ namespace TrueCraft
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < e.Chunk.SkyLight.Data.Length; i++)
|
||||
{
|
||||
e.Chunk.SkyLight.Data[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessBlockUpdates()
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ namespace TrueCraft
|
||||
Singleplayer = false;
|
||||
Query = true;
|
||||
QueryPort = 25566;
|
||||
EnableLighting = false;
|
||||
}
|
||||
|
||||
[YamlMember(Alias = "motd")]
|
||||
@ -55,5 +56,8 @@ namespace TrueCraft
|
||||
|
||||
[YamlMember(Alias = "queryPort")]
|
||||
public int QueryPort { get; set; }
|
||||
|
||||
[YamlMember(Alias = "enable-lighting")]
|
||||
public bool EnableLighting { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user