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); }
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); }
public SpawnNearAction(Map map, IntVec3 cell, QThing qthing) { this.map = map; this.cell = cell; this.qthing = qthing; }
internal static string Display(QThing thing) { return(thing.def.defName + " (" + thing.stackCount + ")"); }