Example #1
0
        private Transform spawnStructure(StructureRegion region, ushort id, Vector3 point, byte angle_x, byte angle_y, byte angle_z, byte hp, ulong owner, ulong group, uint instanceID)
        {
            if (id == 0)
            {
                return(null);
            }
            ItemStructureAsset itemStructureAsset;

            try
            {
                itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id);
            }
            catch
            {
                itemStructureAsset = null;
            }
            if (itemStructureAsset != null)
            {
                Transform structure = StructureTool.getStructure(id, hp, owner, group, itemStructureAsset);
                structure.parent   = LevelStructures.models;
                structure.position = point;
                structure.rotation = Quaternion.Euler((float)(angle_x * 2), (float)(angle_y * 2), (float)(angle_z * 2));
                if (!Dedicator.isDedicated && (itemStructureAsset.construct == EConstruct.FLOOR || itemStructureAsset.construct == EConstruct.FLOOR_POLY))
                {
                    LevelGround.bewilder(point);
                }
                region.drops.Add(new StructureDrop(structure, instanceID));
                StructureManager.structureColliders.Clear();
                structure.GetComponentsInChildren <Collider>(StructureManager.structureColliders);
                for (int i = 0; i < StructureManager.structureColliders.Count; i++)
                {
                    if (StructureManager.structureColliders[i] is MeshCollider)
                    {
                        StructureManager.structureColliders[i].enabled = false;
                    }
                    if (StructureManager.structureColliders[i] is MeshCollider)
                    {
                        StructureManager.structureColliders[i].enabled = true;
                    }
                }
                return(structure);
            }
            if (!Provider.isServer)
            {
                Provider.connectionFailureInfo = ESteamConnectionFailureInfo.STRUCTURE;
                Provider.disconnect();
            }
            return(null);
        }
        // Token: 0x0600347E RID: 13438 RVA: 0x001592D4 File Offset: 0x001576D4
        public static Transform getStructure(ushort id, byte hp)
        {
            ItemStructureAsset asset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id);

            return(StructureTool.getStructure(id, hp, 0UL, 0UL, asset));
        }
Example #3
0
 public override void equip()
 {
     base.player.animator.play("Equip", true);
     this.useTime = base.player.animator.getAnimationLength("Use");
     if (Dedicator.isDedicated)
     {
         GameObject gameObject = Object.Instantiate <GameObject>(((ItemStructureAsset)base.player.equipment.asset).clip, Vector3.zero, Quaternion.identity);
         gameObject.name = "Helper";
         Collider component = gameObject.GetComponent <Collider>();
         if (component != null)
         {
             this.boundsUse     = true;
             this.boundsCenter  = gameObject.transform.InverseTransformPoint(component.bounds.center);
             this.boundsExtents = component.bounds.extents;
         }
         Object.Destroy(gameObject);
         this.boundsOverlap = this.boundsExtents + new Vector3(0.1f, 0.1f, 0.1f);
     }
     if (base.channel.isOwner)
     {
         this.help          = StructureTool.getStructure(base.player.equipment.itemID, 0);
         this.help.position = Vector3.zero;
         this.help.rotation = Quaternion.identity;
         Collider component2 = this.help.GetComponent <Collider>();
         if (component2 != null)
         {
             this.boundsUse     = true;
             this.boundsCenter  = this.help.InverseTransformPoint(component2.bounds.center);
             this.boundsExtents = component2.bounds.extents;
             Object.Destroy(component2);
         }
         this.boundsOverlap = this.boundsExtents + new Vector3(0.1f, 0.1f, 0.1f);
         this.help.rotation = Quaternion.Euler(-90f, 0f, 0f);
         HighlighterTool.help(this.help, this.isValid);
         if (this.help.FindChild("Clip") != null)
         {
             Object.Destroy(this.help.FindChild("Clip").gameObject);
         }
         if (this.help.FindChild("Nav") != null)
         {
             Object.Destroy(this.help.FindChild("Nav").gameObject);
         }
         if (this.help.FindChild("Cutter") != null)
         {
             Object.Destroy(this.help.FindChild("Cutter").gameObject);
         }
         if (this.help.FindChild("Roof") != null)
         {
             Object.Destroy(this.help.FindChild("Roof").gameObject);
         }
         if (this.help.FindChild("Block") != null)
         {
             Object.Destroy(this.help.FindChild("Block").gameObject);
         }
         for (int i = 0; i < 4; i++)
         {
             if (!(this.help.FindChild("Wall") != null))
             {
                 break;
             }
             Object.Destroy(this.help.FindChild("Wall").gameObject);
         }
         for (int j = 0; j < 4; j++)
         {
             if (!(this.help.FindChild("Pillar") != null))
             {
                 break;
             }
             Object.Destroy(this.help.FindChild("Pillar").gameObject);
         }
     }
 }