Commit Graph

1340 Commits (2781723f7bf2bef87b7c6c5252aebd6392cbefbf)

Author SHA1 Message Date
Petr Mrázek ed6da7618a Merge https://github.com/warmist/dfhack 2012-05-18 17:41:09 +02:00
Alexander Gavrilov 3c44e22760 Support trade viewscreens in Items::getSelectedItem. 2012-05-18 17:54:05 +04:00
Kelly Martin 51ad697bf5 Fix unresolved symbol reference in Windows platform. 2012-05-18 08:25:25 -05:00
Warmist 48185568e9 Added df::Items::moveToBuilding. Moved item from ground to building, usefull for museum forts (placing items on tables) 2012-05-18 16:05:29 +03:00
Kelly Martin 3f542b4df1 Update merge 2012-05-18 07:40:05 -05:00
Alexander Gavrilov 52426f9035 Track xml 2012-05-17 20:41:41 +04:00
Alexander Gavrilov f37f708b37 Add a workaround for Planepacked bug in buildings constructed via API.
Buildings hanging in the air cause constructWithFilters to
exhibit the same behavior as a moody dwarf in a burrow excluding
the workshop, i.e. endlessly collecting the same type of reagent.

http://www.bay12games.com/dwarves/mantisbt/view.php?id=1416

