Dungeon Hopper

Dungeon Hopper

  • Docs

›Topics

Getting Started

  • What is this?

Terminology And Basics

  • The lifecycle of the game
  • Chains and Chain Templates
  • Calling Conventions

Topics

  • Game Loop
  • Decorators
  • Action
  • Algorithms
  • Movs Algorithms
  • Sequence
  • Modifiers
  • Dynamic Stats
  • Retouchers
  • Tinkers
  • Status effects
  • Items
  • Weapons
  • Pools
  • World Generation
  • Mods

Retouchers

Retouchers are functions that add handlers to the chain template of an entity class. This can be done manually too, but the goal of retouchers is to provide an easier interface and attempt to hide internal details as much as possible, as well as eliminate duplicate code.

Not to be confused with Tinkers, which add handlers to the chains of an instance of an entity.

Example usage

Here's an excerpt from the player script

-- ... --
local Skip = require 'logic.retouchers.skip'
Skip.emptyAttack(Player) -- apply a retoucher, or simply retouch
Skip.emptyDig(Player)

local Reorient = require 'logic.retouchers.reorient'
Reorient.onActionSuccess(Player)
-- ... --

Skip.emptyAttack marks the attack component of the action chain unsuccessful if there are no entities targeted by the weapon. In contrast, the default behavior is to attack empty cells. Similarly, Skip.emptyDig does the same for the dig action component.

Reorient.onActionSuccess reorients the player to the direction of the action once the action succeeds.

List of retouchers

Algos

Apply GeneralAlgo or SimpleAlgo. See algos.

FunctionDescriptionChains Modified
generalapplies the general algoaction
simpleapplies the simple algoaction

Attackableness

FunctionAdditional parametersDescriptionChains Modified
constantattackablenessReturn attackableness when Attackable.getAttackableness is calledattackableness

Bump

Fires Changes.Bump event for the view-model after a displace call results in no avail.

Chains Modified
displace

Apply it like so:

Retouchers.Bump(EntityClass)

Equip

Equips items. See items.

FunctionDescriptionChains Modified
onDisplaceequips the items and drops the overlow when the entity displaces onto a dropped itemdisplace

Invincibility

Makes the invincibility status effect meaningful.

FunctionAdditional parametersDescriptionChains Modified
preventsDamage-Prevents taking damage by being attacked if the current invincibility level is greater than 0defence
setAfterHitamountSets the invincibility stat to amount after getting hitbeHit
decreases-Decrease the invincibility stat each ticktick

NoAction

Nullifies the next action after some event. Works by setting entity.didAction to true, so would not last between beats.

FunctionDescriptionChains Modified
ifHitSkip the next time the entity would act if it were hitbeHit
ifPushedSkip the next time the entity would act if it were pushedbePushed
byAttackingMake the attacked entities skip the next time they would act if the retouched entity were to attack themattack

Reorient

All the handlers reorient the entity to point in action.direction (marked as a star) after some event takes place.

FunctionDescriptionChains Modified
onMove* on movemove
onDisplace* on displacedisplace
onActionSuccess* on an action succeedingsucceedAction
onAttack* on an attackattack
onDig* on a digdig

Skip

All added handlers modify event.propagate based on some value.

FunctionDescriptionChains Modified
emptyAttackstop the attack if list of targets is emptygetAttack
emptyDigstop the dig if list of targets is emptygetDig
blockedMovestop the move if the targeted direction is blockedgetMove
noPlayerstop if the list of targets doesn't have a playergetAttack

Mods

Mods may add retouchers too. Read more on mods here.

← Dynamic StatsTinkers →
  • Example usage
  • List of retouchers
    • Algos
    • Attackableness
    • Bump
    • Equip
    • Invincibility
    • NoAction
    • Reorient
    • Skip
  • Mods
Dungeon Hopper
Docs
Getting Started
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHub RepoStar
Facebook Open Source
Copyright © 2020 Your Name or Your Company Name