Skip to content

Commit

Permalink
Merge branch 'develop' into tweak/material_size_for_melting
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkow authored Sep 28, 2024
2 parents 076031a + 9c69796 commit f6b1523
Show file tree
Hide file tree
Showing 30 changed files with 3,560 additions and 3,333 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ Template for new versions:

## API

- ``DFHack::Units``: new function ``setPathGoal``

## Lua

- ``dfhack.units``: new function ``setPathGoal``

## Removed

# 50.14-r1
Expand Down
5 changes: 5 additions & 0 deletions docs/dev/Lua API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,11 @@ Units module
``dfhack.units.isOwnCiv`` or another appropriate predicate on the unit
in question.

* ``dfhack.units.setPathGoal(unit, pos, goal)``

Set target coordinates and goal (of type ``df.unit_path_goal``) for the given
unit. In case of a change, also clears the unit's current path.

* ``dfhack.units.create(race, caste)``

Creates a new unit from scratch. The unit will be added to the
Expand Down
1 change: 1 addition & 0 deletions library/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,7 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = {
WRAPM(Units, getIdentity),
WRAPM(Units, getNemesis),
WRAPM(Units, makeown),
WRAPM(Units, setPathGoal),
WRAPM(Units, create),
WRAPM(Units, getPhysicalAttrValue),
WRAPM(Units, getMentalAttrValue),
Expand Down
4 changes: 4 additions & 0 deletions library/include/modules/Units.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ distribution.
#include "df/physical_attribute_type.h"
#include "df/unit_action.h"
#include "df/unit_action_type_group.h"
#include "df/unit_path_goal.h"

#include <ranges>

Expand Down Expand Up @@ -238,6 +239,9 @@ DFHACK_EXPORT bool unassignTrainer(df::unit *unit);
/// to determine if the makeown operation was successful.
DFHACK_EXPORT void makeown(df::unit *unit);

// Set the units target location and goal, clearing any existing goal or path
DFHACK_EXPORT void setPathGoal(df::unit *unit, df::coord pos, df::unit_path_goal goal);

/// Create new unit and add to all units vector (but not active). No HF, nemesis, pos,
/// labors, or group associations. Will have race, caste, name, soul, body, and mind.
DFHACK_EXPORT df::unit *create(int16_t race, int16_t caste);
Expand Down
Loading

0 comments on commit f6b1523

Please sign in to comment.