generated from Valheim-Modding/JotunnModStub
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from jpw1991/45-pvp-siege-minions-eg-battering…
…-ram-siege-troll implement catapult minion
- Loading branch information
Showing
27 changed files
with
239 additions
and
123 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,3 +376,4 @@ Environment.props | |
|
||
/ChebsMercenaries/libs/ | ||
*.backup | ||
SitInChair.* |
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
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,50 @@ | ||
using BepInEx.Configuration; | ||
using ChebsValheimLibrary.Common; | ||
using Jotunn; | ||
|
||
namespace ChebsMercenaries.Minions | ||
{ | ||
internal class CatapultMinion : MercenaryMinion | ||
{ | ||
public new static ConfigEntry<float> Health; | ||
public static MemoryConfigEntry<string, List<string>> ItemsCost; | ||
|
||
public new static void CreateConfigs(BasePlugin plugin) | ||
{ | ||
const string serverSynced = "CatapultMinion (Server Synced)"; | ||
|
||
var itemsCost = plugin.ModConfig(serverSynced, "ItemsCost", "Wood:25,RoundLog:5,Bronze:1", | ||
"The items that are consumed when creating a minion. Please use a comma-delimited list of prefab names with a : and integer for amount. Alternative items can be specified with a | eg. Wood|Coal:5 to mean wood and/or coal.", | ||
null, true); | ||
ItemsCost = new MemoryConfigEntry<string, List<string>>(itemsCost, s => s?.Split(',').Select(str => str.Trim()).ToList()); | ||
Health = plugin.Config.Bind(serverSynced, "Health", | ||
250f, new ConfigDescription("How much health the mercenary has.", null, | ||
new ConfigurationManagerAttributes { IsAdminOnly = true })); | ||
} | ||
|
||
public sealed override void Awake() | ||
{ | ||
base.Awake(); | ||
|
||
AfterAwake(); | ||
} | ||
|
||
public virtual void AfterAwake() | ||
{ | ||
ConfigureHealth(); | ||
} | ||
|
||
protected virtual void ConfigureHealth() | ||
{ | ||
if (TryGetComponent(out Humanoid humanoid)) | ||
{ | ||
humanoid.SetMaxHealth(Health.Value); | ||
humanoid.SetHealth(Health.Value); | ||
} | ||
else | ||
{ | ||
Logger.LogError("Error: Failed to get Humanoid component to set health value."); | ||
} | ||
} | ||
} | ||
} |
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
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,54 @@ | ||
using BepInEx.Configuration; | ||
using ChebsValheimLibrary.Minions; | ||
|
||
namespace ChebsMercenaries.Minions | ||
{ | ||
public class MercenaryMinion : ChebGonazMinion | ||
{ | ||
public static ConfigEntry<DropType> DropOnDeath; | ||
public static ConfigEntry<bool> PackDropItemsIntoCargoCrate; | ||
public static ConfigEntry<bool> Commandable; | ||
public static ConfigEntry<float> FollowDistance, RunDistance, RoamRange; | ||
|
||
public static ConfigEntry<float> Health; | ||
|
||
public static void CreateConfigs(BasePlugin plugin) | ||
{ | ||
const string serverSync = "MercenaryMinion (Server Synced)"; | ||
const string client = "MercenaryMinion (Client)"; | ||
DropOnDeath = plugin.Config.Bind(serverSync, | ||
"DropOnDeath", | ||
DropType.JustResources, new ConfigDescription("Whether a minion refunds anything when it dies.", null, | ||
new ConfigurationManagerAttributes { IsAdminOnly = true })); | ||
|
||
PackDropItemsIntoCargoCrate = plugin.Config.Bind(serverSync, | ||
"PackDroppedItemsIntoCargoCrate", | ||
true, new ConfigDescription( | ||
"If set to true, dropped items will be packed into a cargo crate. This means they won't sink in water, which is useful for more valuable drops like Surtling Cores and metal ingots.", | ||
null, | ||
new ConfigurationManagerAttributes { IsAdminOnly = true })); | ||
|
||
Commandable = plugin.Config.Bind(client, "Commandable", | ||
true, | ||
new ConfigDescription( | ||
"If true, minions can be commanded individually with E (or equivalent) keybind.")); | ||
|
||
FollowDistance = plugin.Config.Bind(client, "FollowDistance", | ||
3f, | ||
new ConfigDescription( | ||
"How closely a minion will follow you (0 = standing on top of you, 3 = default).")); | ||
|
||
RunDistance = plugin.Config.Bind(client, "RunDistance", | ||
3f, | ||
new ConfigDescription( | ||
"How close a following minion needs to be to you before it stops running and starts walking (0 = always running, 10 = default).")); | ||
|
||
RoamRange = plugin.Config.Bind(client, "RoamRange", | ||
10f, new ConfigDescription("How far a unit is allowed to roam from its current position.")); | ||
|
||
Health = plugin.Config.Bind(serverSync, "Health", | ||
50f, new ConfigDescription("How much health the mercenary has (default fallback value).", null, | ||
new ConfigurationManagerAttributes { IsAdminOnly = true })); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.