Skip to content

Commit

Permalink
Add option to disable unique skills.
Browse files Browse the repository at this point in the history
  • Loading branch information
Epicguru committed Jun 19, 2023
1 parent a438e58 commit ed844ed
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 18 deletions.
Binary file added Bundles/StandaloneWindows/skills
Binary file not shown.
17 changes: 17 additions & 0 deletions Bundles/StandaloneWindows/skills.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ManifestFileVersion: 0
CRC: 1871671801
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: 06ad5785b8be973831962d480adc91ec
TypeTreeHash:
serializedVersion: 2
Hash: 7859cd501ea75098bcf7e53f1b477c26
HashAppended: 0
ClassTypes:
- Class: 28
Script: {instanceID: 0}
SerializeReferenceClassIdentifiers: []
Assets:
- Assets/Web/Skills.png
Dependencies: []
4 changes: 2 additions & 2 deletions Languages/English/Keyed/Keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<AM.Gizmos.DuelSpot.StartDuel.Desc>Manually start a duel between two friendly pawns with valid weapons. Prisoners cannot participate.\n\nThis is a friendly duel, nobody will be hurt.</AM.Gizmos.DuelSpot.StartDuel.Desc>
<AM.Gizmos.DuelSpot.StartDuel.InUse>The duel spot is currently in use</AM.Gizmos.DuelSpot.StartDuel.InUse>
<AM.Gizmos.DuelSpot.StartDuel.Forbidden>The duel spot is forbidden</AM.Gizmos.DuelSpot.StartDuel.Forbidden>
<AM.Gizmos.DuelSpot.StartDuel.MissingWeapon>{0} does not have a valid melee weapon</AM.Gizmos.DuelSpot.StartDuel.MissingWeapon>
<AM.Gizmos.DuelSpot.StartDuel.IncompatWeapon>{0}'s weapon cannot be used to duel {1}, their weapons are incompatible</AM.Gizmos.DuelSpot.StartDuel.IncompatWeapon>
<AM.Gizmos.DuelSpot.StartDuel.MissingWeapon>{0} does not have a valid melee weapon (must be long weapon, not short)</AM.Gizmos.DuelSpot.StartDuel.MissingWeapon>
<AM.Gizmos.DuelSpot.StartDuel.IncompatWeapon>{0}'s weapon cannot be used to duel {1}, their weapons are incompatible (must be long weapons, not short)</AM.Gizmos.DuelSpot.StartDuel.IncompatWeapon>
<AM.Gizmos.DuelSpot.StartDuel.CannotInterrupt>{0}'s current job cannot be interrupted</AM.Gizmos.DuelSpot.StartDuel.CannotInterrupt>
<AM.Gizmos.DuelSpot.StartDuel.NoPath>{0} cannot reach the duel spot</AM.Gizmos.DuelSpot.StartDuel.NoPath>
<AM.Gizmos.DuelSpot.StartDuel.OnCooldown>{0} cannot do a friendly duel for another {2} seconds</AM.Gizmos.DuelSpot.StartDuel.OnCooldown>
Expand Down
Binary file added Source/Bundles/Assets/Web/Skills.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Source/ThingGenerator/AMSettings/Presets/NoLassos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class NoLassos : Settings
* Adds melee attack animations.
* Adds melee weapon idle animations
* Adds duels
* Adds execution animations";
* Adds execution animations
* Adds Unique Skills";

public NoLassos()
{
Expand Down
1 change: 1 addition & 0 deletions Source/ThingGenerator/AMSettings/Presets/VanillaPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ public VanillaPlus()
AutoExecute = false;
ShowHands = false;
LassoSpawnChance = 0f;
EnableUniqueSkills = false;
}
}
7 changes: 7 additions & 0 deletions Source/ThingGenerator/AMSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public class Settings : SimpleSettingsBase
[WebContent("AlwaysAnimate", true)]
public bool AnimateAtIdle = true;

[Label("Enable Unique Skills")]
[Description("Enables or disables the Unique Skill system.\n" +
"Unique Skills are powerful attacks or abilities that are unlocked under certain conditions.\n" +
"Only your colonists can use these skills and they must be activated manually. See the Steam workshop page for more info.")]
[WebContent("Skills", false)]
public bool EnableUniqueSkills = true;

[Label("Animated Pawns Considered Invisible")]
[Description("When in an animation, such as an execution, pawns are considered invisible by all other pawns and turrets: " +
"they will not be actively targeted or shot at. This makes executions less risky.\n" +
Expand Down
37 changes: 22 additions & 15 deletions Source/ThingGenerator/Idle/IdleControllerComp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public override void CompTick()
var timer = new RefTimer();
try
{
TickSkills();

if (!ShouldBeActive(out var weapon))
{
ClearAnimation();
Expand All @@ -139,8 +141,6 @@ public override void CompTick()

TotalActive++;
TickActive(weapon);

TickSkills();
}
catch (Exception e)
{
Expand Down Expand Up @@ -508,26 +508,33 @@ public override void PostExposeData()
{
base.PostExposeData();

if (!ShouldHaveSkills())
return;
try
{
if (!ShouldHaveSkills())
return;

if (skills == null)
PopulateSkills();
if (skills == null)
PopulateSkills();

for (int i = 0; i < skills.Length; i++)
{
try
{
Scribe_Deep.Look(ref skills[i], skills[i].GetType().FullName);
}
catch (Exception e)
for (int i = 0; i < skills.Length; i++)
{
Core.Error($"Exception exposing skill {skills[i]}:", e);
try
{
Scribe_Deep.Look(ref skills[i], skills[i].GetType().FullName);
}
catch (Exception e)
{
Core.Error($"Exception exposing skill {skills[i]}:", e);
}
}
}
catch (Exception e2)
{
Core.Error("Big ouch:", e2);
}
}

private bool ShouldHaveSkills() => parent is Pawn p && (p.IsColonist || p.IsSlaveOfColony);
private bool ShouldHaveSkills() => Core.Settings.EnableUniqueSkills && parent is Pawn p && (p.IsColonist || p.IsSlaveOfColony);

private void PopulateSkills()
{
Expand Down

0 comments on commit ed844ed

Please sign in to comment.