Commit Graph

497 Commits (528d7b1be146f04d6f2c414e6b932967e3a73e76)

Author SHA1 Message Date
Quietust aa1bc3fe52 Cleanup Kitchen module (and the seedwatch plugin which uses it) 2022-03-12 12:04:34 -08:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 2022-03-12 11:33:27 -08:00
Josh Cooper fb51e2d8b5 Adds comments to members of EventHandler 2022-03-12 11:33:27 -08:00
Josh Cooper 24255d3195 Adds event type JOB_STARTED 2022-03-12 11:33:27 -08:00
Josh Cooper f5ced46608 Refactors EventManager
- handler freq now works on an individual handler basis (set to 0 to fire as frequently as possible)
- tick events no longer need to be re-registered after every eventful tick
2022-03-12 11:33:27 -08:00
myk002 5b960b97bc
fix comment for Maps::getSize(); add getTileSize() 2021-07-30 13:09:12 -07:00
Ryan Williams c5fb28a13c
Rename getPlantAtCoords to getPlantAtTile 2021-06-23 23:00:30 -07:00
Ryan Williams d81de5e4c7
Add getPlantAtCoords function to Maps namespace
Derived from disassembly of DF code. Returns a pointer to plant struct that owns the tile at position. Useful for finding a tree from one of its branches. Lua API support.
2021-06-22 20:01:10 -07:00
myk002 fc860478e4
move fastdwarf's teleport code to Units module
and expose in Lua API
2021-06-06 08:48:32 -07:00
myk002 aff5c9bf35
add getCursorCoords overload for df::coord
and factor out active cursor detection
2021-05-15 12:05:00 -07:00
lethosor 59b023c71d
Ensure that command-prompt is dismissed after a command creates a new screen
Fixes #1803

Running a command that created a new screen would previously result in a screen
order that looked like this, due to how `Screen::Hide` works:

- DF screen
  - `command-prompt` screen (dismissed)
    - New screen

The `command-prompt` screen remained on the stack until the new screen was
dismissed, so it would intercept viewscreen vmethod calls intended for the
DF screen.

This change adds a new behavior to `Screen::Hide` that results in this screen
order after running a command:

- DF screen
  - New screen
    - `command-prompt` screen (dismissed) - DF removes this screen immediately
2021-03-21 20:42:50 -04:00
myk002 6819ee9928
make alchemist flag valid for controllable civs 2021-02-05 16:45:39 -08:00
myk002 3ba984c22c
only reset extents if they are unusable
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.

this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
2020-12-16 11:10:47 -08:00
lethosor 8cb38ecf5b
Merge remote-tracking branch 'myk002/myk_metalhead_mario' into develop 2020-11-13 14:04:30 -05:00
myk002 10616a387f
cleaner mask-based implementation 2020-11-12 22:44:38 -08:00
myk002 02a86d761a
identify bars as non_economic items
allows Job::isSuitableMaterial() to match metal bars as a building
material
2020-11-12 19:10:06 -08:00
lethosor 913d860ae4
Use initial working directory as process path on Linux, and expose to Lua 2020-11-12 19:07:51 -05:00
lethosor 23b230495e
Merge branch 'develop' into cwd-handling 2020-11-12 18:44:05 -05:00
lethosor ce7772a1c2
Add Filesystem::restorecwd()
This allows restoring the working directory to its original value, which may not actually be the DF root. See #1671, dfhack/scripts#152
2020-10-14 21:22:53 -04:00
Myk Taylor 4d7f4d80ad prep buildingplan for core algorithm changes
player-visible changes
- removed text that showed up if you used the wrong hotkeys. no other
  dfhack screen does this, and it seems unneeded. can add back if others
  think otherwise, though

internal changes
- changed signature of lua-exported isPlannableBuilding to take subtype
  and custom type in addition to building type. this is only used by
  quickfort, and it already sends all three params in preparation for
  this change
- added lua-exported scheduleCycle(), which is like doCycle(), but only
  takes effect on the next non-paused frame. this lets quickfort
  run only one buildingplan cycle regardless of how many #build
  blueprints were run
- declared a few dfhack library methods and params const so buildingplan
  could call them from const methods
