diff options
| author | Warmist | 2012-04-14 13:30:48 +0300 |
|---|---|---|
| committer | Warmist | 2012-04-14 13:30:48 +0300 |
| commit | a2a47c5d63efe42b05a90ecedd2b95544ced2234 (patch) | |
| tree | d16d9cceeb8a56a013f592e2e49487c71bfbcf74 /plugins/Dfusion | |
| parent | 2d8611a4803edc6bd37030ac303230fee208f718 (diff) | |
| download | dfhack-a2a47c5d63efe42b05a90ecedd2b95544ced2234.tar.gz dfhack-a2a47c5d63efe42b05a90ecedd2b95544ced2234.tar.bz2 dfhack-a2a47c5d63efe42b05a90ecedd2b95544ced2234.tar.xz | |
Fix to init (no need to add " around). Added experimental (crashy as hell) tools.project
Diffstat (limited to 'plugins/Dfusion')
| -rw-r--r-- | plugins/Dfusion/luafiles/init.lua | 15 | ||||
| -rw-r--r-- | plugins/Dfusion/luafiles/tools/init.lua | 43 |
2 files changed, 45 insertions, 13 deletions
diff --git a/plugins/Dfusion/luafiles/init.lua b/plugins/Dfusion/luafiles/init.lua index 358f93d0..e68684bf 100644 --- a/plugins/Dfusion/luafiles/init.lua +++ b/plugins/Dfusion/luafiles/init.lua @@ -86,14 +86,15 @@ loadall(plugins) dofile_silent("dfusion/initcustom.lua") local args={...} -for k,v in pairs(args) do - local f,err=load(v) - if f then - f() - else - Console.printerr(err) - end + + +local f,err=load(table.concat(args,' ')) +if f then + f() +else + Console.printerr(err) end + if not INIT then mainmenu(plugins) end diff --git a/plugins/Dfusion/luafiles/tools/init.lua b/plugins/Dfusion/luafiles/tools/init.lua index e690e941..b01157c8 100644 --- a/plugins/Dfusion/luafiles/tools/init.lua +++ b/plugins/Dfusion/luafiles/tools/init.lua @@ -274,19 +274,50 @@ function tools.changesite(names) print(string.format("%x->%d",off,n2)) engine.poke(off,ptr_site.type,n2) end -function tools.project(unit) +function tools.project(unit,trg) if unit==nil then - unit=getSelectedUnit() - end - - if unit==nil then - unit=getCreatureAtPos(getxyz()) + unit=getCreatureAtPointer() end if unit==nil then error("Failed to project unit. Unit not selected/valid") end -- todo: add projectile to world, point to unit, add flag to unit, add gen-ref to projectile. + local p=df.proj_unitst:new() + local startpos={x=unit.pos.x,y=unit.pos.y,z=unit.pos.z} + p.origin_pos=startpos + p.target_pos=trg + p.cur_pos=startpos + p.prev_pos=startpos + p.unit=unit + --- wtf stuff + p.unk14=100 + p.unk16=-1 + p.unk23=-1 + p.fall_delay=5 + p.fall_counter=5 + p.collided=true + -- end wtf + local citem=df.global.world.proj_list + local maxid=1 + local newlink=df.proj_list_link:new() + newlink.item=p + while citem.item~= nil do + if citem.item.id>maxid then maxid=citem.item.id end + if citem.next ~= nil then + citem=citem.next + else + break + end + end + p.id=maxid+1 + newlink.prev=citem + citem.next=newlink + + local proj_ref=df.general_ref_projectile:new() + proj_ref.projectile_id=p.id + unit.refs:insert(#unit.refs,proj_ref) + unit.flags1.projectile=true end function tools.empregnate(unit) if unit==nil then |
