-
Notifications
You must be signed in to change notification settings - Fork 4
/
itemcollection.lua
61 lines (32 loc) · 975 Bytes
/
itemcollection.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- itemcollection.lua
-- This file contains classes that will handle different methods for collecting items
function cCollectionSkeleton()
local self = {}
function self:NextBlock()
end
function self:Finish()
end
return self
end
function cToInventoryCollection(a_Player, a_BlockType, a_BlockMeta)
local m_Inventory = a_Player:GetInventory()
local m_Block = cItem(a_BlockType, 1, a_BlockMeta)
local self = cCollectionSkeleton()
function self:NextBlock(a_X, a_Y, a_Z)
m_Block.m_ItemCount = m_Block.m_ItemCount + 1
end
function self:Finish()
m_Inventory:AddItem(m_Block)
end
return self
end
function cPickupCollection(a_Player, a_BlockType, a_BlockMeta)
local m_World = a_Player:GetWorld()
local m_Block = cItems()
m_Block:Add(a_BlockType, 1, a_BlockMeta)
local self = cCollectionSkeleton()
function self:NextBlock(a_X, a_Y, a_Z)
m_World:SpawnItemPickups(m_Block, a_X, a_Y, a_Z, math.random())
end
return self
end