Ejemplo n.º 1
0
        public QThing Absorb(QThing qthing, int amount)
        {
            if (this.thing.def.useHitPoints)
            {
                this.hitPoints = Mathf.CeilToInt(
                    (this.hitPoints * this.stackCount + qthing.thing.HitPoints * amount) /
                    (float)(this.stackCount + amount)
                    );
            }

            this.stackCount += amount;
            this.absorbed.Add(qthing);
            this.source = this.absorbed.Count() > 1 ? Source.Composite : Source.Merge;

            return(this);
        }
Ejemplo n.º 2
0
        internal static bool Allows(StorageSettings storageSettings, QThing qthing)
        {
            if (!storageSettings.filter.Allows(qthing.def))
            {
                return(false);
            }

            if (qthing.def.useHitPoints)
            {
                var hitPointsPercent = GenMath.RoundedHundredth(qthing.hitPoints / (float)qthing.thing.MaxHitPoints);
                if (!storageSettings.filter.AllowedHitPointsPercents.IncludesEpsilon(Mathf.Clamp01(hitPointsPercent)))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
 public SpawnNearAction(Map map, IntVec3 cell, QThing qthing)
 {
     this.map    = map;
     this.cell   = cell;
     this.qthing = qthing;
 }
Ejemplo n.º 4
0
 internal static string Display(QThing thing)
 {
     return(thing.def.defName + " (" + thing.stackCount + ")");
 }