|
|
@ -47,6 +47,7 @@ struct workshop_hack_data
|
|
|
|
int frame_skip; // e.g. 2 means have to ticks between frames
|
|
|
|
int frame_skip; // e.g. 2 means have to ticks between frames
|
|
|
|
//updateCallback:
|
|
|
|
//updateCallback:
|
|
|
|
int skip_updates;
|
|
|
|
int skip_updates;
|
|
|
|
|
|
|
|
int room_subset; //0 no, 1 yes, -1 default
|
|
|
|
};
|
|
|
|
};
|
|
|
|
typedef std::map<int32_t,workshop_hack_data> workshops_data_t;
|
|
|
|
typedef std::map<int32_t,workshop_hack_data> workshops_data_t;
|
|
|
|
workshops_data_t hacked_workshops;
|
|
|
|
workshops_data_t hacked_workshops;
|
|
|
@ -174,6 +175,17 @@ struct work_hook : df::building_workshopst{
|
|
|
|
|
|
|
|
|
|
|
|
return INTERPOSE_NEXT(isUnpowered)();
|
|
|
|
return INTERPOSE_NEXT(isUnpowered)();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(bool, canBeRoomSubset, ())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(auto def = find_def())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(def->room_subset==0)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if(def->room_subset==1)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return INTERPOSE_NEXT(canBeRoomSubset)();
|
|
|
|
|
|
|
|
}
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(void, updateAction, ())
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(void, updateAction, ())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(auto def = find_def())
|
|
|
|
if(auto def = find_def())
|
|
|
@ -241,6 +253,7 @@ IMPLEMENT_VMETHOD_INTERPOSE(work_hook, categorize);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, uncategorize);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, uncategorize);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, canConnectToMachine);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, canConnectToMachine);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, isUnpowered);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, isUnpowered);
|
|
|
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, canBeRoomSubset);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, updateAction);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, updateAction);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, drawBuilding);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(work_hook, drawBuilding);
|
|
|
|
void clear_mapping()
|
|
|
|
void clear_mapping()
|
|
|
@ -336,6 +349,7 @@ static int addBuilding(lua_State* L)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
newDefinition.machine_timing=false;
|
|
|
|
newDefinition.machine_timing=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
newDefinition.room_subset=luaL_optinteger(L,9,-1);
|
|
|
|
hacked_workshops[newDefinition.myType]=newDefinition;
|
|
|
|
hacked_workshops[newDefinition.myType]=newDefinition;
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -354,6 +368,7 @@ static void enable_hooks(bool enable)
|
|
|
|
INTERPOSE_HOOK(work_hook,uncategorize).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,uncategorize).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,canConnectToMachine).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,canConnectToMachine).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,isUnpowered).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,isUnpowered).apply(enable);
|
|
|
|
|
|
|
|
INTERPOSE_HOOK(work_hook,canBeRoomSubset).apply(enable);
|
|
|
|
//update n render
|
|
|
|
//update n render
|
|
|
|
INTERPOSE_HOOK(work_hook,updateAction).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,updateAction).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,drawBuilding).apply(enable);
|
|
|
|
INTERPOSE_HOOK(work_hook,drawBuilding).apply(enable);
|
|
|
|