Beispiel #1
0
        public IEnumerable <Designation> SpawnedDesignationsOfDef(DesignationDef def)
        {
            int         count = this.allDesignations.Count;
            int         i     = 0;
            Designation des;

            while (true)
            {
                if (i < count)
                {
                    des = this.allDesignations[i];
                    if (des.def == def)
                    {
                        if (!des.target.HasThing)
                        {
                            break;
                        }
                        if (des.target.Thing.Map == this.map)
                        {
                            break;
                        }
                    }
                    i++;
                    continue;
                }
                yield break;
            }
            yield return(des);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Beispiel #2
0
        public void TryRemoveDesignationOn(Thing t, DesignationDef def)
        {
            Designation designation = this.DesignationOn(t, def);

            if (designation != null)
            {
                this.RemoveDesignation(designation);
            }
        }
Beispiel #3
0
        public void TryRemoveDesignation(IntVec3 c, DesignationDef def)
        {
            Designation designation = this.DesignationAt(c, def);

            if (designation != null)
            {
                this.RemoveDesignation(designation);
            }
        }
Beispiel #4
0
 public void RemoveAllDesignationsOfDef(DesignationDef def)
 {
     for (int i = this.allDesignations.Count - 1; i >= 0; i--)
     {
         if (this.allDesignations[i].def == def)
         {
             this.allDesignations[i].Notify_Removing();
             this.allDesignations.RemoveAt(i);
         }
     }
 }
Beispiel #5
0
 public void RemoveAllDesignationsOfDef(DesignationDef def)
 {
     for (int num = allDesignations.Count - 1; num >= 0; num--)
     {
         if (allDesignations[num].def == def)
         {
             allDesignations[num].Notify_Removing();
             allDesignations.RemoveAt(num);
         }
     }
 }
Beispiel #6
0
        public IEnumerable <Designation> SpawnedDesignationsOfDef(DesignationDef def)
        {
            int count = this.allDesignations.Count;

            for (int i = 0; i < count; i++)
            {
                Designation des = this.allDesignations[i];
                if (des.def == def && (!des.target.HasThing || des.target.Thing.Map == this.map))
                {
                    yield return(des);
                }
            }
        }
Beispiel #7
0
        public bool AnySpawnedDesignationOfDef(DesignationDef def)
        {
            int count = allDesignations.Count;

            for (int i = 0; i < count; i++)
            {
                Designation designation = allDesignations[i];
                if (designation.def == def && (!designation.target.HasThing || designation.target.Thing.Map == map))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #8
0
 public Designation DesignationAt(IntVec3 c, DesignationDef def)
 {
     if (def.targetType == TargetType.Thing)
     {
         Log.Error("Designations of type " + def.defName + " are indexed by Thing only and you are trying to get one on a location.", false);
         return(null);
     }
     for (int i = 0; i < this.allDesignations.Count; i++)
     {
         Designation designation = this.allDesignations[i];
         if (designation.def == def && (!designation.target.HasThing || designation.target.Thing.Map == this.map) && designation.target.Cell == c)
         {
             return(designation);
         }
     }
     return(null);
 }
Beispiel #9
0
 public Designation DesignationOn(Thing t, DesignationDef def)
 {
     if (def.targetType == TargetType.Cell)
     {
         Log.Error("Designations of type " + def.defName + " are indexed by location only and you are trying to get one on a Thing.", false);
         return(null);
     }
     for (int i = 0; i < this.allDesignations.Count; i++)
     {
         Designation designation = this.allDesignations[i];
         if (designation.target.Thing == t && designation.def == def)
         {
             return(designation);
         }
     }
     return(null);
 }
Beispiel #10
0
        public IEnumerable <Designation> SpawnedDesignationsOfDef(DesignationDef def)
        {
            int         count = allDesignations.Count;
            int         i     = 0;
            Designation des;

            while (true)
            {
                if (i >= count)
                {
                    yield break;
                }
                des = allDesignations[i];
                if (des.def == def && (!des.target.HasThing || des.target.Thing.Map == map))
                {
                    break;
                }
                i++;
            }
            yield return(des);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Beispiel #11
0
 public Designation(LocalTargetInfo target, DesignationDef def)
 {
     this.target = target;
     this.def    = def;
 }