diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-11-03 18:23:45 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-11-03 18:23:45 -0400 |
| commit | 28affa22541b9ef251707793f6b1c1a26d663592 (patch) | |
| tree | 622754894d75c74dc5e8516ccf184ad4bf328fef /gamemode/questsystem/component_gather.lua | |
| parent | c639e7c7c6ab1595fdce39f56312e3d6a886bbe8 (diff) | |
| download | artery-28affa22541b9ef251707793f6b1c1a26d663592.tar.gz artery-28affa22541b9ef251707793f6b1c1a26d663592.tar.bz2 artery-28affa22541b9ef251707793f6b1c1a26d663592.zip | |
Started on new npc system
Started work on the new npc system
Diffstat (limited to 'gamemode/questsystem/component_gather.lua')
| -rw-r--r-- | gamemode/questsystem/component_gather.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gamemode/questsystem/component_gather.lua b/gamemode/questsystem/component_gather.lua index 5647f42..cc7f44f 100644 --- a/gamemode/questsystem/component_gather.lua +++ b/gamemode/questsystem/component_gather.lua @@ -8,6 +8,12 @@ local comp = {} comp.Name = "Quest Component Gather" +--[[ +Update this quest, this is called every time a player +picks up an item. This method removes the items from the player, then +adds them back in (so dropping an item and picking it up x number of times +will not work. +]] function comp:Update() if SERVER then local items = {} @@ -49,6 +55,10 @@ function comp:Init(ply,itemname,itemnumber) log.debug("After initalizing quest, found " .. tostring(self.items) .. " items") end +--[[ +Detour the player's GiveItem(), to check if the quest is +complete after giving the player the item +]] if SERVER then local plymeta = FindMetaTable("Player") local det = plymeta.GiveItem @@ -56,7 +66,7 @@ if SERVER then det(self,tbl) log.debug("Calling component_gather's GiveItem()") for k,v in pairs(quests) do - if v.ItemName == tbl.Name then + if v.Name == comp.Name and v.ItemName == tbl.Name then v:Update() end end |
