oh it breaks on unit selection I found the workaround to this by altering the unit target to be just for the Adventurer but when I attempted to do a at pointer run speed of projectile I didn't write a function that aim the player so I kept flying in the bottom right per jump.
Well, Rumrusher started the translation and I fleshed out what they were doing while learning more about the various structures with gm-editor and surprisingly enough I was able to make it work well, if dangerously.
function jump(unitSource,unitTarget)
local curpos
if df.global.ui_advmode.menu==1 then
curpos=df.global.cursor
else
print ("No cursor located! You would have slammed into the ground and exploded.")
return
end
local count=0
local l = df.global.world.proj_list
local lastlist=l
l=l.next
while l do
count=count+1
if l.next==nil then
lastlist=l
end
l = l.next
end
resultx = curpos.x - unitSource.pos.x
resulty = curpos.y - unitSource.pos.y
resultz = curpos.z - unitSource.pos.z
newlist = df.proj_list_link:new()
lastlist.next=newlist
newlist.prev=lastlist
proj = df.proj_unitst:new()
newlist.item=proj
proj.link=newlist
proj.id=df.global.proj_next_id
df.global.proj_next_id=df.global.proj_next_id+1
proj.unit=unitSource
proj.origin_pos.x=unitSource.pos.x
proj.origin_pos.y=unitSource.pos.y
proj.origin_pos.z=unitSource.pos.z
proj.target_pos.x=curpos.x
proj.target_pos.y=curpos.y
proj.target_pos.z=curpos.z
proj.prev_pos.x=unitSource.pos.x
proj.prev_pos.y=unitSource.pos.y
proj.prev_pos.z=unitSource.pos.z
proj.cur_pos.x=unitSource.pos.x
proj.cur_pos.y=unitSource.pos.y
proj.cur_pos.z=unitSource.pos.z
proj.flags.no_impact_destroy=true
proj.flags.piercing=true
proj.flags.high_flying=true
proj.flags.parabolic=true
proj.flags.no_collide=true
proj.flags.unk9=true
proj.speed_x=resultx*10000
proj.speed_y=resulty*10000
proj.speed_z=resultz*10000
unitoccupancy = dfhack.maps.ensureTileBlock(unitSource.pos).occupancy[unitSource.pos.x%16][unitSource.pos.y%16]
if not unitSource.flags1.on_ground then
unitoccupancy.unit = false
else
unitoccupancy.unit_grounded = false
end
unitSource.flags1.projectile=true
unitSource.flags1.on_ground=false
end
unitTarget = curpos
unitSource = df.global.world.units.active[0]
jump(unitSource,unitTarget)
Had to add a check and error so it wouldn't try to use x/y/z = -30000 for targeting and speed because it kills your ass so dead that one time my icon didn't change after I slammed completely through a wall into a building.
Rumrusher worked out that part of the problem in adventurer mode was not having enough speed for the projectile to move you enough. I did some science, by which I mean I tackled some unsuspecting creatures and checked the proj_list with gm-editor and noticed that the speeds were all in the tens of thousands (and of course simply designated as being away from where you tackled them, so negative values) and then managed to alter the trajectory of a kea I had tackled in mid-air to make it start heading upwards.
To get the same effect I jacked up the *200 multiplier Rum was testing and it looks like 10k will let you make shorter jumps without failing to travel far enough, but it is the difference of the unit position and cursor position times 10k, so make sure you have a free hand and a tree to grab if you're trying to jump across the screen, else you will be severely wounded or killed!
Oh, I technically didn't have to reverse the unitsource/target and they should be switchable back to the same arrangement as propel used but I kept typing the wrong one because I was trying to move from the unit pos to the cursor pos so I just find/replaced em.
Dear god it is fun, incidentally.