nd-mortal for axil-nd, ported from SIC to libxylem.
git clone https://github.com/tty-pt/nd-mortalDocumentation
axil-nd-mortal
nd-mortal for axil-nd, ported from SIC to libxylem.
Owns mortality: hit points, death, healing and feeding. It implements the mcp_hp bar, mortal_damage, heal and feed, tracks the mortal table, and fires the on_death chain that fight, spell and the corpse path consume.
Install
make install
Installs:
lib/libnd-mortal.so
include/nd/mortal.h
There is deliberately no lib/nd-mortal.so symlink (see axil-nd-wts for why: mods.load names the installed filename, and the OpenBSD packing list never lists a symlink).
Also packaged across all 9 platforms (deb, apk, rpm, pacman, brew, openbsd, winget + Scoop, android-lib, and ios-lib + SwiftPM XCFramework) from a v* tag.
Build from source
make
Needs libxylem and the engine's game API, <nd/xy.h>, plus the <nd/attr.h> it co-implements against โ from checkouts beside this repo or from installed packages:
git clone https://github.com/tty-pt/nd-mortal && cd nd-mortal
git clone https://github.com/tty-pt/axil-nd ../axil-nd
git clone https://github.com/tty-pt/nd-attr ../axil-nd-attr
make
Both the checkout -I flags and the installed-package paths are on the command line at once (see Makefile), and a missing -I is ignored, so the same command works either way. CI names the deps explicitly (axil-nd,libxylem,nd-attr).
What it does
xy_install()registers themortaltable and the HP/mana bar plumbing.mcp_hp,mortal_damage,heal,feedare the provider bodies;
on_death is the chain killers amend (XY_DECL'd in <nd/mortal.h> along with on_murder, on_birth, on_mortal_life, on_mortal_survival).
on_addinitializes the row for a new entity;on_statusand
on_examine report the living state.
Wire Protocol & BCP Integration
- Registers
bcp_hpdynamically onHD_BCP. - Streams real-time Health gauge frames via
mcp_bar(bcp_hp, player, hp, max).
Testing
There is no test.sh here. Behaviour is asserted by the engine's own suite:
cd ../axil-nd
make && ./test.sh
Notes from the port
SIC_DEFโXY_IMPL,mod_installโxy_install,call_f(...)โ
f(...). call_verb/call_verb_to never existed (the engine confirms it); death and damage messages go out as nd_printf + nd_rwrite via OBJ.location.
- This module both implements and calls
on_death, andXY_DECLcannot
coexist with XY_IMPL in one TU, so it dispatches through its own registered adapter via a small _chain helper placed after the XY_IMPL.
- It
XY_IMPLs names from<nd/mortal.h>, so it definesMORTAL_IMPL
before including it.
- The link line is libxylem alone.
NEEDEDislibxylem.soandlibc.so.6.
License
BSD 2-Clause, carried over from tty-pt/nd-mortal. See LICENSE.