Antares
Spell Reviewer
- Joined
- Dec 13, 2009
- Messages
- 982
What is the reason you have three identical copies of RoadPoint in your script? As far as I can tell, you are not using any instanceable structs in your script. You could make a Road struct that you create with Road.New() and that has a rect array as a member, holding all the road points. Then you can add a method MyRoad.AddRoadPoint to add new road points to that road.
You are looping over all rects to find the one that the unit entered on the TriggerRegisterEnterRectSimple event. You can save the integer i to a hashtable with the rect as the key and retrieve it much faster that way.
You have hardcoded numbers such as
And that's really the main issue with your ressource. As a system, it lacks customization options. As a template, it lacks explanations what the various parts are there for, making me believe that anyone who has the ability to understand your code and modify it to their own needs would also be able to write it from scratch. It doesn't help that your english isn't the best. I would advise that you get help doing your descriptions, either translate it with ChatGPT or have a hive member help you out. A bit of whitespace between the various functions would also help to make the code more readable.
Your code has some useful bits in there, but I don't think it's in a state where it can be approved.
Awaiting Update
You are looping over all rects to find the one that the unit entered on the TriggerRegisterEnterRectSimple event. You can save the integer i to a hashtable with the rect as the key and retrieve it much faster that way.
You have hardcoded numbers such as
if ORDER.Load(id) == 7 then
or integer GREEN = 6
in your code that aren't explained anywhere. The former one should be just the maximum number of rects added to that Road.And that's really the main issue with your ressource. As a system, it lacks customization options. As a template, it lacks explanations what the various parts are there for, making me believe that anyone who has the ability to understand your code and modify it to their own needs would also be able to write it from scratch. It doesn't help that your english isn't the best. I would advise that you get help doing your descriptions, either translate it with ChatGPT or have a hive member help you out. A bit of whitespace between the various functions would also help to make the code more readable.
Your code has some useful bits in there, but I don't think it's in a state where it can be approved.
Awaiting Update