-- RTS.levelgen
function spawnResource(ship)
	local loc = ship:getPos()
	resourceitem = ResourceItem.new() --"setup" for creating a new resource item
	resourceitem:setPos(loc) 
	levelgen:addItem(resourceitem)
end

function removeSpecificObject() --Removes the testitem, Feudalism only.
	object = levelgen:findObjectById(5)
	if(object ~= nil) then
		object:removeFromGame()
	else
		return
	end
end

function onShipEnteredZone(ship, zone, zoneType, zoneId)
	if(zoneId == 2) then --I was too lazy to change all the zones to zoneID 1.  DEAL WITH IT.
		spawnResource(ship)
	end
end

function main()
	subscribe(Event.ShipEnteredZone) 
	Timer:scheduleOnce(removeSpecificObject, 120000)  --Removes the testitem, Feudalism only.  120000 is two minutes 
	logprint("timer started")
end