Topic: get_buildings and constructionsite
Tibor Topic Opener |
Posted at: 2014-02-03, 19:13
Hi is there something like get_buildings for unfinished buildings? Something like get_constructionsite('sentry') or so.... Top Quote |
SirVer |
Posted at: 2014-02-03, 20:29
No, there is not. It can be easily added though. However, you make your own constructionsites when you place buildings, just keep a lua table and check it periodically (for example in a separate coroutine) if buildings have been finished. Top Quote |
Tibor Topic Opener |
Posted at: 2014-02-03, 21:39
This is what I am going to do. By chance, this shortcoming is easy to compensate for... Top Quote |
SirVer |
Posted at: 2014-02-04, 09:15
adding this functionality into Widelands is actually super easy - would require mostly copy and pasting at the right spots and a small modification. If you get Widelands to compile on your machine I can show how to do it and you would be super independent. Also, it is not by incident that this 'shortcoming' can be compensated for - Lua is touring complete. You can do everything you want to do in Lua too. Top Quote |
Tibor Topic Opener |
Posted at: 2014-02-04, 19:19
well my AI would not be portable if it would depend on some special modifications to code. Yet another question, about discarding buildings. In wiki I found: remove() Removes this object immediately. If you want to destroy an object as if the player had see destroy(). But there is no "destroy()" at all, or is there? As far as I understand, destroy() would dismantle the building and some material could be returned to warehouse - similarly as a human player would do. But AI can not do this. Correct? Edited: 2014-02-04, 19:19
Top Quote |
SirVer |
Posted at: 2014-02-05, 06:04
you know, that is a super weak argument. Your code would be included in the nightlies that we start building immediately after b18 again, so everybody could test your AIs. Right now there is also no super compatible way to distribute your AI either. And adding this code would not only benefit you, it would also help Widelands as a whole because it would get useful new features.
No there is no destroy(). destroy would be burning down the building, remove just makes it vanish right now.
No, this would be a third function probably called dismantle(). But like destroy(), this is not exposed to the Lua API. You could add these methods and contribute them back >:-). Top Quote |
Tibor Topic Opener |
Posted at: 2014-02-05, 18:49
I am afraid to mess with C code and it would take huge amount of time for me and be a risk to the code My goal now is to prepare the AI as a scenario and to be distributed as a map. For start it is more then enough... yes, dismantle() would be much usefull, because on the begining of the game there is shortage of material as everybody knows Top Quote |