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 / vmethods.rst
Last active June 22, 2022 16:32
DF usefull vmethods.
Items:
  • incrementRotTimer
  • addImprovementFromJob
  • moveToGround
  • categorize
  • addWear/incWearTimer/setWear
  • addContaminant/removeContaminant/removeContaminantByIdx
  • contaminateWound
  • coverWithContaminant
  • becomePaste/becomePressed
@warmist
warmist / tofort.lua
Last active June 10, 2022 13:47
Switch to fort mode
-- changes from advmode to fort safely (hopefully)
if df.global.gamemode==df.game_mode.ADVENTURE then
local adv=df.global.world.units.active[0]
local ui=df.global.ui
function advGlobalPos()
local wd=df.global.world.world_data
return wd.adv_region_x*16+wd.adv_emb_x,wd.adv_region_y*16+wd.adv_emb_y
end
function inSite()
local tx,ty=advGlobalPos()
# McSimps Titanfall Map Exporter Tool
# Website: https://will.io/
# Modded(butchered) to output ply by Warmist
# disclaimer: i don't know python...
import struct
from enum import Enum
import os
import math
local fname="mp_forwardbase_kodai.ain"
local print_stuff=true
local save_nodes=true
local save_links=true
--[[ current struct layouts ]]
local MAX_HULLS=5
local ain_file={
{"u32","magic"},
{"u32","mapver"},
{"u32","crc"},
@warmist
warmist / hull_list.txt
Last active January 9, 2022 08:25
ImHex pattern and lua file for reading titanfall2 navmesh file format
Hulls extracted from the game:
180b4be60 hulldef[6]
hulldef[0]
name=HULL_HUMAN
field1_0x8=0x1
bbox_min={-16,-16,0}
bbox_max={16,16,72}
walk_height=18.0 //not 100% sure...
field5_0x28=0.5
field6_0x2c={60.0f,250.0f,400.0f}
@warmist
warmist / ain_file.hexpat
Last active December 27, 2021 20:35
Titanfall2 .ain file partial layout
struct header {
u32 version;
u32 map_version;
u32 unk0; //crc or hash or sth
};
header head @ 0x00;
struct node_t {
float px,py,pz,yaw;
function find_race(name)
name = name:lower()
for i,v in ipairs(df.global.world.raws.creatures.all) do
if v.creature_id:lower() == name:lower() then
return i
end
end
end
--NOTE(warmist): named_civ changed to player_civ but does not make sense?
@warmist
warmist / rip-heart.lua
Last active November 30, 2020 07:26
Rip out the heart...
--removes heart
function findBodyPart(caste_raw,token)
for id,bp in ipairs(caste_raw.body_info.body_parts) do
if bp.token==token then
return id,bp
end
end
end
local trg=dfhack.gui.getSelectedUnit()
local heart_id=findBodyPart(df.creature_raw.find(trg.race).caste[trg.caste],"HEART")
//from Hash Functions for GPU Rendering (Jarzynski et al.)
//http://www.jcgt.org/published/0009/03/02/
uint3 pcg3d(uint3 v)
{
v = v * 1664525u + 1013904223u;
v.x += v.y*v.z; v.y += v.z*v.x; v.z += v.x*v.y;
v ˆ= v >> 16u;
v.x += v.y*v.z; v.y += v.z*v.x; v.z += v.x*v.y;
return v;
}
@warmist
warmist / find_twbt.lua
Last active October 12, 2018 10:54
Find render_map offset for twbt
local ms=require('memscan')
local cs=ms.get_code_segment()
function get_ptr_size( )
local v=df.new('uintptr_t')
local ret=df.sizeof(v)
df.delete(v)
return ret
end