Page 1 of 1

RELEASE: Nano Controls Widget

Posted: 13 Oct 2007, 11:27
by TechnoTone
Current version available at UF:
Image

Nano Controls widget by TechnoTone
Version 1.00

--------------------------------------------------------------------------------------------------------------------------

Provides GUI controls for nano towers.
Nano towers can be set to: Automatic / Repair / Reclaim.

Automatic: repairs units, reclaims features if required, assists construction of new units, assists factories.

Repair: repairs units, assists construction of new units (except factories).

Reclaim: reclaims all features/wrecks, irrespective or whether the resources are needed or not.


New towers are initially assigned the last order used, or Automatic if no order has been given.


This was initially a proof-of-concept project and the intention was to convert it into a gadget and place the controls into the standard unit control panel. I have tried to write the gadget and failed but BigHead has offered to do it (it was his idea to do it that way in the first place). In the mean time, this is available for testing purposes.

REQUIREMENTS: This widget requires the IceUI framework.

INSTALLATION: Please place this widget in the Spring/LuaUI/Widgets/IceUI folder.


Credits to:
Trepan - for the original ImmobileBuilder widget which I borrowed some code from
BigHead - for the inspiration for this widget and for some help producing it
MelTraX, AlfaSub - for the IceUI framework which made this widget so easy to produce

--------------------------------------------------------------------------------------------------------------------------

Re: RELEASE: Nano Controls Widget

Posted: 13 Oct 2007, 11:35
by Pendrokar
TechnoTone wrote:
INSTALLATION: Please this widget in the Spring/LuaUI/Widgets/IceUI folder.

You forgot a word!

Posted: 13 Oct 2007, 13:26
by AF
A version of this widget in gadget form that was automated would do wonders for AI nanotower usage. A simple check could disable the auomation for non AI players.

Posted: 13 Oct 2007, 13:30
by BigHead
A simple check could disable the auomation for non AI players.
Ehm, could you be more specific? I don't understand what you're trying to say ... edit: ... and I'm the one who's working on the gadget version so I'm concerned :)

Posted: 13 Oct 2007, 13:36
by AF
ok each player controls a team and thus controls a commander right?

if(player is an AI){
do stuff
}

It is possible to check if the current player the gadget is running for is a human or an AI, trepan posted a quick snippet that showed it not long ago IIRC.

Why shouldn't the gadget be able to tell if its one fo the latter 2 and do extra work if it is?

Posted: 13 Oct 2007, 13:48
by DZHIBRISH
Big head nice stuff...any chace ull do a lua thingy that allows labs to self reclaim?

Re: RELEASE: Nano Controls Widget

Posted: 13 Oct 2007, 14:23
by TechnoTone
Edited first post. Forgot to mention this:
TechnoTone wrote:New towers are initially assigned the last order used, or Automatic if no order has been given.

Posted: 13 Oct 2007, 15:04
by BigHead
AF: I've read your "Unrealistic Expectations" thread so I know where you're aiming. However you still haven't written what { do stuff } should do :)

DZHIBRISH: TechnoTone made this widget. About your request: Good news is that what you want shouldn't be hard to implement. Bad news is that my time to work on spring is limited to weekends and I already have plans for something BIG. However I offer my help to anyone who decides to help you with this.

Code: Select all

These call-outs can be used to simulate reclaiming:
Spring.SetUnitHealth - diminishing health
Spring.AddUnitResource  - adding metal&energy make for the self-reclaiming factory
Spring.DestroyUnit - obvious
Edit: ... and please post to the right thread.

Posted: 13 Oct 2007, 15:47
by imbaczek
FYI I committed a patch that stops allied builders on guard or patrol from repairing units that are being reclaimed. Testers welcome, as always.

Posted: 13 Oct 2007, 16:02
by TechnoTone
^ Nice one.

Does it check that the unit performing the reclamation is allied too? Wouldn't want nano's to ignore the enemy slowly reclaiming a factory, etc.

Posted: 13 Oct 2007, 16:05
by imbaczek
Yes, in theory 8) As I said, the more testers, the better. Try it by yourself if you want to be 100000% sure and report a bug if this change broke something else.

Posted: 13 Oct 2007, 19:00
by AF
the do stuff is basically the whole point of this widget

aka if this widget had no 'do stuff' then it would do absolutely nothign and we'd all be complaining that someone had released an empty widget that did absolutely nothing.

As said above this widget assigns the last command applied. So that's basically all that's required, something to decide which command to initially assign.

Posted: 13 Oct 2007, 20:21
by lurker
Is it possible to add a repair-only mode?

Posted: 13 Oct 2007, 20:59
by TechnoTone
The engine doesn't distinguish between repair and build assist so to do that the widget would have to continuously check all units within reach of the nano tower to see which ones are in need of repair but that aren't still being built. This would have much more impact on the cpu usage of the widget.

In answer to your question: yes, it is possible. I won't be doing it any time soon though - if at all.

Posted: 13 Oct 2007, 21:06
by trepan
You can use Spring.GetUnitHealth() -> health, maxHealth, paralyze, capture, buildProgress

If the unit is idle, find all units within its repair radius with Spring.GetUnitsInCylinder().
Search through the units to find which ones have buildProgress >= 1, and that have
health < maxHealth. Pick the closest / weakest / whatever and issue a repair order.

P.S. You'll want to set the move mode for this to work, iirc.

Posted: 13 Oct 2007, 21:23
by BigHead
Wow, this is very good news. I was aware of that call-out but always thought it does something else :)