reenable autolabor for testing

minimum required to make work:
* realign the job table
* add code to flip/flop the work detail enable flag
develop
Kelly Kinkade 2023-01-29 22:55:11 -06:00
parent e1c07817ea
commit d780dc6847
4 changed files with 16 additions and 11 deletions

@ -81,7 +81,7 @@ dfhack_plugin(autoclothing autoclothing.cpp)
dfhack_plugin(autodump autodump.cpp)
dfhack_plugin(autofarm autofarm.cpp)
#dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static)
#add_subdirectory(autolabor)
add_subdirectory(autolabor)
#dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua)
dfhack_plugin(automelt automelt.cpp LINK_LIBRARIES lua)
#dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)

@ -10,6 +10,6 @@ set_source_files_properties(${COMMON_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)
# mash them together (headers are marked as headers and nothing will try to compile them)
list(APPEND COMMON_SRCS ${COMMON_HDRS})
dfhack_plugin(labormanager labormanager.cpp joblabormapper.cpp ${COMMON_SRCS})
#dfhack_plugin(labormanager labormanager.cpp joblabormapper.cpp ${COMMON_SRCS})
dfhack_plugin(autolabor autolabor.cpp ${COMMON_SRCS})

@ -34,6 +34,8 @@
#include <df/items_other_id.h>
#include <df/plotinfost.h>
#include <df/activity_info.h>
#include <df/global_objects.h>
#include <df/gamest.h>
#include <MiscUtils.h>
@ -49,6 +51,7 @@ using namespace df::enums;
DFHACK_PLUGIN("autolabor");
REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(game);
#define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))
@ -399,6 +402,8 @@ static void enable_plugin(color_ostream &out)
cleanup_state();
init_state();
df::global::game->external_flag |= 1; // shut down DF's work detail system
}
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
@ -1065,6 +1070,8 @@ DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable )
enable_autolabor = false;
setOptionEnabled(CF_ENABLED, false);
df::global::game->external_flag &= ~1; // reenable DF's work detail system
out << "Autolabor is disabled." << std::endl;
}

@ -42,6 +42,8 @@ char const* state_names[] {
const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* CarveFortification */,
dwarf_state::BUSY /* SmoothWall */,
dwarf_state::BUSY /* SmoothFloor */,
dwarf_state::BUSY /* DetailWall */,
dwarf_state::BUSY /* DetailFloor */,
dwarf_state::EXCLUSIVE /* Dig */,
@ -75,21 +77,17 @@ const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* CatchLiveLandAnimal */,
dwarf_state::BUSY /* CatchLiveFish */,
dwarf_state::BUSY /* ReturnKill */,
dwarf_state::BUSY /* CheckChest */,
dwarf_state::BUSY /* StoreOwnedItem */,
dwarf_state::BUSY /* PlaceItemInTomb */,
dwarf_state::BUSY /* StoreItemInStockpile */,
dwarf_state::BUSY /* StoreItemInBag */,
dwarf_state::BUSY /* StoreItemInHospital */,
dwarf_state::BUSY /* StoreItemInChest */,
dwarf_state::BUSY /* StoreItemInCabinet */,
dwarf_state::BUSY /* StoreItemInLocation */,
dwarf_state::BUSY /* StoreWeapon */,
dwarf_state::BUSY /* StoreArmor */,
dwarf_state::BUSY /* StoreItemInBarrel */,
dwarf_state::BUSY /* StoreItemInBin */,
dwarf_state::BUSY /* SeekArtifact */,
dwarf_state::BUSY /* SeekInfant */,
dwarf_state::OTHER /* AttendParty */,
dwarf_state::OTHER /* GoShopping */,
dwarf_state::OTHER /* GoShopping2 */,
dwarf_state::BUSY /* Clean */,
@ -117,6 +115,7 @@ const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* ConstructCoffin */,
dwarf_state::BUSY /* ConstructTable */,
dwarf_state::BUSY /* ConstructChest */,
dwarf_state::BUSY /* ConstructBag */,
dwarf_state::BUSY /* ConstructBin */,
dwarf_state::BUSY /* ConstructArmorStand */,
dwarf_state::BUSY /* ConstructWeaponRack */,
@ -153,7 +152,7 @@ const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* MilkCreature */,
dwarf_state::BUSY /* MakeCheese */,
dwarf_state::BUSY /* ProcessPlants */,
dwarf_state::BUSY /* ProcessPlantsBag */,
dwarf_state::BUSY /* PolishStones */,
dwarf_state::BUSY /* ProcessPlantsVial */,
dwarf_state::BUSY /* ProcessPlantsBarrel */,
dwarf_state::BUSY /* PrepareMeal */,
@ -165,7 +164,6 @@ const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* MakeChain */,
dwarf_state::BUSY /* MakeFlask */,
dwarf_state::BUSY /* MakeGoblet */,
dwarf_state::BUSY /* MakeInstrument */,
dwarf_state::BUSY /* MakeToy */,
dwarf_state::BUSY /* MakeAnimalTrap */,
dwarf_state::BUSY /* MakeBarrel */,
@ -188,10 +186,10 @@ const dwarf_state dwarf_states[] = {
dwarf_state::BUSY /* LoadStoneTrap */,
dwarf_state::BUSY /* LoadWeaponTrap */,
dwarf_state::BUSY /* CleanTrap */,
dwarf_state::BUSY /* CastSpell */,
dwarf_state::BUSY /* EncrustWithStones */,
dwarf_state::BUSY /* LinkBuildingToTrigger */,
dwarf_state::BUSY /* PullLever */,
dwarf_state::BUSY /* BrewDrink */,
dwarf_state::OTHER /* _unk_0x94*/,
dwarf_state::BUSY /* ExtractFromPlants */,
dwarf_state::BUSY /* ExtractFromRawFish */,
dwarf_state::BUSY /* ExtractFromLandAnimal */,