This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_histfig_material(item,base_material,figure_id) | |
local figure_base=219 | |
local creature_base=19 | |
item:setMaterial(figure_base+base_material-creature_base) | |
item:setMaterialIndex(figure_id) | |
end | |
function reaction_imbue(reaction,reaction_product,unit,input_items,input_reagents,output_items,call_native) | |
--printall(input_items[1]) | |
local mat_source=input_items[1] | |
local mat=mat_source:getActualMaterial() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local args={...} | |
flags=flags or {} | |
local ann=df.global.announcements.flags | |
if args[1]=='-s' then | |
print('saving') | |
for k,v in pairs(ann) do | |
flags[k]=copyall(v) | |
end | |
elseif args[1]=='-r' then | |
print('restoring') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this requires a plugin that draws the map: https://github.com/warmist/dfhack/tree/twbt_experiments | |
--[[ | |
Ideas for future: | |
microtransactions (for rooms and stuff :D) jkjk | |
assignment to locations (e.g. performance etc) | |
see if idle location can be used for direct dwarf control | |
more info about dwarf | |
possesions (with a way to add/remove them) | |
rooms | |
artifacts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
//source: https://github.com/WG21-SG14/SG14/blob/master/SG14/inplace_function.h | |
#include <type_traits> | |
#include <functional> | |
namespace stdext | |
{ | |
constexpr size_t InplaceFunctionDefaultCapacity = 32; | |
constexpr size_t InplaceFunctionDefaultAlignment = 16; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T,long N> | |
constexpr long countof(T(&)[N]){return N;} | |
//TODO: add this -http://stackoverflow.com/a/24881903 | |
//TODO: file embedding lib | |
/* | |
void GetResourceAsString(int nResourceID, CStringA &strResourceString) | |
{ | |
HRSRC hResource = FindResource(NULL, MAKEINTRESOURCE(nResourceID), L"DATA"); | |
HGLOBAL hResHandle = LoadResource(NULL, hResource); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef VIRIDIS_HPP_INCLUDED | |
#define VIRIDIS_HPP_INCLUDED | |
void map_to_viridis(float v, uint8_t& r, uint8_t& g, uint8_t& b); | |
#endif | |
#ifdef VIRIDIS_IMPLEMENTATION | |
const double viridis_map[] = { | |
0.26700401, 0.00487433, 0.32941519, | |
0.26851048, 0.00960483, 0.33542652, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local args={...} | |
local site | |
for k,v in ipairs(df.global.world.world_data.sites) do | |
if dfhack.TranslateName(v.name)==args[1] then | |
site=v | |
end | |
end | |
if site==nil then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this following part is for our documentation | |
--[[=begin | |
needs | |
===== | |
shows needs of a unit. | |
=end]] | |
local args={...} --let's get the command line arguments to a nice table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_tile_type(pos,tile_type ) | |
local block=dfhack.maps.getTileBlock(pos) | |
block.tiletype[math.fmod(pos.x,16)][math.fmod(pos.y,16)]=tile_type | |
end | |
local args={...} | |
set_tile_type(copyall(df.global.cursor),tonumber(args[1])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1.0.{build} | |
branches: | |
only: | |
- develop | |
skip_tags: true | |
configuration: Release | |
clone_depth: 1 | |
clone_folder: c:\projects\dfhack | |
init: | |
- cmd: >- |