diff --git a/Assets/Scripts/Items/Item.cs b/Assets/Scripts/Items/Item.cs
index 08f0d0a..145f4aa 100644
--- a/Assets/Scripts/Items/Item.cs
+++ b/Assets/Scripts/Items/Item.cs
@@ -6,6 +6,9 @@ namespace Cyber.Items {
/// An item, containing itemmy information.
///
public class Item {
+ ///
+ /// Delegate for actions that items can do.
+ ///
public delegate void ItemAction(Character host);
///
@@ -52,6 +55,7 @@ namespace Cyber.Items {
/// The Weight of the item.
/// The equip slot of the item.
/// The description of the item.
+ /// The action which is ran when the item is used.
public Item(int id, int modelId, string name, float weight, EquipSlot slot, string description, ItemAction action = null) {
ID = id;
ModelID = modelId;
diff --git a/Assets/Scripts/Networking/Serverside/Server.cs b/Assets/Scripts/Networking/Serverside/Server.cs
index e8e1cac..6d7ec6f 100644
--- a/Assets/Scripts/Networking/Serverside/Server.cs
+++ b/Assets/Scripts/Networking/Serverside/Server.cs
@@ -246,7 +246,8 @@ namespace Cyber.Networking.Serverside {
InventoryActionPkt InventoryActionPkt = new InventoryActionPkt();
InventoryActionPkt.Deserialize(msg.reader);
- Inventory CurrInventory = Players[msg.conn.connectionId].Character.GetComponent();
+ Character Character = Players[msg.conn.connectionId].Character;
+ Inventory CurrInventory = Character.GetComponent();
InventoryActionPkt.SyncBaseID = CurrInventory.ID;
switch (InventoryActionPkt.Action) {
@@ -258,6 +259,15 @@ namespace Cyber.Networking.Serverside {
EquipSlot Slot = (EquipSlot) InventoryActionPkt.RelatedInt;
CurrInventory.Equipped.ClearSlot(Slot);
break;
+ case InventoryAction.Use:
+ EquipSlot UseSlot = (EquipSlot) InventoryActionPkt.RelatedInt;
+ Item UseItem = CurrInventory.Equipped.GetItem(UseSlot);
+ if (UseItem != null && UseItem.Action != null && Character != null) {
+ // Item exists, it has an action, and the character
+ // isn't controlled by the client (no double-actions).
+ UseItem.Action(Character);
+ }
+ break;
}
SendToAll(PktType.InventoryAction, InventoryActionPkt);
diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset
index d11c406..d141acf 100644
--- a/ProjectSettings/ProjectSettings.asset
+++ b/ProjectSettings/ProjectSettings.asset
@@ -10,7 +10,7 @@ PlayerSettings:
targetDevice: 2
useOnDemandResources: 0
accelerometerFrequency: 60
- companyName: DefaultCompany
+ companyName: Saltosion
productName: Cyber
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
@@ -64,7 +64,7 @@ PlayerSettings:
useOSAutorotation: 1
use32BitDisplayBuffer: 1
disableDepthAndStencilBuffers: 0
- defaultIsFullScreen: 1
+ defaultIsFullScreen: 0
defaultIsNativeResolution: 1
runInBackground: 1
captureSingleScreen: 0