Regions define areas that can later be applied to Filters and other modules. Understanding how modules, regions and filters work together is important to make critical mechanics for a map.
Creating a Region
Creating a Region involves certain world coordinates.
In this example, we will create simple
<cuboid/> regions inside a
<union>, which we will save with IDs
which we can reference for later use.
Creating a Filter
Creating a Filter allows us to put restrictions on certain events. We want to stop players from entering their enemy's spawn region, usually to prevent spawnkilling. Our goal is to filter players that are entering a region, so we will make basic filters that matches for players on a certain team.
Applying a Filter to a Region
Applying filters to a region is done inside the
When we make our
<apply/> module, we can use the IDs in our region and filter to reference them as a variable.
Out of the various events,
we will use the
When a player enters
red-spawn, we want to make sure that only players on the red team are able to enter it.
So we apply our
only-red filter to players that are entering it.
Applying things to multiple regions
Typically we want to prevent players from placing or breaking any blocks in spawn, but
we have two spawn regions defined in our XML, and both need spawn protection.
<union> element using the ID
spawns combines the two team spawns into a single region.
<apply/> will let us apply a filter to both regions.
We will use the built-in
never filter, which denies everything.
This XML protects spawn from being damaged by players, TNT, mobs, etc and prevents
players from entering their enemy's spawn room, but can still safely enter their own.