Inheritance: MonoBehaviour
Beispiel #1
0
 public void useShipPart(ShipPart shipPart)
 {
     if (shipParts[(int)shipPart] >= 1)
     {
         shipParts[(int)shipPart]--;
     }
 }
Beispiel #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (used)
        {
            return;
        }

        Bullet otherBullet = other.GetComponent <Bullet>();

        if (otherBullet != null)
        {
            if (otherBullet.owner != this.owner)
            {
                otherBullet.Destroy();
                this.Destroy();
            }
            return;
        }

        ShipPart shipPart = other.GetComponent <ShipPart>();

        if (shipPart != null)
        {
            if (shipPart.shipController != this.owner)
            {
                shipPart.Hit();
                used = true;
                this.Destroy();
            }
            return;
        }
    }
Beispiel #3
0
        public ShipPart ChangeComponent(ShipPart shipPart)
        {
            var oldShipPart = Parts[shipPart.Type];

            Parts[shipPart.Type] = shipPart;
            return(oldShipPart);
        }
Beispiel #4
0
    void PartSelection()
    {
        if (Input.GetMouseButtonUp(0) == true && attachingMode == false)
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out rayCastHit) == true)
            {
                if (rayCastHit.collider.gameObject.GetComponent <ShipPart>() != null)
                {
                    focusedPart = rayCastHit.collider.gameObject.GetComponent <ShipPart>();
                    focusedPart.select();
                    attachingMode = true;
                }
            }
        }

        if (focusedPart != null && focusedPart.IsSelected() == true)
        {
            focusedPart.transform.position = (Vector2)(Camera.main.ScreenToWorldPoint(Input.mousePosition));

            if (Input.GetMouseButtonUp(1) == true)
            {
                focusedPart.deselect();
                attachingMode = false;
            }
        }
    }
Beispiel #5
0
 public void StartPlacingPart(ShipPart partToPlace) // callback when ready?
 {
     CurrentPlacingPart = partToPlace;
     //CurrentPlacingPart.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
     isPlacing = true;
     partPlacingIndicator.gameObject.SetActive(true);
 }
    public void PickUpPart(ShipPart part)
    {
        ShipPart.PartType type = part.type;

        if (type == ShipPart.PartType.Reactor)
        {
            reactorPart = true;
        }
        if (type == ShipPart.PartType.Tail)
        {
            tailPart = true;
        }
        if (type == ShipPart.PartType.Wheel)
        {
            if (wheelPart1 == false)
            {
                wheelPart1 = true;
            }
            else
            {
                wheelPart2 = true;
            }
        }
        display.OnChangeShipPart(part);
    }
Beispiel #7
0
    public void OnChangeShipPart(ShipPart part)
    {
        ShipPart.PartType type = part.type;

        switch (type)
        {
        case ShipPart.PartType.Reactor:
            ReactorImage.sprite = ReactorFull;
            break;

        case ShipPart.PartType.Tail:
            TailImage.sprite = TailFull;
            break;

        case ShipPart.PartType.Wheel:
            if (Wheel1Image.sprite != WheelFull)
            {
                Wheel1Image.sprite = WheelFull;
            }
            else
            {
                Wheel2Image.sprite = WheelFull;
            }
            break;
        }
        Destroy(part.gameObject);
    }
Beispiel #8
0
    public void NotifyPartDestroyed(ShipPart part)
    {
        parts.Remove(part);
        parts = parts.Where(p => p != null).ToList(); // HACK! Don't know why I need this. Single cockpit throws errors otherwise
        cameraManager.AddScreenShake(1.5f);

        Thrusters thruster = part.GetComponent <Thrusters>();

        if (thruster != null)
        {
            thrusters.Remove(thruster);
        }

        ProjectileWeapon weapon = part.GetComponent <ProjectileWeapon>();

        if (weapon != null)
        {
            weapons.Remove(weapon);
        }

        if (part.partName == "Cockpit")
        {
            // Inverse for loop because each death will modify parts with the callback
            Debug.LogFormat("Killing remaining {0} parts", parts.Count);
            for (int i = parts.Count - 1; i >= 0; i--)
            {
                // TODO: It would be really cool if we could show each part blowing up in succession
                parts[i].TakeDamage(parts[i].maxHealth);
            }
            Destroy(gameObject);
        }
    }
