Core Loading

Sometimes you will wish to change logic in the core game code. This is possible through core loading.

To use core loading you must mirror the directory path starting with mods/mymod/coremod/. Such as to overload something in mods/core/ you will want to place your code in mods/mymod/coremod/ Core loading can be used to modify both functions and classes.

The same function can be loaded multiple times from either the same mod or from multiple mods and the final function chains all of the loads.


Be sure to import the loads that you need!

from coremod import overload, preload, postload, overloader, preloader, postloader, overloadmethod, postloadmethod, postloadmethod

Core Overloading

To completely overwrite a function you can use ‘overload’ core loading.

def calculateDamage(strength, defense, attackerLevel, target, power, attackType):
    '''Every hit is critical 9999 damage!'''
    return 9999

It is important to ensure the function name and parameters are the same as the core. However, it is possible to provide a separate name for the function using ‘overloader’.

def myCalculateDamage(strength, defense, attackerLevel, target, power, attackType):
    '''Every hit is critical 9999 damage!'''
    return 9999

Overloading a class method is possible by using ‘overloadmethod’.

class ExampleClass(object):
    def test(self, foo):


Preloading is very similar to overloading except that the original code is still executed after.

def handlePlayerDeath(entity, clock):
    '''Drop all items on death.'''
    position = entity.getPosition()
    droppedSystem = entity.realm.dropped
    for index, bag in enumerate(entity.inventory.getBags()):
        if bag:
            for index, item in enumerate(bag.items):
                if item:
                    droppedSystem.create(item, position, Vector(0, -6))

Similar to overloading it is important to have the function name correct but it can be different using ‘preloader’ the same way ‘overloader’ was used in the example above. To preload a class method use ‘preloadmethod’.


Postloading is the same as preloading except the original code is executed before.

def dropMonsterLoot(entity, remna, loot, canDropKey):
    '''Drop a candycane from all monsters.'''
    entity.realm.dropped(Item('candycane'), entity.getPosition(), Vector(0, -6))

Just like ‘preloader’ and ‘preloadmethod’ there are ‘postloader’ and ‘postloadmethod’ decorators.