Loading...
  OR  Zero-K Name:    Password:   

terraform helper widget

12 posts, 1276 views
Post comment
Filter:    Player:  
sort
posting for anybody that might find this useful

good for coop game, make several elevated stardust+ddm with ease

limitations:
- doesn't work yet with multiple stardusts in queue
- orders end up in the end of queue (even without shift), so if your constructors are moving, you probably want to press "S" to stop them first

how to use:
1) put in zerok/LuaUI/widgets folder, enable local widgets in settings, activate widget (name starts with "zzz_...")
2) in game, select positive terraform e.g. "50" and now if you make stardust or ddm, it first elevates +50 above current ground

newest version: http://pastebin.com/0jMNRt6t
original version: http://pastebin.com/wcnwKWDh

+4 / -0

9 years ago
Hacker!
+2 / -0
9 years ago
thanks :)
also note it's pretty untested/unstable
+0 / -0
You might want to pace it a bit. Checking if terraform has happened every 1/30 fraction of second is a bit too often.

Also it makes sense to only run widget:GameFrame after you have recieved "terraform complete message":

function widget:UnitFinished(unitID, unitDefID, unitTeam)
if unitTeam==myTeamId then
if unitDefID==terraunit.id then
--hey it makes sense to start checking if height is indeed of what I expected (as it takes time for spring to update heightmap)
end
end
end

P.S. Damn it eats code formatting.

If changes I proposed today pass, the code is going to become even more simple.
+0 / -0
http://pastebin.com/2PwDQR0x

this uses cmd.insert and a marker command to get the original build order back into the command queue behind the terra order. this works without gameframe(), but it sometimes fails for some unknown reason and the terra order ends up after the build.
+0 / -0
9 years ago
quote:
-- 37 = stardust
-- 275 = ddm
https://springrts.com/wiki/Lua_UnitDefs#Interessting_keys.2Fsnippets
+1 / -0

9 years ago
DErankKlon, it's because you likely rely on succesful turn of events during the race condition. I found that it was not reliable to place an actual order before terraform command is converted into CMD.REPAIR of terraform unit.
+0 / -0
9 years ago
why is there a race condition? :o

also, pushing the order into just the next frame would avoid this?
+0 / -0

9 years ago
Honestly I don't know, some science will be required (first thing I'd do is to Echo frames upon which terraunit is created (thru UnitCreated, filtered by terraunit) and your custom command is receieved).

But symptom
quote:
but it sometimes fails for some unknown reason and the terra order ends up after the build.
hints racing.
+1 / -0
http://pastebin.com/YQku1KQc

moving it to the next frame worked. in order to make it work while paused i also push orders on a stack. however, due to the nature of how terraform works both terra and build orders always end up at the end of the que (but in the correct order)
+0 / -0
9 years ago
DErank[2up]knorke I thought unit's ID is fixed between zero-k versions, but it seems it's unit's name, id changes, and widget stopped working for ddm (different ID). I updated widget to reflect that, and to allow easier customization:
http://pastebin.com/0jMNRt6t

Also to find out unit names, I wrote mini-widget to help myself: dev_print_unitdefs.lua http://pastebin.com/P7WE6Ez0

DErankKlon could you post whole widget in pastebin? I tried to copy-paste from your code to my code, to see, if it would behave differently, but I didn't see any difference, maybe I missed some code.
+0 / -0

8 years ago
I just gave this widget a try. Queuing multiple skydusts seems to sort-work (at least under z-k v1.4.3.4), in that the terraforms end up in the queue before the stardusts but multiple skydusts do end up being built.

The latest pastebin version has mixed whitespace/tabs for indents and trailing whitespace. May I suggest using a github gist instead of pastebin or a regular github repo?
+0 / -0