Beispiel #9
0
    void CmdPlaceOffShip(Vector2 pos, Vector2 aimPos)
    {
        bool blocksPlaced = false;

        if (parts.Count > 0)
        {
            PositionPartsOffShip(pos, aimPos, target_angle);

            if (true)
            {
                int shipID = 0;                 //should be ID of last boarded ship?
                for (int i = 0; i < parts.Count; ++i)
                {
                    GameObject gO = parts[i];
                    if (gO != null)
                    {
                        gO.GetComponent <Part_Info>().OwnerID = 0;                              //so it wont add to owner parts
                        //float z = 510.0f;
                        //if ( gO.getSprite().getFrame() == 0 )	z = 509.0f;//platforms
                        //else if ( gO.hasTag( "weapon" ) )	z = 511.0f;//weaps
                        //SetDisplay( gO, color_white, RenderStyle::normal, z );
                        if (!isServer)                          //add it locally till a sync
                        {
                            ShipPart ship_part = null;
                            ship_part.gameObjectID = gO.GetInstanceID();
                            Vector2 gOTransPos2D = gO.transform.position;
                            gO.GetComponent <Part_Info>().OwnerID = shipID;
                        }
                        else
                        {
                            gO.GetComponent <Part_Info>().OwnerID = 0;                            // push on ship
                        }

                        gO.GetComponent <Part_Info>().PlacedTime = Time.time;
                    }
                    else
                    {
                        Debug.Log("place cmd: GO not found");
                    }
                }
                //this.set_u32( "placedTime", getGameTime() );
                blocksPlaced = true;
            }
            else
            {
                Debug.Log("place cmd: parts overlapping, cannot place");
                //this.getSprite().PlaySound("Denied.ogg");
                return;
            }
        }
        else
        {
            Debug.Log("place cmd: no parts");
            return;
        }

        parts.Clear();        //releases the parts (they are placed)
        gameInfo.DirtyShipSync = true;
        //directionalSoundPlay( "build_ladder.ogg", this.getPosition() );
    }
 public void Init(ShipPart _part, int _length)
 {
     part         = _part;
     arrowsLength = _length;
     GenerateDirections();
     GetComponent <Transform>().position = part.transform.parent.position - Vector3.up * playerHeightMargin;
     gameObject.SetActive(true);
 }
Beispiel #11
0
        public void Delete(int idShipPart)
        {
            ShipPart shipPart = getItem(idShipPart);

            list.Remove(shipPart);

            shipPart.Delete();
        }
 public void CreateActualAlien()
 {
     if (PrefabToInstantiate != null)
     {
         InstantiatedShipPart = _container.InstantiatePrefabForComponent <ShipPart> (PrefabToInstantiate);
         PrefabToInstantiate  = null;
         InstantiatedShipPart.DisablePhysics();
     }
 }
Beispiel #13
0
 public void OnPartPlaceButton()
 {
     if (inFlightPart != null)
     {
         Destroy(inFlightPart.gameObject);
     }
     inFlightPart = Instantiate(selectedPart, Utils.GetMouseWorldPos(), Quaternion.identity);
     DisableSelectedSlotUI();
 }
Beispiel #14
0
        public void Add(ShipPart shipPart)
        {
            if (list.Exists(item => item == shipPart))
            {
                return;
            }

            list.Add(shipPart);
        }
Beispiel #15
0
    public void AssignPart(ShipPart part, Sprite picture, Direction direction, bool visibly)
    {
        this.part         = part;
        part.tile         = this;
        shipImage.enabled = visibly;
        shipImage.sprite  = picture;

        shipImage.transform.rotation = Quaternion.Euler(0, 0, ((int)direction + 2) * 90);
    }
