Skip to content

Commit

Permalink
Merge pull request #21 from BUTR/dev
Browse files Browse the repository at this point in the history
v0.6.0
  • Loading branch information
Aragas authored Mar 28, 2022
2 parents bfc70f9 + 9264b6d commit 17de866
Show file tree
Hide file tree
Showing 36 changed files with 859 additions and 614 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
# Bannerlord.YellToInspire

Ported to e1.7.0/e1.7.1.
It has an interesting history. First based on [Xorberax's Press V to Yell](https://www.nexusmods.com/mountandblade2bannerlord/mods/154), then reimagined with [Yell To Inspire - New Leadership Perks and Abilities](https://www.nexusmods.com/mountandblade2bannerlord/mods/477), then ported [Yell To Inspire (Updated)](https://www.nexusmods.com/mountandblade2bannerlord/mods/2155) and now having an 'enterprise grade rewrite ©' with the addition of usage of MCM and ButterLib.
Rewritten several times and server as an example of a gameplay mod.

Several points:
* The game follows a pattern where an `AgentComponent` holds a state and the necessary functions to alter the state.
`CommonAIComponent` is an example of that. Other components reference it and alter. We are doing the same, having a state and two
`AgentComponent` that handle AI and Player interactions.
* From my understanding, the game devs didn't intend to handle Player input in the `AgentComponent` `Tick` method, as `OnTickAsAI`
will be triggered on non Player controlled Agents. My workaround is to create a `MissionBehavior` that checks if the
`AgentComponent` implements `IAgentComponentOnTick` and calls `OnTick`. From what I understand, the Player input
should be handled in `MissionBehavior`, but it's inconsistent then with the AI handling.
* A more interesting way to get MCM settings is to inject a `MissionBehavior` with a method to get the settings,
thus avoiding the static access, which is in general a good thing.
* HotKey handling via the game intended way is interesting. ButterLib only provides static endpoints, because of that we need
`Class.Current` properties to alter state from the HotKey. The game intended way gives the ability to alter the state
directly from the instances of `MissionBehavior` and `AgentComponent`.
* `module_strings.xml` was really hard to implement. There's a lot of undocumented behavior you need to find to provide
localization support fot game provided HotKeys.
* `ModuleInfoHelper.GetModuleByType` gives a great opportunity to get the assemblies Module Id without hardcoding it.
* You need to add `_RGL_KEEP_ASSERTS` `DefineConstants` to keep using the `MBDebug` class.
* You can't really make your mod 'modder friendly'. I assume that the best would be to make public all classes that
expose logic that could be modifiable, mark all properties and methods virtual, replace all private members as protected.
I don't think that you should expose implementation detail classes as long as they won't interfere with the abiility to override code.

It has an interesting history. First based on [Xorberax's Press V to Yell](https://www.nexusmods.com/mountandblade2bannerlord/mods/154),
then reimagined with [Yell To Inspire - New Leadership Perks and Abilities](https://www.nexusmods.com/mountandblade2bannerlord/mods/477),
then ported [Yell To Inspire (Updated)](https://www.nexusmods.com/mountandblade2bannerlord/mods/2155) and now having an
'enterprise grade rewrite ©' with the addition of usage of MCM.
18 changes: 6 additions & 12 deletions src/Bannerlord.YellToInspire/Bannerlord.YellToInspire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<Project Sdk="Bannerlord.BUTRModule.Sdk/1.0.1.68">

<PropertyGroup>
<DefineConstants>$(DefineConstants);_RGL_KEEP_ASSERTS</DefineConstants>
<!-- Module Id -->
<ModuleId>Bannerlord.YellToInspire</ModuleId>
<!-- Module Name -->
<ModuleName>BUTR's Yell To Inspire</ModuleName>
<!-- Module Version -->
<Version>0.5.0</Version>
<Version>0.6.0</Version>
<!-- Module manually override GameVersion -->
<!-- <OverrideGameVersion>e1.6.2</OverrideGameVersion> -->
</PropertyGroup>
Expand All @@ -18,32 +19,25 @@

<!-- Development Variables -->
<PropertyGroup>
<!-- Harmony Version -->
<HarmonyVersion>2.2.1</HarmonyVersion>
<!-- UIExtenderEx Version -->
<UIExtenderExVersion>2.1.8</UIExtenderExVersion>
<!-- ButterLib Version -->
<ButterLibVersion>2.1.1</ButterLibVersion>
<!-- MCM Version -->
<MCMVersion>4.5.0</MCMVersion>
<MCMVersion>4.6.0</MCMVersion>
<!-- BUTRShared Version -->
<BUTRSharedVersion>2.0.0.78</BUTRSharedVersion>
<BUTRSharedVersion>2.0.0.82</BUTRSharedVersion>
<!-- ModuleManager Version -->
<BUTRModuleManagerVersion>3.0.94</BUTRModuleManagerVersion>
<!-- ModuleLoader Version -->
<BUTRModuleLoaderVersion>1.0.1.24</BUTRModuleLoaderVersion>
<!-- Harmony Extensions Version -->
<HarmonyExtensionsVersion>2.0.0.55</HarmonyExtensionsVersion>

<ExtendedBuild>false</ExtendedBuild>
</PropertyGroup>

<PropertyGroup>
<DisableReferenceAssemblies>true</DisableReferenceAssemblies>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bannerlord.ReferenceAssemblies.Core.EarlyAccess" Version="$(GameVersion).*" IncludeAssets="compile" />
<PackageReference Include="Bannerlord.ReferenceAssemblies.CustomBattle.EarlyAccess" Version="$(GameVersion).*" IncludeAssets="compile" />
<PackageReference Include="Bannerlord.ReferenceAssemblies.Native.EarlyAccess" Version="$(GameVersion).*" IncludeAssets="compile" />
</ItemGroup>

</Project>

This file was deleted.

67 changes: 0 additions & 67 deletions src/Bannerlord.YellToInspire/Components/SphereIndicator.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/Bannerlord.YellToInspire/Data/CheeringAgent.cs

This file was deleted.

8 changes: 8 additions & 0 deletions src/Bannerlord.YellToInspire/Data/GameplaySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Bannerlord.YellToInspire.Data
{
public enum GameplayType
{
Killing,
Cooldown
}
}
12 changes: 12 additions & 0 deletions src/Bannerlord.YellToInspire/Data/TroopStatistics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Bannerlord.YellToInspire.Data
{
public record TroopStatistics
{
public static TroopStatistics Empty { get; } = new();

public int Inspired { get; set; }
public int Retreating { get; set; }
public int Nearby { get; set; }
public int Fled { get; set; }
}
}
120 changes: 0 additions & 120 deletions src/Bannerlord.YellToInspire/Handlers/CampaignHandler.cs

This file was deleted.

Loading

0 comments on commit 17de866

Please sign in to comment.