diff options
Diffstat (limited to 'tutorials/tut042_too_many_items.md')
| -rw-r--r-- | tutorials/tut042_too_many_items.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tutorials/tut042_too_many_items.md b/tutorials/tut042_too_many_items.md index bcea957..9d95b00 100644 --- a/tutorials/tut042_too_many_items.md +++ b/tutorials/tut042_too_many_items.md @@ -2,15 +2,15 @@ ## Too many items -In the last tutorial we saw how to create lots and lots of items. Sometimes, you think to yourself "that's way too many", and when you do, you simplify. Rougelike games have a tendency to have attributes associated with items. Commonly, "blessed", normal, and "cursed". In this tutorial, we'll be using the technique discussed in @{tut021_detouring.md} to give every item one of these stats by overrideing @{item.lua.RegisterItem} the Serialize() and DeSerialize() methods to give every item a little extra data. +In the last tutorial we saw how to create lots and lots of items. Sometimes, you think to yourself "that's way too many", and when you do, you simplify. Rougelike games have a tendency to have attributes associated with items. Commonly, "blessed", "normal", and "cursed". In this tutorial, we'll be using the technique discussed in @{tut021_detouring.md} to give every item one of these stats by overrideing @{item.lua.RegisterItem} the Serialize() and DeSerialize() methods to give every item a little extra data. -garrysmod/addons/artery_rougelite/data/artery/global/item_attributes.txt +garrysmod/addons/artery\_rougelite/data/artery/global/item\_attributes.txt local itm = nrequire("item.lua") local log = nrequire("log.lua") - local oldregister = item.RegisterItem + local oldregister = itm.RegisterItem function itm.RegisterItem(itemtbl) local oldserialize = itemtbl.Serialize local olddeserialize = itemtbl.DeSerialize @@ -34,8 +34,8 @@ garrysmod/addons/artery_rougelite/data/artery/global/item_attributes.txt self.attribute = 1 elseif firstchar == "c" then self.attribute = -1 - elseif firstchar == "n" then - self.attribute = 0 + elseif firstchar == "n" then -- Notice above, the item dosn't nessessarilly need a .attribute field. + self.attribute = nil else log.error("Deserialized with unknown first character: " .. firstchar) end |
