// Token: 0x06000006 RID: 6 RVA: 0x000021F0 File Offset: 0x000003F0 public void SwitchOnLight() { IntVec3 intVec = GetWearer.DrawPos.ToIntVec3(); if (!this.light.DestroyedOrNull() && intVec != this.light.Position) { this.SwitchOffLight(); } if (this.light.DestroyedOrNull() && intVec.GetFirstThing(GetWearer.Map, Util_CompEquippableLight.EquippableLightDef) == null) { this.light = GenSpawn.Spawn(Util_CompEquippableLight.EquippableLightDef, intVec, GetWearer.Map, WipeMode.Vanish); } this.lightIsOn = true; }
public virtual void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, List <Thing> ignoredThings, bool canThrowMotes) { if (def.explosionCellMote != null && canThrowMotes) { Mote mote = c.GetFirstThing(explosion.Map, def.explosionCellMote) as Mote; if (mote != null) { mote.spawnTick = Find.TickManager.TicksGame; } else { float t = Mathf.Clamp01((explosion.Position - c).LengthHorizontal / explosion.radius); Color color = Color.Lerp(def.explosionColorCenter, def.explosionColorEdge, t); MoteMaker.ThrowExplosionCell(c, explosion.Map, def.explosionCellMote, color); } } thingsToAffect.Clear(); float num = float.MinValue; bool flag = false; List <Thing> list = explosion.Map.thingGrid.ThingsListAt(c); for (int i = 0; i < list.Count; i++) { Thing thing = list[i]; if (thing.def.category != ThingCategory.Mote && thing.def.category != ThingCategory.Ethereal) { thingsToAffect.Add(thing); if (thing.def.Fillage == FillCategory.Full && thing.def.Altitude > num) { flag = true; num = thing.def.Altitude; } } } for (int j = 0; j < thingsToAffect.Count; j++) { if (thingsToAffect[j].def.Altitude >= num) { ExplosionDamageThing(explosion, thingsToAffect[j], damagedThings, ignoredThings, c); } } if (!flag) { ExplosionDamageTerrain(explosion, c); } if (def.explosionSnowMeltAmount > 0.0001f) { float lengthHorizontal = (c - explosion.Position).LengthHorizontal; float num2 = 1f - lengthHorizontal / explosion.radius; if (num2 > 0f) { explosion.Map.snowGrid.AddDepth(c, (0f - num2) * def.explosionSnowMeltAmount); } } if (def != DamageDefOf.Bomb && def != DamageDefOf.Flame) { return; } List <Thing> list2 = explosion.Map.listerThings.ThingsOfDef(ThingDefOf.RectTrigger); for (int k = 0; k < list2.Count; k++) { RectTrigger rectTrigger = (RectTrigger)list2[k]; if (rectTrigger.activateOnExplosion && rectTrigger.Rect.Contains(c)) { rectTrigger.ActivatedBy(null); } } }