-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per-zone customization + reverted some badly-behaved defaults.
- Loading branch information
Showing
12 changed files
with
150 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Navmesh.Customizations; | ||
|
||
[CustomizationTerritory(250)] | ||
class Z0250WolvesDenPier : NavmeshCustomization | ||
{ | ||
public override int Version => 1; | ||
|
||
public override bool IsFlyingSupported(SceneDefinition definition) => false; // this is unflyable, despite intended use being 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Navmesh.Customizations; | ||
|
||
[CustomizationTerritory(519)] | ||
class Z0519LostCityOfAmdaporHard : NavmeshCustomization | ||
{ | ||
public override int Version => 1; | ||
|
||
public Z0519LostCityOfAmdaporHard() | ||
{ | ||
Settings.AgentMaxClimb = 0.75f; // web bridges - TODO: think about a better systemic solution | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Navmesh; | ||
|
||
// base class for per-territory navmesh customizations | ||
public class NavmeshCustomization | ||
{ | ||
// every time defaults change, we need to bump global navmesh version - this should be kept at zero | ||
// every time customization changes, we can bump the local version field, to avoid invalidating whole cache | ||
// each derived class should set it to non-zero value | ||
public virtual int Version => 0; | ||
|
||
public NavmeshSettings Settings = new(); | ||
|
||
public virtual bool IsFlyingSupported(SceneDefinition definition) => Service.LuminaRow<Lumina.Excel.GeneratedSheets.TerritoryType>(definition.TerritoryID)?.TerritoryIntendedUse is 1 or 49 or 47; // 1 is normal outdoor, 49 is island, 47 is Diadem | ||
|
||
// this is a customization point to add or remove colliders in the scene | ||
public virtual void CustomizeScene(SceneExtractor scene) { } | ||
} | ||
|
||
// attribute that defines which territories particular customization applies to | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] | ||
public class CustomizationTerritoryAttribute : Attribute | ||
{ | ||
public uint TerritoryID; | ||
|
||
public CustomizationTerritoryAttribute(uint territoryID) => TerritoryID = territoryID; | ||
} | ||
|
||
// registry containing all customizations | ||
public static class NavmeshCustomizationRegistry | ||
{ | ||
public static NavmeshCustomization Default = new(); | ||
public static Dictionary<uint, NavmeshCustomization> PerTerritory = new(); | ||
|
||
static NavmeshCustomizationRegistry() | ||
{ | ||
var baseType = typeof(NavmeshCustomization); | ||
foreach (var t in Assembly.GetExecutingAssembly().DefinedTypes.Where(t => t.IsSubclassOf(baseType))) | ||
{ | ||
var instance = Activator.CreateInstance(t) as NavmeshCustomization; | ||
if (instance == null) | ||
{ | ||
Service.Log.Error($"Failed to create instance of customization class {t}"); | ||
continue; | ||
} | ||
|
||
foreach (var attr in t.GetCustomAttributes<CustomizationTerritoryAttribute>()) | ||
{ | ||
PerTerritory.Add(attr.TerritoryID, instance); | ||
} | ||
} | ||
} | ||
|
||
public static NavmeshCustomization ForTerritory(uint id) => PerTerritory.GetValueOrDefault(id, Default); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.