summaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/items/melonseeds.lua
blob: e66b08726c32e197d47c44d02e7c3b35e3966c81 (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
--The seeds for the melon plant

ITEM = {}

ITEM.Name = "Melon Seeds"
ITEM.Description = "Something you can plant!"
ITEM.Icon = "items/seed_melon.png"
ITEM.UniqueData = false

ITEM.GrowTime = 1
ITEM.OnGrow = function(self, aor, owner)
  local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, 13 ), "models/props/CS_militia/fern01.mdl" )
	plant.Children = 0

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

  for i = 1, num do
		GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -25, 25 ), math.random( -25, 25 ), math.random( 5, 7 ) ), "models/props_junk/watermelon01.mdl", plant )
	end
end
genericMakeDroppable(ITEM)
genericMakePlantable(ITEM)

GMS.RegisterResource(ITEM)