- converted buildingplan internal debug logging fn to have a printf api
- reshaped buildingplan-planner API and refactored implementation in
  preparation for upcoming core algorithm changes for supporing all
  building types (no externally-visible functionality changes)
  - changed df::building_type params to type, subtype, custom tuple keys
  - introduced capability to return multiple filters per building type
    (though the current buildings all only have one filter per)
- split monolith hook functions in buildingplan.cpp into one per scope.
  this significantly cleans up the code and preps the hooks to handle
  iterating through multiple item filters.
- got rid of send_key function and replaced with better reporting of
  whether keys have been handled
2020-10-04 20:05:08 -07:00
Myk Taylor e546d3eec3 rename is_civzone to the more general allow_wall 2020-08-15 20:13:48 -07:00
Myk Taylor ae872e812f properly detect valid tiles for civzones 2020-08-15 17:24:12 -07:00
lethosor 8c5b21b7ee
Fix a couple warnings in the Units module (#1615) 2020-08-08 14:35:12 -04:00
Ryan Bennitt 9510dd52e1 Add Goal to Manipulator Detail Modes 2020-08-04 23:01:28 +01:00
Myk Taylor e17d492203 address PR review comments on api docs 2020-07-23 21:55:05 -07:00
Myk Taylor 16cfd34678 recurs-ify default config copying logic
I refactored Filesystem::listdir_recursive to support removing the path
prefix from the returned files list. There are no current calls that
make use of the prefix parameter, so I converted it into a boolean.
Current usages will use the new default parameter and will not see any
changed behavior.
2020-07-18 22:22:37 -07:00
Myk Taylor c19fc1f349 gcc-4.8 compatibility 2020-07-15 21:35:21 -07:00
lethosor 7c1d1c43e5 Merge remote-tracking branch 'PatrikLundell/stocks' into develop
Conflicts:
	docs/changelog.txt
2020-04-25 21:12:27 -04:00
Ben Lubar ffb3c29cfc
simplify Graphic module. update structures.
it appears that all this added complexity including an extra pointer dereference was to avoid including the vector header.
2020-03-08 00:12:48 -06:00
PatrikLundell 121497a466 Propagated getBookTitle to Lua 2020-01-26 11:47:47 +01:00
PatrikLundell 876ac6c056 Renamed to getBookTitle, cut down on virtual_cast 2020-01-25 21:46:10 +01:00
PatrikLundell c6bbf39c6c Issue #1262. Added Items::getTitle and used in stocks 2020-01-25 12:43:02 +01:00
lethosor 5eca50476e Merge remote-tracking branch 'nornagon/unit-description' into develop 2020-01-13 23:31:23 -05:00
Jeremy Apthorp 50e696acf6 getDescription => getPhysicalDescription 2019-12-14 09:36:47 -08:00
Jeremy Apthorp 910f965838 wip 2019-12-07 22:17:59 -08:00
lethosor f3658db85f Merge branch 'develop' into avoid_rebuilding_df_statics_if_core_h_changes 2019-10-03 23:23:36 -04:00
lethosor 07575095fd Merge branch 'develop' into persist 2019-08-22 22:00:50 -04:00
Pauli f0632347d0 Remove Core.h include from DataDefs.h
Core.h isn't required for DataDefs.h which removes Core.h dependency
from DataStatics*.
2018-12-30 17:08:42 -05:00
Ben Lubar a672ffcb95
Use viewscreen_savegamest instead of viewscreen_optionst 2018-08-26 19:05:44 -05:00
Ben Lubar 4e690df96a
Add Persistence module.
Alter World to use Persistence instead of storing data in historical figures.

Fake historical figures will be converted to the new format when a world is loaded.

Added plugin_save and plugin_load functions to the plugin API.

Made the weird int7/int28 code that was in the old persistence API slightly safer.
2018-08-26 18:27:58 -05:00
Kelly Kinkade 59d70d6687 Add function to infer biome type to Maps module
This moves code intended to infer biome type currently living in a
couple of plugins into the Maps module, so that this code can be shared
more easily by multiple plugins, as discussed in #1392.
2018-08-15 20:28:18 -05:00
Ben Lubar 4837e65322
Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen. 2018-07-22 17:31:39 -05:00
lethosor 9ee368d456 Merge remote-tracking branch 'suokko/MapCache_reduce_latency_from_designation_to_jobs' into develop 2018-07-11 11:51:24 -04:00
lethosor 2dac3c53c7 Add stress cutoffs to Units module, fix dwarfmonitor/manipulator
Fixes #1292
2018-07-09 15:59:12 -04:00
lethosor 037e7e4901 Merge remote-tracking branch 'suokko/spotclean_ui_state_fix_1194' into develop
Moved/adjusted changelog entry
2018-07-07 18:08:53 -04:00
lethosor 616675f0ce Merge remote-tracking branch 'suokko/kittens_data_race_fix' into develop 2018-07-03 00:30:36 -04:00
lethosor 81a7ddcf92 Merge remote-tracking branch 'suokko/screen_show_memory_leak' into develop 2018-07-02 22:58:11 -04:00
Pauli 0727403ac1 Fix devel plugins linking in linux 2018-06-30 21:12:42 +03:00
Pauli c39a882b57 Add missing Unit::isDiplomat
Fixes #1324
2018-06-29 16:19:18 +03:00
Pauli 123de7fdf7 Use constexpr to prevent attempts of linking static variable 2018-06-24 17:06:32 +03:00
Pauli 9b6781f0f2 Temporary lower command-prompt when executing the command
command-prompt viewscreen may affect command execution if they are
looking for UI state. To make commands execute simillary to hotkeys or
console commands the viewscreen needs to removed from the top position.

Fixes #1194
2018-06-20 21:51:45 +03:00
Pauli 9c59b7ff48 Fix unlikely memory leaks if Screen::show fails
The Screen::show takes ownership of the screen pointer. I decided to
switch the parameter to std::unique_ptr to make the pointer ownership
explicit. The unique_ptr then provides automatic screen destruction in
Screen::show unless pointer is inserted or is already in the linked list
that is managed by df.
2018-06-19 16:41:31 +03:00
Pauli 1b5ec7ce69 Update jobs when committing MapCache changes
The map_block->designation.{dig,smooth} are reset to zeros when a job
posting is created for the designation. The job is then used to override
the designation state in the map_block. To make the new designation set
propogate to jobs the job structure would require updating. The update
would be possible a complex operation. The simple alternative is to
remove the job and let df create a new job in the next tick.

Fixes #1229
2018-06-18 16:34:09 +03:00
Pauli 6a151353e3 Use automatic return type for index_tile 2018-06-18 16:23:57 +03:00
lethosor 10e6016989 Merge branch 'units_dead' into develop
Closes #1297
2018-06-13 15:38:35 -04:00
PatrikLundell f329774059 dead & killed flag separation
squashed 4 commits from #1297
2018-06-13 15:37:45 -04:00
lethosor 03968db344 Fix GCC warnings in 'tweak kitchen-prefs-all' and dev plugins 2018-06-01 10:02:38 -04:00
lethosor 7a04fefb0b Remove Vermin module (unused and obsolete) 2018-06-01 00:22:10 -04:00
lethosor 17ba492992 Add some exclusion functions to Kitchen module, expose to Lua, fix build 2018-05-17 19:34:03 -04:00
lethosor 97a79893e7 Change Kitchen.{h,cpp} to title case 2018-05-17 11:08:13 -04:00
lethosor e9ec08f419 Add Buildings::getRoomDescription(), moved from search plugin, +cleanup 2018-05-12 17:00:21 -04:00
lethosor c15571caa0 Move isRouteVehicle, isSquadEquipment from workflow to Items module 2018-05-12 14:49:30 -04:00
lethosor a34b34d3cb Move a few item functions from autotrade/stocks into DFHack::Items 2018-05-12 12:04:46 -04:00
lethosor 2a52582c1f Add Gui::inRenameBuilding 2018-05-09 10:23:05 -04:00
lethosor 1ba5477b63 Add designation priority support to MapCache and dig plugin
Fixes #481
2018-01-21 19:27:16 -05:00
lethosor 10e13c532a Add "tweak cage-butcher" and some extra Building module functions
* Buildings::markedForRemoval()
* Buildings::getCageOccupants()

Closes #906
2017-06-25 15:27:21 -04:00
lethosor ae809afde7 Add Gui::refreshSidebar()
This handles feeding CURSOR_DOWN_Z and CURSOR_UP_Z properly, avoiding issues
when on the lowest z-level.
2017-06-23 00:02:21 -04:00
lethosor 27343e3253 Add unit and tile visibility functions 2017-06-10 21:54:08 -04:00
lethosor 778ffb0971 More Units module cleanup, modernize getUnitsInBox 2017-06-10 21:02:30 -04:00
lethosor 1321a64613 Remove lots of old/unused functions from the Units module 2017-06-10 17:21:34 -04:00
lethosor 43c4a88068 Move some checks in paintTile/readTile after hooks are called 2017-06-02 00:40:14 -04:00
lethosor 05f322ca30 Merge remote-tracking branch 'lethosor/lua-dmdims' into develop 2017-06-01 23:34:35 -04:00
lethosor 939aff3231 readTile(): add hook support and map parameter 2017-05-31 12:12:15 -04:00
lethosor 55931703ac Designate the correct tile for trees with multi-tile trunks
DF always designates the southeast trunk tile, while plant.pos is the center,
which is sometimes inaccessible (see #1014)
2017-05-05 21:25:25 -04:00
lethosor d3c496cc2b Add getSelectedPlant() and related functions
Currently only works with the center tile of multi-tile trees
2017-05-05 14:45:46 -04:00
lethosor 1e469453fc Add Designations module, currently supporting plant/tree designations
This makes it easier for tools to properly handle designating and undesignating
trees for chopping and plants for gathering, which changed significantly in
0.40.20.

Ref #531 (?), #656, #1014, #1018, #1030, #1076
2017-05-04 21:47:12 -04:00
lethosor 71b553b305 Add a few functions to retrieve unit social activities 2017-04-28 17:25:58 -04:00
David Corbett acdb369aa8 Avoid non-trivial bitfield constructors 2016-12-09 13:41:14 -05:00
lethosor 8521b830b2 Merge remote-tracking branch 'CannibalVox/job_remove' into develop 2016-12-05 15:24:37 -05:00
Stephen Baynham 595f3857b6 Reverse the param order of these two methods
The current way doesn't match other Job module methods
2016-12-01 20:13:49 -08:00
Stephen Baynham 7920f71517 Bad formatting 2016-11-25 00:25:18 -08:00
Stephen Baynham e490afdf00 Rebuilt slightly to offer bool return val
We fail on unknown general ref types now, without modifying the job at
all yet
2016-11-24 22:36:11 -08:00
Stephen Baynham 74f5df99db Add job remove method
Job remove eliminates a job's worker & holder references, if any, puts
the worker on cd, if appropriate, removes the job's postings, eliminates
the job from the global linked list, and then finally deletes it.  This
code was tested by incorporating it into autochop and it does make the
plugin work.  However, chop jobs don't have holder building references,
and anyway, with DF being 90% edge case by volume, this could use a heck
of a lot more testing.

I saw elsewhere code that prevented worker removal if the job was a
special job, and that made me feel funny so I made the job remove method
not work if the job is a special job.
2016-11-17 19:54:41 -08:00
lethosor 8a138fcc4c Avoid polluting global namespace in MapCache.h 2016-10-15 14:53:10 -04:00
lethosor 70d3c07cdb Initial lua getDwarfmodeViewDims rewrite 2016-10-07 23:51:58 -04:00
lethosor e965f5318f Replace many includes with forward declarations in modules/Maps.h 2016-08-13 21:44:01 -04:00
lethosor 79377669a1 Merge remote-tracking branch 'NCommander/dwarfvet' into develop 2016-07-29 16:25:53 -04:00
lethosor 2455e36510 Initial 64-bit support 2016-07-03 23:32:43 -04:00
Michael Casadevall e45fbfc61d Modified dwaftvet plugin to work with latest DFHack
Initial commit of the dwarfvet plugin

Signed-off-by: Michael Casadevall <mcasadevall@ubuntu.com>
2016-06-08 04:14:59 -04:00
lethosor 52728babd4 Merge branch 'develop' into zone-unassign 2016-04-22 18:41:15 -04:00
lethosor b97d33ca28 moveToBuilding improvements
- Don't set in_building by default when use_mode is 0 (consistent with most vanilla DF items)
- make use_mode optional and default to 0 (including in Lua API)

Resolves #885
2016-04-05 11:43:02 -04:00
lethosor 25507a10f9 Add Units::getKillCount() and expose it to Lua 2016-02-25 15:21:14 -05:00
sv-esk 83c70ccb0f forbid manipulator editing non-citizens 2016-02-11 13:31:52 +02:00
James Gilles 0a670bb0db Implement #804, move some functions to Units, colorize zone output, a
little cleanup
2016-02-01 11:12:06 -05:00
lethosor d0c28d3f50 Prevent plugins with active viewscreens from being unloaded
This requires plugins to pass plugin_self to Screen::show(), but
avoids the need to implement special checks in plugin_onstatechange
for the SC_BEGIN_UNLOAD event.
2016-01-01 11:15:29 -05:00
lethosor 2a2ab00ca9 Add "map" parameter to a lot of drawing functions
Ref #746
2015-12-22 11:42:51 -05:00
lethosor 5a1e5e1464 Expose Units::casteFlagSet() 2015-12-19 11:07:35 -05:00
lethosor 2aeac718cc workflow: Account for job postings correctly and fix existing issues
Without removing postings correctly, it was possible to end up with
multiple workers assigned to a job that workflow had suspended
multiple times, which caused crashes if more than one worker was
assigned to the same job by DF.

This adds an additional command, fix-job-postings, that runs
automatically when loading a world and fixes:
- Multiple job postings that point to the same job
- Job postings that point to a job where posting_index == -1
  (i.e. jobs that should have no posting assigned)

Fixes #741
2015-11-25 20:33:13 -05:00
lethosor 610170b0b0 Add hooks for getDwarfmodeViewDims and getDepthAt (new) 2015-11-15 11:54:34 -05:00
lethosor fcfffd1cb6 Track state of gui hooks
Also fix a bug in drawborder() and expand color-dfhack-text to test
multiple hooks
2015-11-15 11:54:34 -05:00
lethosor fff9072b07 Add initial support for hooking into Gui-related functions 2015-11-15 11:54:34 -05:00
DoctorVanGogh e9be1aa657 Fix for construction over existing construction & on top of walls
Fix to allow constructions on top of (natural) down stairs
2015-11-06 19:00:43 +01:00
lethosor ac71fa8070 Add isValidLabor() to Units module
Closes #711 and could avoid potential issues when editing units from
other civs with manipulator.
2015-10-30 18:41:09 -04:00
lethosor 8de710f1c1 Add Renderer module - safer way to install custom renderers 2015-10-21 17:18:39 -04:00
lethosor 3f5c002634 Pass virtual_identity by reference 2015-10-03 09:27:24 -04:00
lethosor d343dfd8a0 Add a function to find viewscreens (or parents) of a given type
This makes it possible for some plugins to detect the game state more
reliably - for example, prospector would previously fail when
embarking if the viewscreen_choose_start_sitest instance had any
children.
2015-10-02 21:50:55 -04:00
lethosor 36fde3d7e3 Allow Lua screens to allow OPTIONS to work 2015-06-05 18:45:52 -04:00
lethosor bbb41078e7 Expose PenArray dimensions and tiles to Lua 2015-03-28 18:35:07 -04:00
lethosor e2b6ae9beb Allocate Lua PenArray objects using an existing buffer 2015-03-28 11:27:47 -04:00
lethosor 99f4ea4d2b Implement a PenArray class for caching parts of rendered screens 2015-03-27 22:56:30 -04:00
lethosor afca7419dc Add gametype checks to World.cpp 2015-03-09 20:08:21 -04:00
lethosor 10cfef0553 Fix whitespace issues 2015-02-14 22:53:06 -05:00
expwnent e9b4fc513a Merge remote-tracking branch 'cdombroski/zone-plugin-cleanup' into temp
Conflicts:
	NEWS
	plugins/zone.cpp
2015-01-31 21:01:41 -05:00
lethosor 066adfdf95 Implement a function to list directories recursively 2015-01-30 17:29:17 -05:00
Chris Dombroski f608235b1e Fix some Lua things 2015-01-29 19:56:50 -05:00
Chris Dombroski f2eec3198c Rename findPenPitAtCoord 2015-01-29 15:02:54 -05:00
Chris Dombroski 86495270a6 Remove duplicate isMilkable definition. 2015-01-29 14:40:09 -05:00
Chris Dombroski 48b6cf1beb Export functions to Buildings.h 2015-01-29 13:57:50 -05:00
lethosor daf739fcec Remove FIFO support 2015-01-28 21:39:17 -05:00
Chris Dombroski c179f5b913 Extract some stuff from zone.cpp to plugins/Units.{h,cpp} 2015-01-28 21:28:32 -05:00
lethosor f98e2964e6 Fix a few Windows compilation errors 2015-01-28 20:05:24 -05:00
lethosor bebceffa5f Add Filesystem::listdir() 2015-01-28 19:15:58 -05:00
lethosor e8c0482fdc Add atime()/ctime()/mtime() 2015-01-28 18:18:06 -05:00
lethosor 2e3261565c Clean up Filesystem.h 2015-01-28 17:15:09 -05:00
Casey Link 7072252902 fix build error on windows
with certain #include permutations the lack of this define would
break the build on windows as windows.h pollutes the namespace with min
and max macros that conflict with std::min and std::max.
2014-12-05 12:35:24 +01:00
lethosor 445640f80c Allow commands invoked through command-prompt to access selected items/units/buildings
Fixes #273
2014-11-25 20:25:31 -05:00
expwnent 779ac3fd50 Updated interaction-trigger to work better. 2014-11-09 18:36:21 -05:00
Eric Wald 8631da7e4e Convenience method to collect a vector from StockpileIterator. 2014-09-07 14:10:27 -06:00
Eric Wald 567397df85 Stockpile iterator.
Efficient way to operate on all items stored on a stockpile.
Doesn't currently check whether the items match the stockpile settings,
but does ignore empty containers assigned to the stockpile.
2014-09-07 13:52:07 -06:00
Quietust deee486b81 Update Maps::SortBlockEvents to include spoors and item spatters 2014-08-20 10:51:58 -05:00
Alexander Gavrilov 2471c4a68e Add a new API for converting between interface_key and string characters.
It's necessary now that the simple linear arrangement is broken.
2014-08-11 14:23:19 +04:00
Quietust 1450298484 assumed_identity -> identity 2014-07-29 16:30:22 -05:00
JapaMala b598cbb0dd Merge branch 'develop' of github.com:DFHack/dfhack into develop 2014-07-20 16:43:00 +05:30
JapaMala a14caa53d0 Fixed mapcache reading plants in for 0.40.01 onwards. 2014-07-20 16:41:20 +05:30
expwnent 2fb8faf3e6 Added Items::createItem function. 2014-07-03 10:39:20 -04:00
expwnent 81c87d0921 EventManager: INTERACTION event for unit interactions. 2014-07-03 04:55:12 -04:00
expwnent 4ac32cfd74 EventManager: made UNIT_ATTACK trigger for severed body parts. 2014-07-01 08:58:48 -04:00
expwnent 961d033ade EventManager: unload event for convenience. 2014-06-29 10:03:55 -04:00
expwnent 8e7e87ac73 Added UNIT_ATTACK event to EventManager and exposed it to Lua. 2014-06-28 02:31:34 -04:00
expwnent 7313c18a2a EventManager/eventful: added ON_REPORT event and exposed it to Lua. 2014-06-23 09:15:46 -04:00
expwnent 036aae060b Merge lethosor stuff. For some reason, git's auto merge message didn't happen because of git-stash shenanigans. Oh well. 2014-06-19 22:58:17 -04:00
lethosor ef69522d93 Merge branch 'develop' into filesystem-module-pr 2014-06-18 15:45:42 -04:00
lethosor 6fa478de22 Filesystem module
Implements a handful of filesystem-related functions (e.g. chdir, mkdir)
in C++ and Lua.
2014-06-15 22:38:17 -04:00
Pierre-David Bélanger bdcc00f6f7 Util method (in the Units class) to get a unit squad name (the translated name, or alias if set) 2014-06-09 21:51:52 -04:00
Quietust 0f4684f29d Add Items::getItemBaseValue and Items::getValue, available from Lua 2014-04-25 11:04:21 -05:00
Quietust c3d45c3a1e Add Job::getName(job *), also available from Lua 2014-04-23 08:03:10 -05:00
Alexander Gavrilov c27c38e4c0 Remove tired or hungry siege operators from duty when at peace.
The threshold is set at the level when they start to blink - normally
they would continue on with the job until they get a thirsty/hungry
thought, but immediately run off to eat if they lose the job (thus
refusing to load the engine after firing it). The code checks for
active sieges and whether there is a free replacement unit.
2014-04-15 21:52:39 +04:00
Alexander Gavrilov fc9826389b Account for meandering movement when predicting unit path in siege engine.
The movement is random, but there is an average slowdown coefficient.
2014-04-15 19:50:23 +04:00
Alexander Gavrilov 7844907204 Add new API functions for creating announcements and combat reports.
Allow specifying the announcement flags directly, and adding unit
combat reports. Also, make announcement functions write the message
to the game log.
2014-04-15 19:50:23 +04:00
Quietust e620ae765c Add missing import/export info for MersenneRNG::unitvector<> 2014-03-25 13:30:21 -05:00
expwnent 329741f235 EventManager: added EQUIPMENT_CHANGE event and exposed it to lua. 2013-10-24 19:32:52 -04:00
expwnent c409289ee4 EventManager: TICK events should unregister correctly when requested and after they fire, other tweaks.
- fixed unregister to allow unregistering individual TICK events
 - make registerTick return the resulting freq you have to put back in to the handler in order for it to be unregisterable
- when TICK events fire, they now automatically remove themselves from handlers[TICK], as they should
- make sure manageTickEvent fires once per tick
2013-10-20 22:54:25 -04:00
expwnent 6ef360f4d6 Merge remote-tracking branch 'warmist/dev-EventManager-lua' into 0.34.11-r4 2013-10-20 14:52:40 -04:00
Warmist 0dff26aa23 Added lua interface (in eventful) for EventManager module. 2013-10-20 21:44:07 +03:00
expwnent 39553cfb6d EventManager: fixed a problem with constructionHandler. 2013-10-20 14:14:02 -04:00
expwnent ee056f4422 Merge remote-tracking branch 'angavrilov/master' into 0.34.11-r4
Conflicts:
	NEWS
2013-10-20 11:09:40 -04:00
expwnent 57fc0f3e89 Merge remote-tracking branch 'angavrilov/master' into 0.34.11-r4
Conflicts:
	NEWS
	library/xml
	plugins/CMakeLists.txt
	plugins/autoSyndrome.cpp
2013-10-19 20:19:29 -04:00
Alexander Gavrilov 78de739d75 Update aquifers when generating 3D vein layout. 2013-10-11 19:23:32 +04:00
Alexander Gavrilov bed1e00a6e Use a cast instead of floor in perlin noise for performance. 2013-10-10 12:15:50 +04:00
Alexander Gavrilov f36041f6bd Implement a MapCache api for writing base layer tiles of arbitrary stone.
Precompute some tables in TileTypes for extremely efficient
conversion between tiles of most important material types.
2013-10-10 12:15:50 +04:00
Alexander Gavrilov 68b6e10b2c Implement writing veins tile by tile through MapCache.
Unlike changevein, which changes the material in an existing vein
object, with this feature you can set the material for individual
tiles, and the cache will write it out as vein objects.

The array inside the cache data is changed from layer material to
vein material, because layer material is easy to compute.
2013-10-08 18:17:36 +04:00
Alexander Gavrilov 9442e8ea1f Make biome information more explicit in MapCache. 2013-10-07 16:58:10 +04:00
Alexander Gavrilov ea36233dff Split MapCache code from Maps.cpp 2013-10-07 16:58:10 +04:00
Alexander Gavrilov 33469f5bb2 Use a better hash function in the Perlin noise generator. 2013-10-02 18:55:41 +04:00
Alexander Gavrilov e175efa689 Implement a template-based classical Perlin noise generator.
The mask argument of the Impl template is there because apparently
an inner template cannot be fully specialized, so there needs to be
some argument besides i.
2013-10-01 18:58:04 +04:00
Alexander Gavrilov 599af0a4d9 Fix linux and windows build issues.
- Linux makefile overrides and removes the optimization flags.
- Old linux gcc doesn't understand lambdas.
- MSVC doesn't like extern and explicit instantiation in same file.
2013-09-30 22:51:29 +04:00
Alexander Gavrilov 9e81d27cd1 Implement the same random generator as DF uses for DFHack. 2013-09-30 19:46:39 +04:00
expwnent ba73de5e35 EventManager: use units.all instead of units.active. 2013-06-20 21:34:32 -04:00
expwnent b44cd86dc9 EventManager: completely overhauled JOB_COMPLETED event detection, and tweaked Job::cloneJobStruct. 2013-05-25 09:44:17 -04:00
expwnent b4092f62e6 New module: Once. Intended to help prevent debug error message spam. 2013-03-23 22:38:33 -04:00
expwnent 3ffbef2396 Merge branch 'canStepBetween' into recent 2013-01-05 18:10:29 -05:00
expwnent f8abd5c595 StepBetween: renamed stuff back to the way it was. Thought I had already done that. 2013-01-05 18:09:50 -05:00
expwnent 6622e9e06f Merge branch 'canStepBetween' into recent
Conflicts:
	library/modules/Maps.cpp
2013-01-05 13:32:29 -05:00
expwnent 715f191c26 EventManager: made the frequency part of EventHandler. 2013-01-03 19:31:29 -05:00
expwnent 910e398a7b EventManager: added invasion event. 2013-01-03 15:52:56 -05:00
expwnent 4e4e382b8f EventManager: added syndrome event. 2013-01-02 18:30:15 -05:00
expwnent c3b2ae2137 EventManager: allowed plugins to specify how often they need events to be checked, in the event that monitoring is necessary. 2013-01-02 11:07:56 -05:00
expwnent fa78d6ccfc Merge branch 'recent' into eventManager-unstable
Conflicts:
	library/modules/Job.cpp
2013-01-02 03:16:45 -05:00
expwnent 4e99841862 EventManager: made Buildings module keep track of buildings so that it
can do findAtTile in constant time.
2013-01-01 22:22:31 -05:00
expwnent 7972902c81 stepBetween: named a few things better, and fixed a lot. 2012-12-19 20:30:37 -05:00
expwnent a93c0223a2 EventManager: unstable. Temp commit. 2012-12-18 20:28:30 -05:00
expwnent 555c754636 EventManager: added construction and building events. 2012-12-18 18:34:38 -05:00
expwnent 01e5e93825 Renamed Maps::canWalkBetween to Maps::canPathBetween and added Maps::canWalkBetween, which does what it says. 2012-12-16 23:26:50 -05:00
expwnent d4d8e69556 EventManager: Allowed absolute time registration. 2012-12-15 18:08:59 -05:00
expwnent 935058f0a5 EventManager: moved files around, made eventExample not run by default, and got rid of the silly NONE event type. 2012-12-15 17:43:41 -05:00
expwnent 86e002f3ff EventManager: added item creation event. 2012-12-15 16:49:13 -05:00
expwnent b0314755e0 EventManager: added unit death event. 2012-12-15 14:40:11 -05:00
expwnent 155a4d044c EventManager: fiddled with time events. Made it possible to register for time events before a world is loaded. Also added some files I forgot to add to the previous commit. 2012-12-14 23:29:28 -05:00
expwnent 747723187f EventManager: first draft. 2012-12-14 21:05:38 -05:00
jj ebc2625d97 ditch the unused Vegetation module 2012-12-06 23:47:25 +01:00
jj 3953112eb9 dump Vegetation::t_plant, fix plant.is_burning 2012-12-03 19:03:07 +01:00
Alexander Gavrilov bfc11cf946 Add persistent history of per-constraint item counts in workflow.
This will be needed for properly merging or integrating the status
screen by falconne. The history is maintained as a circular buffer
of up to 28 entries, and persists in save files.
2012-11-28 19:25:01 +04:00
Alexander Gavrilov e7905a5cff Add docs for the automaterial plugin, and use the new Painter class. 2012-11-22 19:38:45 +04:00
Kelly Martin bb3c5c02c1 Adjustments for MSVC compatibility 2012-11-20 09:32:04 -06:00
Alexander Gavrilov 767c1b9368 Duplicate the lua Painter class in C++. 2012-11-19 18:11:26 +04:00
Quietust 3f2e583746 Naming consistency 2012-11-16 15:35:34 -06:00
Quietust e2b9b703a0 Get rid of tabs 2012-11-16 15:33:36 -06:00
Alexander Gavrilov 2401be1b3b Add an api function to retrieve unit skill experience. 2012-11-16 22:48:49 +04:00
Alexander Gavrilov b4dcc7e7ad Add more native api functions for finding general and specific refs. 2012-11-12 19:17:32 +04:00
Alexander Gavrilov 9598316855 Add a native pen object for lua with a more checked behavior. 2012-11-03 20:06:33 +04:00