Beispiel #16
0
 public AttachPoint(Vector3 position,ShipPart myParent, string name)
 {
     GameObject attachPoint = (GameObject)Instantiate(Resources.Load("attachPoint"));
     attachPoint.transform.position = position;
     attachPoint.transform.localScale =
         new Vector3(myParent.GetComponent<BoxCollider>().size.x / 1.5f,myParent.GetComponent<BoxCollider>().size.x / 1.5f,myParent.GetComponent<BoxCollider>().size.x / 1.5f);
     attachPoint.transform.parent = myParent.transform;
     myName = name;
     attachPoint.name = "attachPoint(" + myName + ")";
 }
Beispiel #17
0
    public void AttachPart(ShipPart part)
    {
        if (!availableParts.Contains(part))
        {
            availableParts.Add(part);
        }

        UpdateLifeSupportStatus();
        UpdateReadyToWarp();
    }
Beispiel #18
0
        protected override void LoadFromSql()
        {
            DataTable dt = Provider.Select("ShipPart");

            foreach (DataRow row in dt.Rows)
            {
                ShipPart shipPart = new ShipPart(row);
                Add(shipPart);
            }
        }
Beispiel #19
0
		public int GetUpgradeLevel(ShipPart type) {
			
			if (this.Upgrades.ContainsKey(type)) {
				return this.Upgrades[type].Level;
			} else {
				this.SetUpgradeLevel(type, new SavedUpgradeEntry());
				return 0;
			}
			
		}
Beispiel #20
0
    public void AddPart(ShipPart part)
    {
        part.gameObject.SetActive(false);
        --_numPiecesToComplete;

        if (_numPiecesToComplete <= 0)
        {
            Debug.Log($"{Team.ToString()} team wins!");
        }
    }
Beispiel #21
0
    void SelectShipPart()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, 100000.0f))
        {
            if (_selectedPart != null)
            {
                foreach (Renderer rend in _selectedPart.GetAllMeshRenderers())
                {
                    foreach (var mat in rend.materials)
                    {
                        mat.EnableKeyword("_EMISSION");
                        mat.SetColor("_EmissionColor", Color.black);
                    }
                }
                _selectedPart.isSelected = false;
            }
            var newPart = hit.transform.GetComponent <ShipPart>();
            if (_selectedPart != newPart)
            {
                _selectedPart            = newPart;
                _selectedPart.isSelected = true;
                foreach (Renderer rend in _selectedPart.GetAllMeshRenderers())
                {
                    foreach (var mat in rend.materials)
                    {
                        mat.EnableKeyword("_EMISSION");
                        mat.SetColor("_EmissionColor", Color.cyan);
                    }
                }
                partText.text = _selectedPart.name;
                var shipPart = _selectedPart.GetComponent <ShipPart>();
                statusText.text = "Status: " + _selectedPart.GetComponent <ShipPart>().GetPartStatus;
                panel.SetActive(true);
                if (shipPart.GetPartStatus == PartStatus.OK)
                {
                    fixButton.SetActive(false);
                    panel.GetComponent <RectTransform>().sizeDelta = new Vector2(300, 200);
                }
                else
                {
                    fixButton.SetActive(true);
                    panel.GetComponent <RectTransform>().sizeDelta = new Vector2(300, 300);
                }
            }
            else
            {
                UnselectShipPart();
            }

            Debug.Log("You selected the " + hit.transform.name); // ensure you picked right object
        }
    }
Beispiel #22
0
        internal void CreateShipPart(Vector2 position, int shipPart, bool instantly = false)
        {
            var sprite = new Sprite(new TextureRegion2D(ContentLoader.Instance.Tileset, TileSize * 7, TileSize * (7 - shipPart), TileSize, TileSize))
            {
                OriginNormalized = Vector2.Zero,
                Depth            = 0.6f,
            };
            var part = new ShipPart(position, sprite, shipPart);

            AddActor(part, instantly);
        }
Beispiel #23
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider is CircleCollider2D)
        {
            return; // No physical damage against shields
        }
        ShipPart otherPart = collision.collider.GetComponent <ShipPart>();
        int      damage    = (int)collision.relativeVelocity.magnitude * 50;

        TakeDamage(damage);
    }
