patch for trucks to make them auto "help-build" nearby incomplete structures. #737
Comments
ouch commented Hope I did this right... let me know if I didn't |
Zarel commented You declare But overall, those are easy things to fix. If everyone else agrees that this is a good idea, I can fix those issues and commit this. |
ouch commented well the current trunk has the buildings start out fully damaged and then slowly get repaired as they are being built. so I thought it was the proper way to handle that. but where was I supposed to declare helpbuild? And I can easily fix it if you don't want to waste the time to do so. |
Per commented That minor defect sounds rather annoying. Any chance of fixing it first? |
Zarel commented No, no, it's not a big deal; I'd be rewriting most of your patch when committing it; it's negligible. I suppose if you're planning on submitting other patches though, you may as well learn CodingStyle. Read that wikipage. You should also make your indentation match ours. Remember, we use Tab to indent. You are apparently using a text editor that turns tabs into spaces; turn off that feature. Do not comment out code; simply delete it. I also don't understand why you removed the comment |
ouch commented sorry for my delay in response. I was recently "let go" of my job... Havn't been able to concentrate enough to do any programming lately. But I'll look into fixing that per. But don't expect it too soon I'm afraid... |
Buginator commented Wait, didn't trucks always do this anyway? I could of swore they would start helping out if they were just sitting there? |
Zarel commented Nope, they don't. |
ouch commented seems like they should though don't it? :) Zarel: I'm not sure you can type cast from BASE_OBJECT like that. It keeps telling me that: BASE_OBJECT’ has no member named ‘status’ even when using your code: "(STRUCTURE)psObj->status == SS_BUILT" |
ouch commented added a new version where tab preservation was turned on in my ide, and the trucks now autobuild oil derricks on non-burning oil patches. I was still not able to get Zarels code to work. Even type casting (STRUCTURE *) like I see i other parts of code. Not sure as to what I'm doing wrong there. the auto building on oil derricks is something that bothered me since the CD version so many years ago. To see them finally doing it damn near brings a tear to my eye... lol |
Zarel commented Yeah, I meant Try |
ouch commented yep that did it. not sure why forcing it to apply the typedef first would matter though as I don't recall any other code needing it but oh, well it works. I updated the file to reflect the changes. oh and per, I looked into fixing that defect (which actually behaves differently than I thought) but because the interface loads directly from what the truck is doing I would probably need to make a new order and action to bypass the way the interface works. But I've been playing with it and I actually like how it is now. Simply because it allows the user to either immediately start a new list of tasks or it allows you to build off what it's currently doing and add on tasks to do when it's finished auto-building. I have attached my order.c file so that those that can compile the code can easily try out the new truck behaviors for themselves. But I really think you will like it, I know I do. Expansion and setting up defenses in hot firefights are a LOT easier. It almost seems like the trucks actually WANT to live now... ;p |
ouch uploaded file |
ouch commented heh, forgot the order.h file... but yeah, if I "fixed" that defect the user would have no choice but to start a new list of actions only instead of being given a choice. |
ouch commented So... has anyone tried it yet? |
Zarel commented We prefer diffs to replacement files. In fact, we rather dislike replacement files. More importantly, the technical aspect isn't such a big deal. Even if your patch didn't work, it'd take about five minutes to write one that does. We're mostly just unsure about whether something like this would be more useful than not. I think it might cause problems when you're trying to order a bunch of trucks to do different things. Which one was the one you just ordered, and which ones are just following along? |
ouch commented the updated diff file is up there already. I gave the replacement file so those with the code could easily find out if such an change is usefull or not. So far everyone seems to just be speculateing and not actually trying it. |
Zarel commented I'd recommend posting a thread in Gen Dev asking for feedback. I'm personally neutral, so I'm going to wait until a few people say it's a good idea before I commit. |
Cyp commented The "so if you want to build another of that structure then clicking the icon will stop the auto build process only to have the truck immediately start back up" issue is fixed, a while ago – the shift-click is now implied in all cases. Clicking the icon used to randomly cancel orders, even without this patch, anyway. Probably due to bugs making the icon light up incorrectly. So that issue is out of the way. |
Zarel commented Well, I'm fine with auto-help-build now. Anyone want to clean up the patch and commit it (emphasis on "clean up the patch first" and by that I mean "rewrite it"). |
ouch commented I can do that if you would like. Did you want auto build dericks too or just the auto help build? I strongly believe they should do both personally. I actually don't play the normal game anymore, I always use this patch I like it so much... I havn't played in ages though... |
Zarel commented Autoderricking is probably a good idea, too. |
Per commented This is completely wrong. The micro-AI must never give orders. Actions are the domain of the micro-AI, while orders are the domain of humans and AI scripts. Mixing these up will mess up things really badly. Auto-building derricks also sounds rather annoying. |
ouch uploaded file |
ouch uploaded file Patch adds automation enhancments to trucks |
ouch commented Ok, Here it is... a major re-write was done to give the trucks the ability to change their automation range depending on what mode the truck is in. Again, it's probably something they should have done to begin with... Hold 1.5 tiles (had some issues with larger buildings (2x2) being hard to get in range, factories are still a problem with this I think) guard 3 tiles pursue 5 tiles Also, we really should put those modes on the factory default settings list at some point. But anyway I tested this during one game without any issues with it. Being able to set different ranges can come in handy. ;) |
ouch commented forgot to add that orders.h is no longer needed as I removed the function I used before. (I figured, "when would a function that does that actually be used again for something else?") |
Per commented Again, this is completely wrong. Orders are not supposed to be used that way. The micro-AI should not start such things like this - that is for humans and AIs to decide. The patch would mess up the AI badly. Also, when a single conditional contains 15 function calls, most of whom are duplicates of each other, you really should consider refactoring your code. |
Zarel commented Once I am done refactoring the order/action code, the micro-AI will not be touching any droid orders... All future patches should take that into account. |
ouch commented I must of missed something... how can you have something like this without giving droids orders? are you supposed to tap into the game engine directly? and yeah that "if" statement is pretty sweet isn't it per? ;) |
Zarel commented You set the droid to do actions directly. |
Cyp <cyp@...> changed resolution from `` to |
Cyp <cyp@...> committed [24] In Warzone2100/warzone2100@24c8416:
|
Cyp <cyp@...> changed status from |
Cyp <cyp@...> changed owner from `` to |
resolution_fixed
type_patch (an actual patch, not a request for one)
| by ouchvery few changes were needed to make this work, so there will be little impact in performance I imagine.
the only minor defect is that once a truck is auto building, the build icon for that structure will light up. so if you want to build another of that structure then clicking the icon will stop the auto build process only to have the truck immediately start back up. But holding shift will allow you to place new structures, and the truck will immediately stop auto building and start building the new ones.
Issue migrated from trac:737 at 2022-04-15 19:01:37 -0700
The text was updated successfully, but these errors were encountered: