protected override ThoughtState CurrentStateInternal( Pawn p ) { return( ( p.IsPrisonerOfColony )&& ( !p.IsSlaveOfColony() ) ); }
public bool CanArrestFor( Pawn pawn ) { if( pawn.IsSlaveOfColony() ) { return arrestSlaves; } if( pawn.IsGuestOfColony() ) { return arrestGuests; } if( pawn.IsColonist ) { return arrestColonists; } return false; }
private static void DrawWorkBoxFor( Vector2 topLeft, Pawn p, WorkTypeDef wType, bool incapableBecauseOfCapacities ) { if( ( !p.IsSlaveOfColony() ) || ( p.workSettings == null ) || ( !p.workSettings.EverWork ) ) { return; } var rect = new Rect( topLeft.x, topLeft.y, 25f, 25f ); if( incapableBecauseOfCapacities ) { GUI.color = new Color( 1f, 0.3f, 0.3f ); DrawWorkBoxBackground( rect, p, wType ); GUI.color = Color.white; } else { DrawWorkBoxBackground( rect, p, wType ); } if( Find.PlaySettings.useWorkPriorities ) { var priority1 = p.workSettings.GetPriority( wType ); var label = priority1 <= 0 ? string.Empty : priority1.ToString(); Text.Anchor = TextAnchor.MiddleCenter; GUI.color = ColorOfPriority( priority1 ); Widgets.Label( rect.ContractedBy( -3f ), label ); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; if( ( Event.current.type != EventType.MouseDown ) || ( !Mouse.IsOver( rect ) ) ) { return; } if( Event.current.button == 0 ) { int priority2 = p.workSettings.GetPriority( wType ) - 1; if( priority2 < 0 ) { priority2 = 4; } p.workSettings.ForcePriority( wType, priority2 ); SoundStarter.PlayOneShotOnCamera( SoundDefOf.AmountIncrement ); } if( Event.current.button == 1 ) { int priority2 = p.workSettings.GetPriority( wType ) + 1; if( priority2 > 4 ) { priority2 = 0; } p.workSettings.ForcePriority( wType, priority2 ); SoundStarter.PlayOneShotOnCamera( SoundDefOf.AmountDecrement ); } Event.current.Use(); } else { if( p.workSettings.GetPriority( wType ) > 0 ) { GUI.DrawTexture( rect, (Texture) WidgetsWork.WorkBoxCheckTex ); } if( !Widgets.ButtonInvisible( rect ) ) { return; } if( p.workSettings.GetPriority( wType ) > 0 ) { p.workSettings.ForcePriority( wType, 0 ); SoundStarter.PlayOneShotOnCamera( SoundDefOf.CheckboxTurnedOff ); } else { p.workSettings.ForcePriority( wType, 3 ); SoundStarter.PlayOneShotOnCamera( SoundDefOf.CheckboxTurnedOn ); } } }
public override bool PawnCanOpen( Pawn p, bool isEscaping ) { if( cachedRooms.Count == 0 ) { UpdateCompStatus(); } if( isEscaping ) { // Escaping pawns don't care about restrictions return true; } if( this.parent.IsForbiddenToPass( p ) ) { // Other factions don't care about forbidden doors //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsForbiddenToPass", this.parent.ThingID, p.NameStringShort ) ); return false; } // Check animals if( ( p.RaceProps.Animal )&& ( !AllowAnimals ) ) { return false; } // Check colonists if( ( p.IsColonist )&& ( !AllowColonists )&& ( !p.IsPrisonerOfColony )&& ( !p.Drafted )&& ( !p.workSettings.WorkIsActive( WorkTypeDefOf.Warden ) )&& ( !p.workSettings.WorkIsActive( WorkTypeDefOf.Doctor ) ) ) { // Colonists have been told not to use this door return false; } if( ( ( p.IsColonist )|| ( p.Faction == Faction.OfPlayer ) )&& ( !p.IsPrisoner ) ) { // Colonists & colony animals //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsColonist or Faction.OfPlayer", this.parent.ThingID, p.NameStringShort ) ); return true; } // Check non-prisoner guests if( p.IsGuestOfColony() ) { if( AllowGuests ) { // Guests can use this door //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsAllowedGuest", this.parent.ThingID, p.NameStringShort ) ); return true; } // Guests can't use this door //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} IsNotAllowedGuest", this.parent.ThingID, p.NameStringShort ) ); return false; } if( cachedRooms.NullOrEmpty() ) { // No room cache, can't check //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} cachedRooms is null", this.parent.ThingID, p.NameStringShort ) ); return false; } var pawnRoom = p.GetRoom(); bool checkPrisoners = p.IsPrisonerOfColony; bool checkSlaves = p.IsSlaveOfColony(); // Slaves supercede prisoners checkPrisoners &= !checkSlaves; // Check on prisoners if( ( AllowPrisoners )&& ( checkPrisoners ) ) { foreach( var room in cachedRooms ) { // Don't worry about room pawn is leaving if( room == pawnRoom ) { continue; } if( !room.isPrisonCell ) { // Prisoners are only valid for prison cells //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isPrisoner, room {2} !isPrisoncell", this.parent.ThingID, p.NameStringShort, room.ID ) ); return false; } } // Room is valid for prisoners //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isPrisoner, all rooms are prison cells", this.parent.ThingID, p.NameStringShort ) ); return true; } // Check on slaves if( ( AllowSlaves )&& ( checkSlaves ) ) { foreach( var room in cachedRooms ) { // Don't worry about room pawn is leaving if( room == pawnRoom ) { continue; } if( !room.IsSlaveWorkArea() ) { // Room isn't a valid slave work area //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isSlave, room {2} !IsSlaveWorkArea()", this.parent.ThingID, p.NameStringShort, room.ID ) ); return false; } } // Room is valid for slaves //Log.Message( string.Format( "\tCompRestrictedDoor: door {0}, pawn {1} isSlave, all rooms are slave work areas", this.parent.ThingID, p.NameStringShort ) ); return true; } // Room is not valid for pawn //Log.Message( string.Format( "\tCompRestrictedDoor: door {0} is not valid for pawn {1}", this.parent.ThingID, p.NameStringShort ) ); return false; }
/* public ThinkNode_ConditionalSlave() : base() { } */ protected override bool Satisfied( Pawn pawn ) { return pawn.IsSlaveOfColony(); }
protected override ThoughtState CurrentStateInternal( Pawn p ) { return p.IsSlaveOfColony(); }