Beispiel #24
0
        private void btnAddShipPart_Click(object sender, EventArgs e)
        {
            ShipPart         shipPart   = _car.createShipPart();
            ShipPart_AddEdit shipPartAE = new ShipPart_AddEdit(shipPart);

            if (shipPartAE.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                _shipPartList.Add(shipPart);
                loadShipPart();
            }
        }
Beispiel #25
0
    public AttachPoint(Vector3 position, ShipPart myParent, string name)
    {
        GameObject attachPoint = (GameObject)Instantiate(Resources.Load("attachPoint"));

        attachPoint.transform.position   = position;
        attachPoint.transform.localScale =
            new Vector3(myParent.GetComponent <BoxCollider>().size.x / 1.5f, myParent.GetComponent <BoxCollider>().size.x / 1.5f, myParent.GetComponent <BoxCollider>().size.x / 1.5f);
        attachPoint.transform.parent = myParent.transform;
        myName           = name;
        attachPoint.name = "attachPoint(" + myName + ")";
    }
Beispiel #26
0
    public void Hurt(float damage)
    {
        ShipPart launchedPart = null;

        health -= damage;
        if (health <= 0)
        {
            launchedPart = LaunchRandomPart();
            health       = healthPerModule;
        }
    }
Beispiel #27
0
    void OnTriggerEnter2D(Collider2D col)
    {
        ShipPart sp = col.gameObject.GetComponent <ShipPart> ();

        if (sp != null && sp.CANBEPICKEDUP)
        {
            sp.VOICE.ForceSay(sp.VOICE.pickUp);

            PickUpPartFromSpace(sp);
        }
    }
Beispiel #28
0
 /// <summary>
 ///		Removes a part from the collection
 /// </summary>
 /// <param name="part"> The part to be removed </param>
 public void Remove(ShipPart part)
 {
     ShipPart [] arr = lists[part.GetType()];
     for (int i = 0; i < arr.Length; i++)
     {
         if (arr [i] == part)
         {
             arr [i] = null;
             return;
         }
     }
 }
Beispiel #29
0
 /// <summary>
 ///		Adds a Part to the collection
 /// </summary>
 /// <param name="part"> The part to be added </param>
 public void Add(ShipPart part)
 {
     ShipPart [] arr = lists[part.GetType()];
     for (int i = 0; i < arr.Length; i++)
     {
         if (arr [i] == null)
         {
             arr [i] = part;
             return;
         }
     }
     throw new OverflowException("Array is full");
 }
