API Reference
This documentation is automatically generated directly from PyToNingans Python source code, docstrings, type annotations, and method signatures using mkdocstrings.
Modpack Controller API
pytoningans.core.api.BaseModPack
Base class for shared modpack logic in pack.py.
Provides shared state, lifecycle hooks, and context menu actions for all child entities.
Source code in src/pytoningans/core/api/modpack.py
on_pack_loaded
on_entity_spawned
pytoningans.core.api.PackMenuAction
dataclass
Action button added to an entity's desktop context menu by its parent modpack.
Source code in src/pytoningans/core/api/modpack.py
Entity & Component Protocols
pytoningans.core.api.IModInfo
Bases: Protocol
Metadata and runtime configuration for a loaded mod.
Source code in src/pytoningans/core/api/protocols.py
pytoningans.core.api.IEntity
Bases: IBaseEntity, Protocol
Living desktop entity with health, AI, combat, and dialogue.
Source code in src/pytoningans/core/api/protocols.py
jump
take_damage
heal
die
revive
force_talk
say
Displays a speech bubble with the given text for duration_ms milliseconds.
pick_up
drop_item
pytoningans.core.api.BaseComponent
Base class for writing custom mod components in pure Python.
Source code in src/pytoningans/core/api/components.py
on_attach
update
Custom Behaviors & AI Hooks
pytoningans.core.api.BaseEntityBehavior
Inherit from this class in your entity's behavior.py.
Override any of the hook methods below to implement custom AI logic, interactions,
combat rules, or dialogue responses.
Source code in src/pytoningans/core/api/behaviors.py
on_spawn
on_update
on_decision_tick
Called when the engine's AI brain evaluates a wander or action decision. Return True to override default engine movement/action behavior.
on_interact
Called when this entity collides with or approaches another living entity. Return True to override the default social interaction.
on_item_interact
Called when this entity collides with or touches an item on the ground. Return True to override default collision handling (e.g. automatically picking up).
Source code in src/pytoningans/core/api/behaviors.py
on_seek_item
Called when the entity evaluates seeking an item (e.g. survival or scavenging). - Return a specific IItem to actively pathfind towards it. - Return True to indicate custom seeking was handled (skips default search). - Return False or None to allow default survival seeking (e.g. seeking healing items when low on HP) to run.
Source code in src/pytoningans/core/api/behaviors.py
on_speak
on_damage
on_death
on_revive
on_attack
Called when the entity initiates an attack against target. Return True to override engine combat resolution.
on_state_change
on_hover_enter
on_hover_leave
on_cursor_grabbed
Settings & Engine Configuration
pytoningans.core.settings.SettingsManager
Bases: QObject
Source code in src/pytoningans/core/settings.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
pytoningans.core.settings.AppSettings
dataclass
Global user preferences and application configuration settings.