Commit Graph

603 Commits (1dd4cc56670819e72d05c306d4f97d9b5a15cd3b)

Author SHA1 Message Date
Timothy Collett 1dd4cc5667 More work on getting dfhack building & compiling on Mac OS X 2012-05-25 14:28:59 -04:00
Timothy Collett 44c3afc306 Merge git://github.com/quietust/dfhack
Gotta get the changes that prevent DFHack from crashing.
2012-05-24 15:39:11 -04:00
Timothy Collett 24d221052b Initial changes to get dfhack building on the Mac 2012-05-24 11:31:20 -04:00
Quietust 9a73ea9f14 Cleanup World module to use df::global, and fix crashes when control_mode/game_mode are missing 2012-05-23 12:51:03 -05:00
Alexander Gavrilov b992b04f0b Remove stuff that shouldn't be in the core, and expose to lua what's left.
Specifically, any "if (verbose) { Core::printerr("blah") }" kind
of stuff definitely doesn't belong in the common API functions.
Also, ref->getUnit() is very expensive.

On the other hand, checks for crash-inducing conflicts with the
ui should be in the core api, and not in client plugins.
2012-05-20 21:57:45 +04:00
Alexander Gavrilov d28d240dbd Merge remote-tracking branch 'kmartin/master' 2012-05-20 11:03:41 +04:00
Alexander Gavrilov 1b4a24c827 Support using focus strings to limit keybinding scope. 2012-05-19 21:31:42 +04:00
Petr Mrázek 51f06c78fc Merge https://github.com/playfordh/dfhack
Conflicts:
	library/include/modules/Items.h
	library/modules/Items.cpp
2012-05-19 19:09:13 +02:00
Alexander Gavrilov 7774f5f2c1 Add a mechanism converting ui focus to a string representation.
The idea is to make ui handling more modular, dispensing with
huge functions that switch or if/else on lots of variables.
For now, used to split up functions in the sort plugin.
2012-05-19 19:50:36 +04:00
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
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
Alexander Gavrilov e9ef9b87b5 Add central locations for onUpdate and onStateChange handling in core. 2012-05-17 20:04:09 +04:00
harlanplayford 27ca317871 Added new method - Items::moveToInventory(...)
Signed-off-by: playfordh <harlanplayford@gmail.com>
2012-05-15 06:01:59 -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 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 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 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
Alexander Gavrilov 125cd6622a Support sorting units in many more ui contexts. 2012-04-22 19:22:00 +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 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
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
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
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