Beispiel #30
0
        public List <int> IndexesToCreateT2(ShipPart shipPart)
        {
            var count = Bag.Count(part => part == shipPart);

            if (count >= 2)
            {
                var indexesRoRemove = new List <int> {
                    Array.IndexOf(Bag, shipPart), Array.LastIndexOf(Bag, shipPart)
                };
                return(indexesRoRemove);
            }
            return(null);
        }
    public void Pop()
    {
        // if have part : pop it

        if (part != null)
        {
            part.EnablePhysics();
            part.body.AddForce(LOOKDIR * 5f, ForceMode2D.Impulse);
            part.body.AddTorque(Random.Range(-1f, 1f) * 2f, ForceMode2D.Impulse);
            part.VOICE.Say(part.VOICE.popOut);
        }
        part = null;
    }
 public override void Activate()
 {
     _shownSprite.color = deselectedColor;
     _signalBus.Fire(new SystemSignal.Ship.PartAttached(GetObject(), _gameModel.SelectedAttachmentSlotId));
     if (InstantiatedShipPart != null)
     {
         InstantiatedShipPart = null;
     }
     else if (PrefabToInstantiate != null)
     {
         PrefabToInstantiate = null;
     }
 }
        public bool TexturesCollide(ShipPart obj1, ShipPart obj2)
        {
            Color[,] tex1 = TextureTo2DArray(parent.getTexture(obj1.type));
            Color[,] tex2 = TextureTo2DArray(parent.getTexture(obj2.type));
            Matrix mat1 = VecToMat(obj1.position, obj1.Angle, obj1.scale, parent.getTexture(obj1.type));
            Matrix mat2 = VecToMat(obj2.position, obj2.Angle, obj2.scale, parent.getTexture(obj2.type));
            Matrix mat1to2 = mat1 * Matrix.Invert(mat2);
            int width1 = tex1.GetLength(0);
            int height1 = tex1.GetLength(1);
            int width2 = tex2.GetLength(0);
            int height2 = tex2.GetLength(1);

            for (int x1=0;x1<width1;x1++)
            {
                for(int y1=0;y1<height1;y1++)
                {
                    Vector2 pos1 = new Vector2(x1,y1);
                    Vector2 pos2 = Vector2.Transform(pos1, mat1to2);

                    int x2 = (int)pos2.X;
                    int y2 = (int)pos2.Y;

                    if ((x2 >= 0) && (x2 < width2))
                    {
                        if((y2 >= 0) && (y2 < height2))
                        {
                            if (tex1[x1,y1].A > 0)
                            {
                                if (tex2[x2, y2].A > 0)
                                {
                                    Vector2 screenPos = Vector2.Transform(pos1, mat1);
                                    Debug.WriteLine(tex1[x1, y1].A + " " + tex1[x2, y2].A + " " + x2+" "+y2);
                                    Debug.WriteLine(obj1.position.X + " " + obj1.position.Y + " " + obj1.Angle + " " + obj1.scale + " " + parent.getTexture(obj1.type).Width);
                                    //return true;
                                }
                            }
                        }
                    }
                }
            }

            return false;
        }
Beispiel #34
0
        // this function is slow and farily usless
        public Vector2 checkCollision(ShipPart s1, ShipPart s2)
        {
            Matrix mat1 = getTrix(new Vector3((s1.imageOrigin.X * -1), (s1.imageOrigin.Y * -1), 0), s1.parent.Angle, .2f, s1.position + s1.parent.position);
            Matrix mat2 = getTrix(new Vector3((s2.imageOrigin.X * -1), (s2.imageOrigin.Y * -1), 0), s2.parent.Angle, .2f, s2.position + s2.parent.position);
            Color[,] tex1 = s1.ColorArray;
            Color[,] tex2 = s2.ColorArray;
            Matrix mat1to2 = mat1 * Matrix.Invert(mat2);
            int width1 = tex1.GetLength(0);
            int height1 = tex1.GetLength(1);
            int width2 = tex2.GetLength(0);
            int height2 = tex2.GetLength(1);

            for (int x1 = 0; x1 < width1; x1 += 5)
            {
                for (int y1 = 0; y1 < height1; y1 += 5)
                {
                    Vector2 pos1 = new Vector2(x1, y1);
                    Vector2 pos2 = Vector2.Transform(pos1, mat1to2);

                    int x2 = (int)pos2.X;
                    int y2 = (int)pos2.Y;
                    if ((x2 >= 0) && (x2 < width2))
                    {
                        if ((y2 >= 0) && (y2 < height2))
                        {
                            if (tex1[x1, y1].A > 0)
                            {
                                if (tex2[x2, y2].A > 0)
                                {
                                    Vector2 screenPos = Vector2.Transform(pos1, mat1);
                                    return screenPos;
                                }
                            }
                        }
                    }
                }
            }

            return new Vector2(-1, -1);
        }
Beispiel #35
0
        // Vector2 offset)
        public Vector2 checkCollision( ShipPart part, Vector2 line, double dir)
        {
            // I think this is all right but there have been so many changes to everything that I'm going to go over it all again later once we have the
               Color[,] texture = part.ColorArray;
               Matrix matrix = Matrix.CreateTranslation(new Vector3(part.imageOrigin, 0)) * Matrix.CreateRotationZ(part.Angle) * Matrix.CreateScale(part.scale);// *Matrix.CreateTranslation(offset.X, offset.Y, 0);

               int width = part.ColorArray.GetLength(0);
               int height = part.ColorArray.GetLength(1);
               int i = 0;
               Vector2 pos;
            do{
                pos = line;
                pos.Normalize();
                pos = Vector2.Transform(pos*i++ , matrix);
            }while((pos.X < 0 || pos.X > width)&&(pos.Y < 0 || pos.Y > height ));
            while(pos.X > 0 && pos.X < width&&pos.Y > 0 && pos.Y < height)
            {
                pos.Normalize();
                pos = Vector2.Transform(pos*i++ , matrix);
                if (texture[(int)pos.X,(int)pos.Y].A > 0)
                    return Vector2.Transform(pos, matrix);
            }
            return line;
        }
