summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/orangeseeds.lua
blob: c9c39631fbb3fc22a3346ad4c66fe28382f93ff1 (plain)
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
ITEM = {}

ITEM.Name = "Orange Seeds"
ITEM.Description = "Something you can plant!"
ITEM.Icon = "test.png"
ITEM.UniqueData = false

--Things needed to make something plantable
ITEM.GrowTime = 1
ITEM.OnGrow = function(self, aor, owner)
  print("Owner:")
  print(owner)
  local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, -12 ), "models/props/cs_office/plant01_p1.mdl" )
	plant.Children = 0

	plant:SetCollisionGroup( 0 )
	plant:SetSolid( SOLID_NONE )
	plant.Children = 0

  local num = 1
  if ( IsValid( owner ) && owner:HasUnlock( "Adept_Farmer" ) ) then num = num + math.random( 0, 1 ) end
  if ( IsValid( owner ) && owner:HasUnlock( "Expert_Farmer" ) ) then num = num + math.random( 0, 2 ) end

  for i = 1, num do
		GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -5, 5 ), math.random( -5, 5 ), math.random( 13, 30 ) ), "models/props/cs_italy/orange.mdl", plant )
	end
end

genericMakePlantable(ITEM)
genericMakeDroppable(ITEM)

GMS.RegisterResource(ITEM)