Continue work on unit action timer API

develop
Tachytaenius 2022-11-18 22:10:14 +00:00
parent 16ef4f8313
commit 7f54a77ed9
4 changed files with 13 additions and 13 deletions

@ -1780,11 +1780,11 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = {
WRAPM(Units, getStressCategory), WRAPM(Units, getStressCategory),
WRAPM(Units, getStressCategoryRaw), WRAPM(Units, getStressCategoryRaw),
WRAPM(Units, subtractActionTimer), WRAPM(Units, subtractActionTimer),
WRAPM(Units, subtractActionTimerCategory), WRAPM(Units, subtractCategoryActionTimers),
WRAPM(Units, multiplyActionTimer), WRAPM(Units, multiplyActionTimer),
WRAPM(Units, multiplyActionTimerCategory), WRAPM(Units, multiplyCategoryActionTimers),
WRAPM(Units, setActionTimer), WRAPM(Units, setActionTimer),
WRAPM(Units, setActionTimerCategory), WRAPM(Units, setCategoryActionTimers),
{ NULL, NULL } { NULL, NULL }
}; };

@ -39,7 +39,7 @@ distribution.
#include "df/physical_attribute_type.h" #include "df/physical_attribute_type.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_action.h" #include "df/unit_action.h"
#include "df/unit_action_timer_type_group.h" #include "df/unit_action_type_group.h"
namespace df namespace df
{ {
@ -227,11 +227,11 @@ DFHACK_EXPORT int getStressCategory(df::unit *unit);
DFHACK_EXPORT int getStressCategoryRaw(int32_t stress_level); DFHACK_EXPORT int getStressCategoryRaw(int32_t stress_level);
DFHACK_EXPORT void subtractActionTimer(df::unit *unit, int amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void subtractActionTimer(df::unit *unit, int amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void subtractActionTimerCategory(df::unit *unit, int amount, df::unit_action_timer_type_group affectedActionTypes); DFHACK_EXPORT void subtractCategoryActionTimers(df::unit *unit, int amount, df::unit_action_type_group affectedActionTypes);
DFHACK_EXPORT void multiplyActionTimer(df::unit *unit, float amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void multiplyActionTimer(df::unit *unit, float amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void multiplyActionTimerCategory(df::unit *unit, float amount, df::unit_action_timer_type_group affectedActionTypes); DFHACK_EXPORT void multiplyCategoryActionTimers(df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes);
DFHACK_EXPORT void setActionTimer(df::unit *unit, int amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void setActionTimer(df::unit *unit, int amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void setActionTimerCategory(df::unit *unit, int amount, df::unit_action_timer_type_group affectedActionTypes); DFHACK_EXPORT void setCategoryActionTimers(df::unit *unit, int amount, df::unit_action_type_group affectedActionTypes);
} }
} }

@ -81,7 +81,7 @@ using namespace std;
#include "df/unit_wound.h" #include "df/unit_wound.h"
#include "df/world.h" #include "df/world.h"
#include "df/unit_action.h" #include "df/unit_action.h"
#include "df/unit_action_timer_type_group.h" #include "df/unit_action_type_group.h"
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
@ -2017,7 +2017,7 @@ void Units::subtractActionTimer(df::unit *unit, int amount, df::unit_action_type
} }
} }
void Units::subtractActionTimerCategory(df::unit *unit, int amount, df::unit_action_timer_type_group affectedActionTypes) void Units::subtractCategoryActionTimers(df::unit *unit, int amount, df::unit_action_type_group affectedActionTypes)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
for (auto action : unit->actions) { for (auto action : unit->actions) {
@ -2046,7 +2046,7 @@ void Units::multiplyActionTimer(df::unit *unit, float amount, df::unit_action_ty
} }
} }
void Units::multiplyActionTimerCategory(df::unit *unit, float amount, df::unit_action_timer_type_group affectedActionTypes) void Units::multiplyCategoryActionTimers(df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
for (auto action : unit->actions) { for (auto action : unit->actions) {
@ -2075,7 +2075,7 @@ void Units::setActionTimer(df::unit *unit, int amount, df::unit_action_type affe
} }
} }
void Units::setActionTimerCategory(df::unit *unit, int amount, df::unit_action_timer_type_group affectedActionTypes) void Units::setCategoryActionTimers(df::unit *unit, int amount, df::unit_action_type_group affectedActionTypes)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
for (auto action : unit->actions) { for (auto action : unit->actions) {

@ -12,7 +12,7 @@
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
#include "df/units_other_id.h" #include "df/units_other_id.h"
#include "df/world.h" #include "df/world.h"
#include "df/unit_action_timer_type_group.h" #include "df/unit_action_type_group.h"
using std::string; using std::string;
using std::vector; using std::vector;
@ -83,7 +83,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
if (enable_fastdwarf) if (enable_fastdwarf)
{ {
Units::setActionTimerCategory(unit, 1, df::unit_action_timer_type_group::All); Units::setCategoryActionTimers(unit, 1, df::unit_action_type_group::All);
} }
} }
return CR_OK; return CR_OK;