-
-
Save Quit/bb8371d8380b15002450 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MOD = class() | |
local entity_name = 'my_mod:apple_tree' | |
function MOD:get_tree_type(event) | |
if event.elevation > MIN_ALTITUDE and event.elevation < MAX_ALTITUDE then | |
table.insert(event.proposals, entity_name) | |
end | |
end | |
function MOD:get_tree_name(event) | |
if event.type == entity_name then | |
table.insert(event.proposals, { name = entity_name, priority = math.huge }) -- or use random/event.size to determine a proper size | |
end | |
end | |
function MOD:__init() | |
radiant.events.listen(stonehearth.world_generation, 'rp:get_tree_type', self, self.get_tree_type) | |
radiant.events.listen(stonehearth.world_generation, 'rp:get_tree_name', self, self.get_tree_name) | |
end | |
return MOD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment