v1.0.5NeverDark ModuleBSD-2-Clause

nd-equip for axil-nd, ported from SIC to libxylem.

GitHub
git clone https://github.com/tty-pt/nd-equip

Documentation

axil-nd-equip

nd-equip for axil-nd, ported from SIC to libxylem.

Owns equipment: the equipper table (one 9-slot row per entity), wield/wear effects, and the equipment display. It co-implements nd-attr's effect chain (equipment bonuses on top of the base value) and nd-fight's fighter_wt chain (wielded weapon weight, or the predecessor's value when bare-handed), both read through nd_last().

Install

make install

Installs:

lib/libnd-equip.so
include/nd/equip.h

There is deliberately no lib/nd-equip.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 <nd/attr.h> for the chain this module co-implements โ€” from checkouts beside this repo or from installed packages:

git clone https://github.com/tty-pt/nd-equip && cd nd-equip
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 the equipper table (equipper_t is 9

unsigneds, one per body slot).

  • effect adds weapon damage and armour on top of the chain value;

fighter_wt answers the wielded weapon's weight; on_examine shows the kit; on_add initializes the row; on_leave and on_auth cover leaving and login display.

In-Game Commands (man-src/)

CommandSectionDescription
equip10Equip weapons, armor, or rings to corresponding body slots
unequip10Remove worn equipment and return it to inventory

Packaged Assets

  • Art (art/): Equipment sprites and item icons (dagger.png, chainmail_armor_chest.png, hide_armor_chest.png, padded_armor_chest.png, etc.).
  • Manuals (man-src/): In-game manual pages for equipment commands.

Wire Protocol & BCP Integration

  • Registers bcp_equipment dynamically on HD_BCP.
  • Transmits 9-slot bodypart array (BP_HEAD, BP_NECK, BP_CHEST, BP_BACK, BP_PANTS, BP_RHAND, BP_LHAND, BP_RFINGER, BP_LFINGER) directly to pure-C isomorphic clients.
  • Registers dynamic client action button action_register("equip", "๐Ÿ‘•").

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(...). stat became attr_stat: the bare name collides with libc's stat(2).

  • This TU defines ATTR_IMPL (it XY_IMPLs effect) but still calls

attr_stat/mp_max/hp_max, so those three are manually re-declared โ€” an XY_DECL cannot coexist with the XY_IMPL in one TU.

  • on_equip / on_unequip are XY_DECL-only in <nd/equip.h>: fired, but

with no implementor anywhere the dispatch returns 0.

  • G() โ†’ sqrt(), so this module links -lm alongside libxylem.

NEEDED is libxylem.so, libm.so.6 and libc.so.6.

License

BSD 2-Clause, carried over from tty-pt/nd-equip. See LICENSE.

Maintained by:tty-pt