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