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 DEATH_FIND() | |
local unit=df.global.world.units.all[0] | |
local offset=select(2,df.sizeof(unit:_field("flags1")))-select(2,df.sizeof(unit)) | |
print(string.format("flags offset:%x",offset)) | |
local list=offsets.findall(GetTextRegion().start,0x83,ANYBYTE,DWORD_,offset,2) | |
for k,v in pairs(list) do | |
local call_pos=offsets.find(v,0xe8,DWORD) | |
if call_pos~=nil and call_pos~=0 and call_pos-v<1000 then | |
print(string.format("%3d.%6d =>%6x",k,(call_pos-v),v)) |
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
vec=df.global.world.items.other.ANY_CORPSE | |
pos=df.global.cursor | |
unit_id=-1 | |
for k,v in pairs(vec) do | |
if v.pos.x==pos.x and v.pos.y==pos.y and v.pos.z==pos.z then | |
print("corpse pieces with unit_Id:"..v.unit_id) | |
unit_id=v.unit_id | |
end | |
end |
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 heal(unit) | |
unit.body.wounds:resize(0) -- memory leak here :/ | |
unit.body.blood_count=unit.body.blood_max | |
--set flags for standing and grasping... | |
unit.status2.able_stand=4 | |
unit.status2.able_stand_impair=4 | |
unit.status2.able_grasp=4 | |
unit.status2.able_grasp_impair=4 | |
--should also set temperatures, and flags for breath etc... | |
unit.flags1.dead=false |
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
vec=df.global.world.units.all | |
pos=df.global.cursor | |
civ=df.global.ui.civ_id | |
fixed=false | |
for k,v in pairs(vec) do | |
if v.pos.x==pos.x and v.pos.y==pos.y and v.pos.z==pos.z then | |
print("unit id at cursor position:"..v.id) | |
print("Flags2:") | |
for f_name,f_val in pairs(v.flags2) do | |
print(f_name,f_val) |
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 putInItem(item,unit) | |
local u_ref=df.general_ref_contains_unitst:new() | |
u_ref.unit_id=unit.id | |
item.itemrefs:insert(#item.itemrefs,u_ref) | |
local u_cr_ref=df.general_ref_contained_in_itemst:new() | |
unit.flags1.caged=true | |
u_cr_ref.item_id=item.id | |
unit.refs:insert(#unit.refs,u_cr_ref) | |
end |
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 getInv(unit) | |
local ret={} | |
if unit==nil then | |
error("Failed to list unit's items. Unit not selected/valid") | |
end | |
for k,v in ipairs(unit.inventory) do | |
local caste=df.global.world.raws.creatures.all[unit.race].caste[unit.caste] | |
local bp_code=caste.body_info.body_parts[v.body_part_id].part_code | |
local key=bp_code | |
--print("Item:"..tostring(v.item).." "..key) |
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 getCompanions() | |
local ret={} | |
local adv=df.global.world.units.active[0] | |
for k,v in pairs(df.global.world.units.active) do | |
if v.relations.group_leader_id==adv.id then | |
table.insert(ret,v) | |
end | |
end | |
return ret |
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
#include <vector> | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
vector<bool> bloom; | |
const unsigned int bloomsize=1024; | |
//----------------------------------------------------------------------------- | |
// MurmurHash2, by Austin Appleby |
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
-- missing.md | |
arr={1,2,3,4,6,8,7,9,10,11,12} | |
sum=0 | |
for k,v in pairs(arr) do | |
sum=bit32.bxor(sum,v) | |
end | |
for i=1,#arr+1 do | |
sum=bit32.bxor(sum,i) | |
end |
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 getMyEntity() | |
return df.historical_entity.find(df.global.ui.group_id) | |
end | |
function getWorkshopId(token) | |
for k,v in pairs(df.global.world.raws.buildings.all) do | |
if token==v.code then | |
return v.id | |
end | |
end | |
end |
OlderNewer