コード例 #1
0
        public static Thing SpawnMote(MoteDecoration Item, Building building, Pawn worker)
        {
            if (building.Negligeable())
            {
                return(null);
            }

            Map map = building.Map;

            // drawpos and actual position
            DisplayOrigin.GetDrawPos(Item.origin, building, worker, out IntVec3 cell, out Vector3 drawPos);

            if (drawPos.ImpossibleMote(map))
            {
                return(null);
            }

            DisplayTransformation myItemData = Item.transformation;

            MoteThrown mote = (MoteThrown)ThingMaker.MakeThing(Item.moteDef, null);

            // more drawpos
            Vector3 randomV3 = new Vector3(myItemData.randomXOffset.RandomInRange, 0, myItemData.randomYOffset.RandomInRange);

            mote.exactPosition = drawPos;

            if (myItemData.HasOffset)
            {
                //Vector3 myOffset = new Vector3(Offset.GetOffset(building.Rotation).x + randomV3.x, 0, Offset.GetOffset(building.Rotation).y + randomV3.y);
                Vector3 myOffset = new Vector3(myItemData.offset.GetOffset(building.Rotation).x + randomV3.x, 0, myItemData.offset.GetOffset(building.Rotation).y + randomV3.y);
                mote.exactPosition += myOffset.RotatedBy(building.Rotation.AsAngle);
            }

            // rotation
            mote.rotationRate  = myItemData.rotationRate.RandomInRange;
            mote.exactRotation = myItemData.exactRotation.RandomInRange;
            if (Rand.Chance(myItemData.randomHalfRotation.RandomInRange))
            {
                mote.exactRotation += 180;
            }

            //scale
            mote.Scale = myItemData.scale.RandomInRange;
            // velocity
            mote.SetVelocity(myItemData.xVelocity.RandomInRange, myItemData.yVelocity.RandomInRange);

            return(GenSpawn.Spawn(mote, cell, map, WipeMode.Vanish));
        }
コード例 #2
0
 public static bool LabelsNoMatch(this MoteTracer MT, MoteDecoration MD)
 {
     return(MT.Label != MD.label);
 }