Beispiel #1
0
        public StructureMaster CreateSM(Fougerite.Player p, float x, float y, float z, Quaternion rot)
        {
            StructureMaster master = NetCull.InstantiateClassic <StructureMaster>(Bundling.Load <StructureMaster>("content/structures/StructureMasterPrefab"), new Vector3(x, y, z), rot, 0);

            master.SetupCreator(p.PlayerClient.controllable);
            return(master);
        }
Beispiel #2
0
        void PasteBuilding(List <object> structureData, Vector3 targetPoint, float targetRot, float heightAdjustment, NetUser netuser)
        {
            Vector3         OriginRotation = new Vector3(0f, targetRot, 0f);
            Quaternion      OriginRot      = Quaternion.EulerRotation(OriginRotation);
            StructureMaster themaster      = null;

            foreach (Dictionary <string, object> structure in structureData)
            {
                Dictionary <string, object> structPos = structure["pos"] as Dictionary <string, object>;
                Dictionary <string, object> structRot = structure["rot"] as Dictionary <string, object>;
                string     prefabname = (string)structure["prefabname"];
                Quaternion newAngles  = Quaternion.EulerRotation((new Vector3(Convert.ToSingle(structRot["x"]), Convert.ToSingle(structRot["y"]), Convert.ToSingle(structRot["z"]))) + OriginRotation);
                Vector3    TempPos    = OriginRot * (new Vector3(Convert.ToSingle(structPos["x"]), Convert.ToSingle(structPos["y"]), Convert.ToSingle(structPos["z"])));
                Vector3    NewPos     = TempPos + targetPoint;
                if (themaster == null)
                {
                    themaster = NetCull.InstantiateClassic <StructureMaster>(Facepunch.Bundling.Load <StructureMaster>("content/structures/StructureMasterPrefab"), NewPos, newAngles, 0);
                    themaster.SetupCreator(netuser.playerClient.controllable);
                }
                StructureComponent block = SpawnStructure(prefabname, NewPos, newAngles);
                if (block != null)
                {
                    themaster.AddStructureComponent(block);
                }
            }
        }