Skip to content

Instantly share code, notes, and snippets.

@sapier
Last active December 30, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sapier/7811148 to your computer and use it in GitHub Desktop.
Save sapier/7811148 to your computer and use it in GitHub Desktop.
********************************************************************************
* *
* Advanced spawning mod (adv_spawning) 0.0.0 *
* *
* URL: http://github.com/sapier/adv_spawning *
* Author: sapier *
* *
********************************************************************************
Description:
--------------------
Advances spawning mod is designed to provide a feature rich yet easy to use
spawner for entites. It's purpose is to support spawning within large numbers
of different environments. While adv_spawning supports a wide configurable range
of spawning situations, it's performance impact is clamped at minimal level.
To achiev this performance goal adv_spawning is intended for low frequency
entity spawning only, typical a low single digit count of entities per second
throughout whole world
API:
--------------------
adv_spawning.register(entity_name,spawning_def) --> successfull true/false
^ register a spawn to adv_spawning mechanisms
^ entity_name is name of entity to spawn
^ spawning_def is configuration of spawner
adv_spawning.statistics() --> statistics data about spawning
Spawning definition:
--------------------
{
absolute_height = -- absolute y value to check
{
min = 1, -- minimum height to spawn at
max = 5 -- maximum height to spawn at
}
relative_height = --relative y value to next non environment node
{
min = 1, -- minimum height above non environment node
max = 5 -- maximum height above non environment node
}
spawn_inside, -- [MANDATORY] list of nodes to to spawn within (see spawn inside example)
surfaces, -- list of nodes to spawn uppon (same format as spawn_inside)
entities_around = -- list of surrounding entity definitions
{
entity_def_1,
entity_def_2,
...
},
nodes_around = -- list of surrounding node definitions
{
node_def_1,
node_def_2,
...
},
light_around = -- list of light around definitions
{
light_around_def_1,
light_around_def_2,
...
}
collisionbox = {}, -- collisionbox of entity to spawn (usually same as used for entiy itself)
spawn_interval = 200 -- [MANDATORY] interval to try to spawn a entity
}
Light around definition:
{
type = "TIMED_MIN", -- type of light around check TIMED_MIN/TIMED_MAX,OVERALL_MAX,OVERALL_MIN,CURRENT_MIN,CURRENT_MAX
distance = 2, -- distance to check (be carefull high distances may cause lag)
threashold = 2, -- value to match at max/at least to pass this check
time = 6000 -- time to do check at (TIMED_MIN/TIMED_MAX only)
}
Surrounding node definition:
{
type = "MIN", -- type of surround check valid types are MIN and MAX
name = "default:tree", -- name of node to check
distance = 7, -- distance to look for node
threshold = 1 -- number to match at max/at least to pass this check
}
Surrounding entity definition:
{
type = "MIN", -- type of surround check valid types are MIN and MAX
entityname = "mod:entity", -- name of entity to check
distance = 3, -- distance to look for this entity
threshold = 2 -- number to match at max/at least to pass this check
}
spawn_inside definition (list of nodenames):
{
"air",
"default:water_source",
"default:water_flowing"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment