dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Fix machine workshop placement issue

Open warmist opened this issue 8 years ago • 2 comments

Now machine powered workshops need to be placed before what they connect to. Toady exposed new vmethods (in building manager and machine manager) to allow us to implement this correctly.

warmist avatar Mar 12 '16 20:03 warmist

Adding the request messages from Toady One for context. Maybe somebody will use it in the future. https://gist.github.com/warmist/8a7a025156812e947c6d5ae3808ceed7

warmist avatar Jul 27 '21 11:07 warmist

So some progress/ideas. AFAIK building-hacks and steam engine is currently broken - new machines do not connect to the "power grid".

So ideas to fix it (in a very non-exact terms):

  • somehow fix the current hack to work
  • call a custom assembled function from current building_manager::get_machine_hookup_list (that internally might call original one. It's "only" two places...
  • reimplement everything related in lua/c++ and do it manually. This could use original vmethods (for vanilla buildings). Issues:
    • we don't have a good "event" to trigger on.
    • more work (probably)
    • need to reverse original functions to be sure
    • corner cases (two machines connected by building steam engine between them)

Also it would be nice to get figure out the third function in the list (i.e. one that is from machine_handler).

Oh and also it might be enough to interpose building_manager::get_machine_hookup_list but that got "devirtualized" at call sites so new virtual functions does not get called. Also it does not have enough info (missing custom type) in the function parameters.

warmist avatar Jun 21 '22 09:06 warmist