Cargo Drone


Adds a long distance cargo drone.

Content
a day ago
2.0
323
Logistics Circuit network

g Pcall on tick

8 days ago

Hello Devilhar.

I notice you are using Pcall inside a function "safe call" on tick.
I don't know if you are aware, but Pcall has a significant overhead, and you might not want to use it somewhere that's called per tick.

8 days ago

That's correct, I used it because I'm not confident things won't go wrong in the code, it's not my prettiest work. But it's only one call per tick so I figured it shouldn't be a massive hit on performance
Is it causing you problems?

8 days ago
(updated 8 days ago)

Alright, you made me look. Doing the simplest performance test, i.e. just running pcall given a noop function in a loop. I did not notice a performance impact at 100000 pcalls per tick, had to go over that to see my TPS go below 60. So unless it's causing an issue, there's a better way of testing, or if there's something I'm not aware of with how Factorio works with lua, I'll probably leave it be. There's already plenty of other things I could make better

It did however make me notice that my error printing is wrong XD

7 days ago
(updated 7 days ago)

I'm not using your mod, I was just curious to see how it worked and what the cargo drone entity was based off.

Using print(foo) will print into the console / terminal ( basically, stdout).
Using game.print(foo) will print into the game chat.

You've got plenty of room for improvement in this mod, but I agree with the approach "as long as it works fine, no need to refactor it right away". That being said, IMO, things like that shouldn't go into production / released code, but rather be kept for yourself and testing.
You really want the players to let you know when your mod isn't working. Although, I understand not wanting to crash the player's game.

I understand that I'm giving you unrequested advice, but I found the concept cool and was curious to see what happened under the hood, and some stuff flashed my mind as "wow this will be a performance sinkhole is someone uses a lot of this stuff".

7 days ago
(updated 7 days ago)

"Unrequested advice", yeah that's alright :P I assume the best intentions

And normally I do agree with making sure that players will let me know, however I uploaded it here so it'll be easier for me to play it with friends, and I can't guarantee I'll be around to provide support. So in this case I'd prefer to not boot users to the menu and instead allow them to potentially fix issues themselves by just giving the drones a jig. This coupled with the mod being mostly a brute-force effort means that my confidence in the code is low, but it's less than 1000 lines so it should be fine™

New response