Jump to content

Conditional drop for earthquake


Recommended Posts

local AutumnDebris = {
	{ -- common
		weight = 0.75,
		loot = {
			"rocks",
			"flint",
		},
	},
	{ -- uncomon
		weight = 0.20,
		loot = {
			"goldnugget",
			"nitre",
			"rabbit",
			"mole",
		},
	},
	{ -- rare
		weight = 0.05,
		loot = {
			"redgem",
			"bluegem",
			"marble",
		},
	},
}

local WinterDebris = {
	{ -- common
		weight = 0.75,
		loot = {
			"ice",
			"flint",
		},
	},
	{ -- uncomon
		weight = 0.20,
		loot = {
			"goldnugget",
			"nitre",
			"rabbit",
			"mole",
		},
	},
	{ -- rare
		weight = 0.05,
		loot = {
			"redgem",
			"bluegem",
			"marble",
		},
	},
}

local SpringDebris = {
	{ -- common
		weight = 0.75,
		loot = {
			"rocks",
			"flint",
		},
	},
	{ -- uncomon
		weight = 0.20,
		loot = {
			"goldnugget",
			"nitre",
			"rabbit",
			"mole",
		},
	},
	{ -- rare
		weight = 0.05,
		loot = {
			"redgem",
			"bluegem",
			"marble",
		},
	},
}

local SummerDebris = {
	{ -- common
		weight = 0.75,
		loot = {
			"rocks",
			"flint",
		},
	},
	{ -- uncomon
		weight = 0.20,
		loot = {
			"goldnugget",
			"nitre",
			"rabbit",
			"mole",
		},
	},
	{ -- rare
		weight = 0.05,
		loot = {
			"redgem",
			"yellowgem",
			"marble",
		},
	},
}

AddComponentPostInit("quaker", function(self)
	local _world = GLOBAL.TheWorld
	if _world and _world.ismastersim then
		local function UpdateDebris(_world)
			local season = _world.state.season
			print("MOD - Setting "..season.." quake debris")
			if season == "summer" then
				self:SetDebris(SummerDebris)
			elseif season == "spring" then
				self:SetDebris(SpringDebris)				
			elseif season == "winter" then
				self:SetDebris(WinterDebris)
			else -- "autumn"
				self:SetDebris(AutumnDebris)
			end
		end
		_world:WatchWorldState("season", UpdateDebris)
		UpdateDebris(_world)
	end
end)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...