From 5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 28 Feb 2018 09:41:23 -0500 Subject: Fixed some types, worked on 0x050 Fixed typos in a bunch of tutorials, did a little more work on 0x050 - Entities --- tutorials/tut042_too_many_items.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tutorials/tut042_too_many_items.md') 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 -- cgit v1.2.3-70-g09d2