-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
112 additions
and
40 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
38 changes: 38 additions & 0 deletions
38
Source/CombatExtended/CombatExtended/Comps/CompVerbDisabler.cs
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,38 @@ | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
|
||
namespace CombatExtended | ||
{ | ||
public class CompVerbDisabler : ThingComp | ||
{ | ||
public override IEnumerable<Gizmo> CompGetGizmosExtra() | ||
{ | ||
foreach (var gizmo in base.CompGetGizmosExtra()) | ||
{ | ||
yield return gizmo; | ||
} | ||
var verbs = parent.GetComp<CompEquippable>()?.AllVerbs.OfType<IVerbDisableable>(); | ||
if (verbs != null) | ||
{ | ||
foreach (var verb in verbs) | ||
{ | ||
var command = new Command_Toggle() | ||
{ | ||
defaultDesc = verb.HoldFireDesc.Translate(), | ||
defaultLabel = verb.HoldFireLabel.Translate(), | ||
icon = verb.HoldFireIcon, | ||
isActive = () => verb.HoldFire, | ||
toggleAction = () => verb.HoldFire = !verb.HoldFire, | ||
|
||
}; | ||
yield return command; | ||
} | ||
} | ||
} | ||
} | ||
} |
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,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace CombatExtended | ||
{ | ||
public interface IVerbDisableable | ||
{ | ||
bool HoldFire { get; set; } | ||
string HoldFireLabel { get; } | ||
string HoldFireDesc { get; } | ||
Texture2D HoldFireIcon { get; } | ||
} | ||
} |
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