Quote:
Originally Posted by Ataros
Is there a way to include all the above code parts into just one method like clearAircraft(general timeout, optional aircraft landing timeout, optional aircraft abandoned timeout, optional aircraft crashlended timeout) and call it in just 1 line from existing game methods? The code would then automatically understand which method it is called from and act accordingly. I assume new code can not call the existing game methods itself and we have to put at least one line in existing game methods (onTrigger, ontickgame, etc.)
It would make life of server owners much easier. I am just starting to learn C# and is interested to learn how to make code more readable and usable as encapsulated building blocks. It would be perfect to have just one code block per function.
|
To be honest, it can't get too much simpler than it is already. You are right that there needs to be at least one line of code in the methods and that's the way it is already. We have one line of code in the OnPlaceLeave() method and on the AircraftLanded() and AircraftCrashLanded() methods and of course the mission number listener.
I'm not an expert in software development, but I was taught that you don't want to cram too much code into one method. It's better to separate it out into parts so it's easier to read and modify.