The workaround monitors jobs and reclassifies the reagents on the fly.
2012-05-17 20:38:27 +04:00
Alexander Gavrilov e9ef9b87b5 Add central locations for onUpdate and onStateChange handling in core. 2012-05-17 20:04:09 +04:00
Alexander Gavrilov 2c0024adc9 Make Items::getPosition exactly match the DF original in behavior. 2012-05-17 19:56:55 +04:00
Alexander Gavrilov efdb709284 Support creating rollers and stops with dfhack.buildings.constructBuilding. 2012-05-17 00:19:29 +04:00
Alexander Gavrilov 68c5d9b86c Stop Shift-Enter from being handled as if it was Shift-M. 2012-05-16 18:10:07 +04:00
Alexander Gavrilov dbd39af58a Support testing and modifying pending timeout callbacks. 2012-05-16 17:06:08 +04:00
Kelly Martin e77c9dc730 Add new PUSH_HAUL_VEHICLES labor to autolabor.
This commit will only work with 0.34.08 (or later).
2012-05-15 13:42:48 -05:00
harlanplayford 27ca317871 Added new method - Items::moveToInventory(...)
Signed-off-by: playfordh <harlanplayford@gmail.com>
2012-05-15 06:01:59 -04:00
Kelly Martin d4f9806568 Track library 2012-05-14 17:30:21 -05:00
Kelly Martin e078c75737 Track submodules 2012-05-14 13:44:03 -05:00
Alexander Gavrilov 642a625586 Support custom buildings in dfhack.buildings.getFiltersByType.
Also document it and constructBuilding in Lua API docs.
2012-05-13 18:39:00 +04:00
Alexander Gavrilov 87ec1de891 Improve lua api for tile biome access. 2012-05-13 13:58:41 +04:00
Alexander Gavrilov c6b52067bd Request designation rescan in auto-growing burrows.
This improves performance of burrowed miners digging 1-wide tunnels.
2012-05-12 20:54:26 +04:00
Alexander Gavrilov 60bb486aba Add api for enabling liquid and temperature updates for blocks.
Now updates also have to be enabled for the z level to work.
2012-05-12 20:12:09 +04:00
Alexander Gavrilov af3e389093 Update submodules. 2012-05-12 18:50:22 +04:00
Petr Mrázek 92f069e209 Brush output lists numbers, update xml. 2012-05-11 07:00:18 +02:00
Alexander Gavrilov d6813c7690 Change xml submodule pointer. 2012-05-08 19:08:34 +04:00
Alexander Gavrilov 191071beb6 Add more lua scripts. 2012-05-08 12:55:06 +04:00
Alexander Gavrilov fca618ff1b Support default building inputs in dfhack.buildings.constructBuilding. 2012-05-06 19:11:29 +04:00
Alexander Gavrilov 9ad8d767b4 Add code for adding abstract buildings and removing constructions. 2012-05-06 19:09:11 +04:00
Alexander Gavrilov b70130cf36 Add a couple more building api functions. 2012-05-06 11:22:55 +04:00
Alexander Gavrilov 05e8083c84 Allow constructing itemless actual buildings. 2012-05-06 10:09:39 +04:00
Alexander Gavrilov 3bd44e5367 Move some things that won't work in dfhack-client to a separate file. 2012-05-05 21:07:18 +04:00
Alexander Gavrilov 81f2240c23 Fix some things that confuse MSVC. 2012-05-05 20:46:28 +04:00
Alexander Gavrilov 7e01b004e9 Implement timeouts in the core lua context, and quicksave script. 2012-05-04 20:59:06 +04:00
Alexander Gavrilov d4d6349f48 Expose builtin commands to dfhack-run, and add lua script support.
Move builtin command implementation to Core methods, and fall
back to hack/scripts/*.lua for otherwise unrecognized commands.
2012-05-04 19:47:18 +04:00
Alexander Gavrilov 5afe2ca002 Update dfhack for specific_ref. 2012-05-03 11:47:04 +04:00
Alexander Gavrilov 28b5068382 Allow both coordinate object and (x,y,z) as arguments to getTileBlock. 2012-05-02 12:50:05 +04:00
Alexander Gavrilov eadce95940 Add a convenience function for designating constructions. 2012-05-01 19:55:25 +04:00
Alexander Gavrilov 4cffb6428d Update building creation code with new knowledge, and fix zone.
Also, document new lua api, and add a more convenient wrapper.
2012-05-01 18:55:30 +04:00
Alexander Gavrilov 2303a25bde Implement unconstructed building instance creation and linking into world.
For more flexibility, the base api is split into 3 phases:
alloc, setSize, and construct. No support for non-actual
buildings like stockpiles and activity zones at the moment.
2012-04-29 21:07:39 +04:00
Alexander Gavrilov 82a0e52a3e Add api to check the walkable cache, and update flow_forbid in liquids. 2012-04-26 18:51:39 +04:00
Alexander Gavrilov 16ee049664 Split off the burrows api from Maps and Units. 2012-04-26 12:56:28 +04:00
Alexander Gavrilov 6ab270d129 Retrieve unit noble position info, and use it in getProfessionName. 2012-04-26 12:03:56 +04:00
Alexander Gavrilov 9489c6ed1a Add support for a few more viewscreens to Units::getSelectedUnit. 2012-04-26 11:05:35 +04:00
Alexander Gavrilov 1cd802d426 Implement unit sorting for the pen zone assignment interface. 2012-04-25 18:28:00 +04:00
Alexander Gavrilov 763a301b4f Add a few more lua api functions, documentation, and unit sort orders.
Units::getProfessionName appears to work correctly for
everything except nobles.
2012-04-23 21:30:53 +04:00
Caldfir 035d65536b Added in job loading to t_unit for stonesense. 2012-04-22 18:51:27 -07:00
Alexander Gavrilov 125cd6622a Support sorting units in many more ui contexts. 2012-04-22 19:22:00 +04:00
Alexander Gavrilov 2ef321a208 Preserve the original lua global environment for modules.
The intent is to prevent accidental pollution of module namespaces
by globals defined from careless scripts running in the _G environment.
2012-04-21 20:15:57 +04:00
Alexander Gavrilov 4af051bab3 Add a few more unit orderings, and a way to reverse direction. 2012-04-21 16:53:17 +04:00
Alexander Gavrilov 3282ac3db2 Add a hotkey command that sorts units in lists using lua comparators. 2012-04-21 15:43:52 +04:00
Alexander Gavrilov adbd351462 Rename units.other[0] to units.active. 2012-04-21 12:46:55 +04:00
Alexander Gavrilov 0a6982f404 Enable warnings correctly on linux and fix a lot of them. 2012-04-20 13:30:37 +04:00
Alexander Gavrilov d95cc3435f Fix lua wrapper sizeof for static arrays.
Since it actually depends on the element type, it is more tricky.
2012-04-20 13:04:03 +04:00
Alexander Gavrilov 0b32d374db Implement SOIL/STONE substitution logic, and add compat in mapexport. 2012-04-19 23:02:30 +04:00
Alexander Gavrilov 4b87f1bcac Refactor MapCache: make it parse everything that is known re tiles & mats. 2012-04-19 19:17:07 +04:00
Alexander Gavrilov f655a0986d Sync to changes in the data structure definitions. 2012-04-19 11:03:29 +04:00
Petr Mrázek d825356878 Fix windows console bug
Line input cursor was going crazy when input reached right side of the screen
2012-04-17 23:23:45 +02:00
Petr Mrázek c031349a62 Track structures 2012-04-17 21:48:18 +02:00
Alexander Gavrilov 378a1fb914 Support the '#' string as index for wrapper vector insert at end. 2012-04-17 12:15:45 +04:00
Alexander Gavrilov 3beb2ebf25 Export the onStateChange event to core lua context & add some docs. 2012-04-17 11:45:09 +04:00
Petr Mrázek 7946cafc86 Merge https://github.com/jaxad0127/dfhack 2012-04-16 22:37:07 +02:00
Warmist 17d5b2de04 Multiline interpreter.
To test try writing for k,v in pairs(table) do <enter> print(k) <enter> end
Also prompt could be changed (couldn't think of anything better).
2012-04-16 18:46:20 +03:00
Alexander Gavrilov 1e64a6a2f6 Make dfhack.lineedit automatically interact with RunCoreQueryLoop.
It still falls back to the original waiting mode if yield fails.
2012-04-16 18:05:42 +04:00
Alexander Gavrilov 9c25351281 Add a template to make using lua_pcallk a bit more convenient. 2012-04-16 18:01:21 +04:00
Alexander Gavrilov 3e4863bc80 Integrate coroutines with table-based error handling.
Properly attach stack traces to errors passing the resume boundary.
Replaces coroutine.resume and coroutine.wrap with appropriately
modified versions, and adds a Lua::SafeResume function for C++.
2012-04-16 14:45:04 +04:00
Alexander Gavrilov 48e4717dd2 Try working around some msvc problems. 2012-04-16 10:59:55 +04:00
Alexander Gavrilov a1756a864c Implement a way to do prompts from core context.
The trick obviously is doing it without forcing DF to wait suspended.
Fortunately, lua has built-in coroutine support, so the interactive
prompt can simply yield and rely on the external loop to do the job.
To use this however the REPL had to be replaced with lua code.
2012-04-15 21:50:22 +04:00
Alexander Gavrilov 14709e5d45 Add an official core lua context, and allow plugins to send events to it.
- This context requires core suspend lock and asserts it in a few places.
- Special 'event' objects are introduced. They can be invoked as
  functions, in which case they iterate all their fields and call
  them as functions. Errors are printed and consumed.
- When a plugin is opened by the core context, events registered in
  a special array are linked to it. The system is organized so as to
  avoid even trying to pass the event to lua if the module isn't loaded.
2012-04-15 19:09:25 +04:00
Jared Adams f3c7a685f5 Make tiletypes more useful
* Paint, filter, and brush state is now saved between calls.
 * Added 'all' paint option to set material, shape, special, and variant at
      the same time.
 * Added tiletypes-here (like liquids here, except is uses the saved brush
      settings)
 * Added tiletypes-here-point (like liquids here, always only the tile under
      the cursor)
 * Added tiletypes-command: runs tiletypes commands seperated by ';' tokens
      (affects saved state)
 * Make the internal workings match liquids a bit more
 * Give brush objects a descriptor string
 * Make Core::cheap_tokenise available
2012-04-15 08:40:19 -06:00
Alexander Gavrilov cb27a1d839 Fix typo in the 1MB constant. 2012-04-15 11:31:05 +04:00
Petr Mrázek fc38371b29 Clean up some chaos in old code. 2012-04-15 01:15:15 +02:00
Petr Mrázek 5f1c933b0f Merge pull request #148 from wjrogers/feature-protobuf-api
Add SetUnitLabors and additional optional data to ListUnits
2012-04-14 14:56:19 -07:00
Petr Mrázek fa063e2936 Track structures, fix trivial problem in zone plugin 2012-04-15 00:35:59 +02:00
Alexander Gavrilov cb49c92b99 Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
  checks the loaded state and locks a mutex in Plugin. If the plugin
  is unloaded, calling its functions throws a lua error. Therefore,
  plugins may not create closures or export yieldable functions.

- The set of function argument and return types supported by
  LuaWrapper is severely limited when compared to being compiled
  inside the main library.
  Currently supported types: numbers, bool, std::string, df::foo,
  df::foo*, std::vector<bool>, std::vector<df::foo*>.

- To facilitate postponing initialization until after all plugins
  have been loaded, the core sends a SC_CORE_INITIALIZED event.

- As an example, the burrows plugin now exports its functions.
2012-04-14 19:44:07 +04:00
Alexander Gavrilov 7a34a89f53 Add burrow subcommands to modify burrow unit and tile sets. 2012-04-14 14:12:59 +04:00
Alexander Gavrilov 2f54a48e63 Add a plugin that makes selected burrows auto-grow on digging. 2012-04-13 21:41:42 +04:00
Alexander Gavrilov 37cfb1fdcd Add unit position and container api. 2012-04-13 16:10:19 +04:00
Alexander Gavrilov 2d8611a480 Add core api for moving items between ground and containers. 2012-04-12 18:37:27 +04:00
Alexander Gavrilov 38a8c43a25 Reverse-rebase the vtable pointers printed to stderr.log. 2012-04-12 11:21:25 +04:00
Alexander Gavrilov 583ccdcc0c Support pre-initializing vtable pointers from symbols.xml 2012-04-12 10:54:53 +04:00
Alexander Gavrilov 5d5502ae34 Update the item owner modification api and export it to lua. 2012-04-11 20:10:31 +04:00
Alexander Gavrilov 0c2b78b96b Add api for manipulating burrows to the core. 2012-04-11 19:42:05 +04:00
Alexander Gavrilov 61245711f7 Export a few maps functions to lua. 2012-04-11 16:20:16 +04:00
Alexander Gavrilov c7b922250b More maps api refactoring and renaming.
getBlockAbs is a very confusing name; getTileBlock is better.
2012-04-11 12:01:27 +04:00
Will Rogers 8c40a27ea0 Add unit_misc_trait list to BasicUnitInfo protobuf API. 2012-04-10 20:42:23 -04:00
Will Rogers 6cf8220f28 Add SetUnitLabors protobuf API. 2012-04-10 20:41:54 -04:00
Alexander Gavrilov 59ddbfacb7 Implement item occupancy tracking in MapCache. 2012-04-10 20:19:41 +04:00
Alexander Gavrilov b15d2da819 Get rid of some obsolete api functions, and restructure MapCache. 2012-04-10 18:21:19 +04:00
Alexander Gavrilov 249be0c1a0 Change SC_MAP_LOADED handling: only NULL/not NULL change is meaningful. 2012-04-10 12:11:00 +04:00
Alexander Gavrilov 93c795cfc3 Job module api tweaks: add a namespace to match others and some funcs. 2012-04-10 11:43:36 +04:00
Alexander Gavrilov 0e0740fddf Stop printall(df.global) from breaking if there are unknown addresses. 2012-04-10 10:34:03 +04:00
Petr Mrázek 585de77489 Track structures 2012-04-09 00:59:57 +02:00
Alexander Gavrilov 45ae2ed67f Pull a few utility functions into the core and publish to lua. 2012-04-07 19:08:30 +04:00
Alexander Gavrilov e74788cb26 Add a generic facility for object finalization during stack unwind.
Supports two modes of finalization:

- try {...} finally {...}
- try {...} catch { ...; throw }

Argument passing discipline is designed with vararg tail calls in mind.
2012-04-07 14:21:38 +04:00
Alexander Gavrilov 0daafef690 Wrap MaterialInfo for lua. 2012-04-06 19:56:19 +04:00
Alexander Gavrilov 2640addf49 Split LuaTools.cpp to separate core utils from general dfhack api. 2012-04-06 18:00:54 +04:00
Alexander Gavrilov 903e9ee716 Export a few more functions to lua. 2012-04-06 11:21:28 +04:00
Alexander Gavrilov 9eed9f0d24 Wrap a few utility functions defined on the c++ side for lua. 2012-04-05 19:55:59 +04:00
Alexander Gavrilov 28a741082f Encode & decode names in utf-8 for transfer in remote messages.
That's the encoding required by the protobuf spec.
2012-04-05 18:10:16 +04:00
Alexander Gavrilov 59f411e401 Oops, forgot return statement. 2012-04-05 12:32:10 +04:00
Alexander Gavrilov 3afed43cdb Experimental: try wrapping a dfhack api function. 2012-04-05 11:59:39 +04:00
Alexander Gavrilov d1b27418a6 Add a World::GetPersistentData version that auto-adds if not found. 2012-04-05 11:32:23 +04:00