Beispiel #36
0
		public void SetUpgradeLevel(ShipPart type, SavedUpgradeEntry sue) {
		
			this.Upgrades[type] = sue;
			this.Save();
			
		}
    void PartSelection()
    {
        if (Input.GetMouseButtonUp (0) == true && attachingMode == false)
        {
            ray = Camera.main.ScreenPointToRay (Input.mousePosition);

            if(Physics.Raycast(ray, out rayCastHit) == true)
            {
                if (rayCastHit.collider.gameObject.GetComponent<ShipPart>() != null)
                {
                    focusedPart = rayCastHit.collider.gameObject.GetComponent<ShipPart>();
                    focusedPart.select();
                    attachingMode = true;
                }
            }
        }

        if (focusedPart != null && focusedPart.IsSelected() == true)
        {
            focusedPart.transform.position = (Vector2)(Camera.main.ScreenToWorldPoint(Input.mousePosition));

            if (Input.GetMouseButtonUp (1) == true)
            {
                focusedPart.deselect();
                attachingMode = false;
            }
        }
    }
 /// <summary>
 /// Returns whether the part has been destroyed.
 /// </summary>
 /// <param name="a_part">The part to test</param>
 /// <returns>True if destroyed, false if not.</returns>
 public bool IsPartDestroyed(ShipPart a_part)
 {
     return !a_part.partObject.activeSelf;
 }
        /// <summary>
        /// Tests the conditions necessary for ship destruction.
        /// </summary>
        /// <param name="a_part">Ship part being destroyed.</param>
        private void TestShipDestroyed(ShipPart a_part)
        {
            if (a_part.partType == EShipPartType.LEFT_BALLOON)
            {
                // Apply balloon explosion
                m_rb.AddForceAtPosition(m_trans.up * balDestForce, a_part.partObject.transform.position);
                InputManager.SetControllerVibrate(gameObject.tag, balDestRumbleStr, 0.0f, balDestRumbleDurr, true);

                m_balLeftDest = true;
            }
            else if (a_part.partType == EShipPartType.RIGHT_BALLOON)
            {
                // Apply balloon explosion
                m_rb.AddForceAtPosition(m_trans.up * balDestForce, a_part.partObject.transform.position);
                InputManager.SetControllerVibrate(gameObject.tag, 0.0f, balDestRumbleStr, balDestRumbleDurr, true);

                m_balRightDest = true;
            }
            if (m_balLeftDest && m_balRightDest)
            {
                // Kill the player
                m_shipStates.SetPlayerState(EPlayerState.Dying);
            }

            if (!balloonPopNoise.isPlaying)
            {
                //balloonPopNoise.pitch = Random.RandomRange(-0.75f, 1.25f);
                balloonPopNoise.Play();
            }
        }
Beispiel #40
0
 public string SetTarget(ShipPart targetPart, Ship targetShip)
 {
     targetPart.Target = targetShip;
     return string.Format("Set {0} target to {1}", targetPart.Name, targetShip.Name);
 }
