aboutsummaryrefslogtreecommitdiff
path: root/tutorials/tut042_too_many_items.md
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-02-28 09:41:23 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2018-02-28 09:41:23 -0500
commit5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162 (patch)
treeba03a7c2975e2c5c88732cc28be90365e6cd41aa /tutorials/tut042_too_many_items.md
parenta77ee4ce201de757ce4c5958d9e499a65b2cf416 (diff)
downloadartery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.tar.gz
artery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.tar.bz2
artery-5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162.zip
Fixed some types, worked on 0x050
Fixed typos in a bunch of tutorials, did a little more work on 0x050 - Entities
Diffstat (limited to 'tutorials/tut042_too_many_items.md')
-rw-r--r--tutorials/tut042_too_many_items.md10
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