-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[adds] + RestrictedPlacement_Comp now ticks (normal(1:250) and rare(1:1)) and destoys the Thing if it's support disappears, an alert is also thrown to the player [changes] + PlaceWorker_WallAttachment should only work as intended on natural and man-made walls (use edifice AND graphic linker to validate)
- Loading branch information
ForsakenShell
committed
Jul 9, 2015
1 parent
8c06254
commit 6f4b756
Showing
12 changed files
with
252 additions
and
17 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
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,91 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using RimWorld; | ||
using UnityEngine; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace CommunityCoreLibrary | ||
{ | ||
|
||
public static class PlaceWorker_Restriction_Alert_Data | ||
{ | ||
private static List< Thing > destroyedThings; | ||
public static List< Thing > DestroyedThings | ||
{ | ||
get{ return destroyedThings; } | ||
} | ||
|
||
private static int cooldownTicks; | ||
|
||
public static bool AlertPlayer | ||
{ | ||
get{ return ( destroyedThings.Count > 0 ); } | ||
} | ||
|
||
static PlaceWorker_Restriction_Alert_Data() | ||
{ | ||
destroyedThings = new List<Thing>(); | ||
cooldownTicks = 0; | ||
} | ||
|
||
public static void Cooldown( int ticks = 1 ) | ||
{ | ||
cooldownTicks -= ticks; | ||
if( ( cooldownTicks <= 0 )&& | ||
( destroyedThings.Count > 0 ) ) | ||
destroyedThings.Clear(); | ||
} | ||
|
||
public static void Add( Thing thing ) | ||
{ | ||
destroyedThings.Add( thing ); | ||
cooldownTicks = 250; | ||
} | ||
|
||
} | ||
|
||
public class Alert_PlaceWorker_Restriction : Alert_Critical | ||
{ | ||
public override AlertReport Report | ||
{ | ||
get | ||
{ | ||
// Alert the player if something got destroyed | ||
if( PlaceWorker_Restriction_Alert_Data.AlertPlayer == false ) | ||
return false; | ||
|
||
// Return the first or default instance as the culprit | ||
return AlertReport.CulpritIs( PlaceWorker_Restriction_Alert_Data.DestroyedThings.FirstOrDefault() ); | ||
} | ||
} | ||
|
||
public override string FullExplanation{ | ||
get{ | ||
var msg = new StringBuilder(); | ||
msg.AppendLine( "AlertPlaceWorkerRestrictionSupportRemovedDesc".Translate() ); | ||
foreach( var t in PlaceWorker_Restriction_Alert_Data.DestroyedThings ) | ||
msg.AppendLine( " " + t.def.defName ); | ||
return msg.ToString(); | ||
} | ||
} | ||
public override void AlertActiveUpdate() | ||
{ | ||
if( PlaceWorker_Restriction_Alert_Data.AlertPlayer == true ) | ||
{ | ||
base.AlertActiveUpdate(); | ||
PlaceWorker_Restriction_Alert_Data.Cooldown(); | ||
} | ||
} | ||
|
||
public Alert_PlaceWorker_Restriction() | ||
{ | ||
this.baseLabel = "AlertPlaceWorkerRestrictionSupportRemovedLabel".Translate(); | ||
} | ||
|
||
} | ||
} | ||
|
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
Binary file modified
BIN
+2.5 KB
(110%)
_Mod/Community Core Library/Assemblies/Community Core Library.dll
Binary file not shown.
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