Beispiel #41
0
	// Use this for initialization
	void Start () 
	{
		builder = Camera.main.GetComponent<ShipBuilder>();
		part = transform.parent.GetComponent<ShipPart>();
		connected = false;
	}
        /// <summary>
        /// Breaks the part, takes mass and hampers control to the ship.
        /// </summary>
        /// <param name="a_part">The part to test</param>
        public void BreakPart(ShipPart a_part)
        {
            // Make the mass change to the parent
            m_shipTray.shipPartMassAdd -= a_part.partMass;

            // Disable the part
            a_part.partObject.SetActive(false);

            // For testing ship death
            TestShipDestroyed(a_part);
        }
	void CmdPlaceOffShip (Vector2 pos, Vector2 aimPos )
	{
		bool blocksPlaced = false;
		if (parts.Count > 0)                 
		{	
			PositionPartsOffShip( pos, aimPos, target_angle);

			if ( true )
			{
				int shipID = 0;	//should be ID of last boarded ship?
				for (int i = 0; i < parts.Count; ++i)
				{
					GameObject gO = parts[i];
					if (gO != null)
					{
						gO.GetComponent<Part_Info>().OwnerID = 0;	//so it wont add to owner parts
						//float z = 510.0f;
						//if ( gO.getSprite().getFrame() == 0 )	z = 509.0f;//platforms
						//else if ( gO.hasTag( "weapon" ) )	z = 511.0f;//weaps
						//SetDisplay( gO, color_white, RenderStyle::normal, z );
						if ( true )	// prevously !OwningNetWorker.IsServer, to add locally till a sync
						{
							ShipPart ship_part = new ShipPart();
							ship_part.gameObjectID = gO.GetInstanceID();
							Vector2 gOTransPos2D = gO.transform.position;
							gO.GetComponent<Part_Info>().OwnerID = shipID;
						} 
						else
						{
							gO.GetComponent<Part_Info>().OwnerID = 0; // push on ship  
						}

						gO.GetComponent<Part_Info>().PlacedTime = Time.time;
					}
					else
					{
						Debug.Log("place cmd: GO not found");
					}
				}
				//this.set_u32( "placedTime", getGameTime() );
				blocksPlaced = true;
			}
			else
			{
				Debug.Log("place cmd: parts overlapping, cannot place");
				//this.getSprite().PlaySound("Denied.ogg");
				return;	
			}
		}
		else
		{
			Debug.Log("place cmd: no parts");
			return;
		}
			
		parts.Clear();		//releases the parts (they are placed)
		gameInfo.DirtyShipSync = true;
		//directionalSoundPlay( "build_ladder.ogg", this.getPosition() );
	}
        /// <summary>
        /// Actually applies the collision to the part, shares this method with the trigger system.
        /// </summary>
        /// <param name="a_part">Ship part collision.</param>
        /// <param name="a_colVelSqr">Squared collision velocity.</param>
        private void ApplyPartCollision(ShipPart a_part, float a_colVelSqr)
        {
            // Cache part squared velocity
            if (Mathf.Approximately(a_part.cached_breakVelocitySqr, 0))
            {
                a_part.cached_breakVelocitySqr = a_part.breakVelocity * a_part.breakVelocity;
            }

            // Break the part if the collision is fast enough
            if (!IsPartDestroyed(a_part) && a_colVelSqr >= a_part.cached_breakVelocitySqr)
            {
                //BreakPart(a_part);
            }
        }
 /// <summary>
 /// Clears the conditions necessary for ship destruction.
 /// </summary>
 /// <param name="a_part">Ship part being repaired.</param>
 private void ClearPartDestroyFlags(ShipPart a_part)
 {
     if (a_part.partType == EShipPartType.LEFT_BALLOON)
     {
         m_balLeftDest = false;
     }
     else if (a_part.partType == EShipPartType.RIGHT_BALLOON)
     {
         m_balRightDest = false;
     }
 }
        /// <summary>
        /// Re-enables the part, returns mass and thus restores control to the ship.
        /// </summary>
        /// <param name="a_part">The part to test</param>
        public void RepairPart(ShipPart a_part)
        {
            // Only repair the part if it is destroyed
            if (IsPartDestroyed(a_part))
            {
                // Make the mass change to the parent
                m_shipTray.shipPartMassAdd += a_part.partMass;

                // Re-enable the part
                a_part.partObject.SetActive(true);

                // Clear the destroyed flag
                ClearPartDestroyFlags(a_part);
            }
        }