Skip to content

Instantly share code, notes, and snippets.

View warmist's full-sized avatar
💭
Making a game or sth

Warmist warmist

💭
Making a game or sth
View GitHub Profile
@warmist
warmist / gm-editor.lua
Created December 8, 2015 20:03
A requested change for ragundo
index 2afca8f..fe7139d 100644
--- "a/Temp\\TortoiseGit\\gm-26AD.tmp\\gm-editor-b58ccc9-left.lua"
+++ "b/DFHack\\scripts\\gui\\gm-editor.lua"
@@ -324,6 +324,11 @@ function getStringValue(trg,field)
local text=tostring(obj[field])
pcall(function()
+ if require'utils'.is_container(obj[field]) then
+ if #obj[field]==0 then
+ text="<empty> "..text
@warmist
warmist / move_wall.lua
Created December 1, 2015 18:44
Moving walls in dfhack
local utils=require 'utils'
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 pos=copyall(df.global.cursor)
local tt=dfhack.maps.getTileType(pos)
local d,o=dfhack.maps.getTileFlags(pos)
@warmist
warmist / make_mat_historical.lua
Created October 21, 2015 20:56
Makes item to use historical name of material. E.g. titan's name instead of "titan leather"
local figure_base=219
local creature_base=19
function is_already_historical( it )
return it:getMaterial()>=figure_base
end
function find_hf_by_race(race,unique)
local hfl=df.global.world.history.figures
local found
for i,v in ipairs(hfl) do
@warmist
warmist / site-now.lua
Created September 11, 2015 21:31
create site for adventurer
--[=[o
site-now name x y site_type civ_id {region{min_x,min_y, max_x,max_y} | [size_x size_y] }
size_x size_y only if with "-a" flag
other flags:
-a | --adventurer : try to figure out stuff from adventurer
does not need "x" and "y" and "civ_id"
-r | --random_name : generate random name for the site
does not need "name"
@warmist
warmist / dwarven-vaults.md
Last active August 29, 2015 17:43
df mod/scenario/type of play idea.

inspired by fallout shelter To be played by 2+ players:

  • vault-tech engineer
  • overseer(s)

Play stages:

  • Stage 1: Vault-tec (player 1 / game master)
    • build a vault. This might be done with fast dwarves and special reaction/buildings for extra fast building.
    • stocks it up. During nuclear winter (or dwarven equivalent of that) there will be no going out. Also stuff will wear down (more)
    • installs things. Some things are only buildable by vault-tec (e.g. vault door, reactor?)
@warmist
warmist / NaturesRevenge.lua
Last active August 29, 2015 14:23
A Catastrophes plugin for cuberite minecraft server
--[=====[
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@warmist
warmist / enum_iter.h
Last active November 24, 2015 19:50
Automatic enumeration iteration generation formation C++'ination.
#define enum_helper(type_name,first,last) type_name operator++(type_name & x) {return x = type_name(std::underlying_type<type_name>::type(x) + 1); }\
type_name operator*(type_name c) {return c;}\
type_name begin(type_name r) {return type_name:: first;}\
type_name end(type_name r) {return type_name:: last;}
enum class thingy
{
a,b,c,d,e,f,g
};
@warmist
warmist / waypoints.lua
Created February 1, 2015 17:16
waypoints -sort of updated-
-- adv mode waypoint system.
local args={...}
local armies=df.global.world.armies.all
function printHelp()
print("An adventure mode travel map teleporation system.")
print(" -s <name> - save current position as <name> waypoint")
print(" -g <name> - goto waypoint <name>")
print(" -dg <name> - goto waypoint <name>")
print(" -d <name> - delete waypoint")
print(" -l (or no arguments) - list waypoint names")
@warmist
warmist / text.txt
Last active September 21, 2015 19:28
function research for df enemy_cache
function: sub_C59740
arg0 -> other unit
ecx -> this unit
Research enemy_cache values:
Asume ecx=edi-> this
and ebp->other
* this==other -> 3
* other.flags3 & 1200h -> 4 // ghostly | wait_until_reveal
* other.flags1 & 201002h -> 5 // dead | projectile | caged
@warmist
warmist / tutorial.lua
Last active August 29, 2015 14:14
Tutorial about dfhack gui system
local gui=require 'gui'
local widgets=require 'gui.widgets'
tutorial_screen=defclass(tutorial_screen,gui.FramedScreen)
function tutorial_screen:init(args)
self:addviews{
widgets.Label{text="Info:",frame={t=1,l=1}},
widgets.Label{text="Other text: Text Text text",frame={t=2,l=2}},