Tweaking DamagingBlocks

J Young Kim

New Member
Contributor
Design
DamagingBlocks

*
The description below focuses on interactions between the player and the damaging blocks, but please note that the interactions with the damaging blocks may also extend to NPCs (in theory, NPCs and players should have the same interactions with damaging blocks, but no test has been done to confirm this).

Purpose:

To provide support for blocks which cause damage (i.e. lava and cacti blocks). Players would be interested in this module because it would allow them to create their own damaging blocks. For instance, if a player would like to create a thorn bush which would damage players upon touching the bush, then the DamagingBlocks module would provide the necessary support to make it happen. In essence, this module would be mainly helpful for those creating new modules which require a block to deal damage upon physical contact.

Structure:
  • Components:
    • DamagingBlockComponent: The component for defining the damage the block should deal to the player as well as the time interval at which damage should be dealt (in the case the player continues to keep touching the block).
  • Systems:
    • DamageSystem: Deals instant damage to the player upon touching a damaging block and then 'ticks' of damage separated by a time interval as long as the player keeps touching the block. Also, destroys items dropped into lava. When the damaging block is at the head of the player, no damage will be dealt to the player.
  • Events:
    • DamagingBlocks does not make use of a custom event. However, it does use a 'OnEnterBlockEvent' event to check for the player entering the damaging block.
Extensibility:
DamagingBlocks is a module meant to be extended by other modules because it provides support for the blocks which deal damage upon physical contact but doesn't provide the blocks themselves. The following are some examples of modules which can extend DamagingBlocks
  • AnotherWorldPlants and PlantPack: As stated earlier, both of these modules can benefit from the DamagingBlocks module when creating thorned bushes.
  • Caves: Caves can be generated with Stalactites blocks that players can accidently fall on. DamangingBlocks can be extended so that the Stalactites deal damage as long as the player is standing on the block.
DamagingBlocks can also be extended to modules which are in need of liquid blocks that damage players inside the liquid (i.e. poisonous water). Some other examples of blocks in modules which DamagingBlocks can be used are a spiked block to use in walls in modules introducing temples/ruins for adventurous exploring and unpolished wooden planks for hardcore survival type modules (damage from wooden planks from splinters).
 
Top