public override void OnAction() { RaycastHit surface = GoundPlacing(); if (surface.distance != 0) { if (Item) { Vector3 point = surface.point; Quaternion placeRotation = Item.gameObject.transform.rotation; if (PlacingNormal) { placeRotation = Quaternion.LookRotation(character.transform.forward, surface.normal); } else { placeRotation = Quaternion.LookRotation(character.transform.forward); } if (objectToSnap != null) { point = objectToSnap.transform.position; placeRotation = objectToSnap.transform.rotation; } character.CmdRequestSpawnObject(point, placeRotation, ItemID, ""); if (SoundPlaced && audioSource) { if (audioSource.enabled) { audioSource.PlayOneShot(SoundPlaced); } } } if (ItemUsed != null) { if (!InfinityAmmo) { if (character != null && character.inventory != null && !character.inventory.RemoveItem(ItemUsed, 1)) { return; } } } } base.OnAction(); }