Beispiel #1
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     if (!respawningAfterLoad)
     {
         this.AmountOfHeat = 0f;
         this.BurningNow   = false;
     }
     this.compDef = base.props as CompProperties_FlammableLink;
     if (this.compDef == null)
     {
         Log.Error("CompProperties_FlammableLink was not found");
         this.compDef = new CompProperties_FlammableLink();
     }
 }
        public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null)
        {
            ThingDef checkThingDef            = checkingDef as ThingDef;
            CompProperties_FlammableLink prop = checkThingDef.GetCompProperties <CompProperties_FlammableLink>();

            if (prop == null)
            {
                return(true);
            }

            List <Thing> things = loc.GetThingList(map);

            for (int i = 0; i < things.Count; i++)
            {
                if (things[i].def == ThingDefOf.Wall || (things[i].def.passability == Traversability.PassThroughOnly && things[i].def.category == ThingCategory.Item))
                {
                    return(false);
                }
                CompProperties_FlammableLink prop2 = things[i].def.GetCompProperties <CompProperties_FlammableLink>();
                if (prop2 != null && prop.connectionID == prop2.connectionID)
                {
                    return(false);
                }

                BuildableDef curBuildDef = GenConstruct.BuiltDefOf(things[i].def);
                if (curBuildDef != null && curBuildDef is ThingDef)
                {
                    ThingDef curDef = (ThingDef)curBuildDef;
                    if (curDef == ThingDefOf.Wall)
                    {
                        return(false);
                    }
                    prop2 = curDef.GetCompProperties <CompProperties_FlammableLink>();
                    if (prop2 != null && prop.connectionID == prop2.connectionID)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }