]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item.qh
Backport icon handling from TimePath/guide
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item.qh
index 0b17f35b2c1277fb60ebb687893da9bec20a4ff0..16db39728561035115b66942a4620ae25b51458a 100644 (file)
@@ -5,8 +5,12 @@
 /** If you register a new item, make sure to add it to all.inc */
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0)
-    METHOD(GameItem, show, void(entity this));
-    void GameItem_show(entity this) { print("A game item\n"); }
+    ATTRIB(GameItem, m_name, string, string_null)
+    ATTRIB(GameItem, m_icon, string, string_null)
+    METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) {
+        returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
+    }
+    METHOD(GameItem, show, void(entity this)) { print("A game item\n"); }
     void ITEM_HANDLE(Show, entity this) { this.show(this); }
 ENDCLASS(GameItem)