Skip to content

Commit

Permalink
initial 1.0 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehni committed Jun 17, 2018
1 parent d93b668 commit 3bd31ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModMetaData>
<name>Dismiss Trader</name>
<author>Mehni</author>
<targetVersion>0.18.0</targetVersion>
<targetVersion>1.0.0</targetVersion>
<description>Dismiss traders with the click of a button.</description>
<url>https://ludeon.com/forums/index.php?topic=35832.0</url>
</ModMetaData>
Binary file modified Assemblies/0Harmony.dll
Binary file not shown.
Binary file modified Assemblies/Dismiss_Trader.dll
Binary file not shown.
7 changes: 4 additions & 3 deletions Source/JobDriver_DismissTrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override bool TryMakePreToilReservations()

//approach: find Lord transition that is the regular time-out and add another (very short) Trigger_TicksPassed. That'll then fire, and the traders will leave.

//other (failed) approaches:
//other (failed) approaches:
//- inheriting from LordJob_TradeWithColony and overriding the stategraph. Set a bool in the job, which works as a trigger. Still seems like the "correct" and OOP approach, but I suck at C#
//- adding new LordToil_ExitMapAndEscortCarriers() & telling the lord to jump to it. (lord null, somehow not registered in graph?)
//- Outright removing the lord. Works, but also removes the traderflag, defending at exit and the group behaviour. Bad.
Expand All @@ -41,14 +41,15 @@ protected override IEnumerable<Toil> MakeNewToils()
{
Pawn actor = trade.actor;
if (this.Trader.CanTradeNow)
{
{
Lord lord = Trader.GetLord();
List<Transition> transitions = lord.Graph.transitions.ToList();
for (int i = 0; i < transitions.Count; i++)
{
foreach(Trigger trigger in transitions[i].triggers)
{
if (trigger.GetType() == typeof(Trigger_TicksPassed))
//if (trigger.GetType() == typeof(Trigger_TicksPassed))
if (trigger is Trigger_TicksPassed) // less ugly, more nicer.
{
transitions[i].triggers.Add(new Trigger_TicksPassed(20));
break;
Expand Down

0 comments on commit 3bd31ad

Please sign in to comment.