Better Cargo Planes


This mod aims to improve the Cargo Plane from the Aircraft mod by adding an Equipment Grid as well as two upgraded versions of the Cargo Plane.

Content
2 years ago
0.17 - 1.1
37.5K
Transportation

g ✔️ Update to Aircraft 1.8 & new art

2 years ago

Hi Modernkennnern!
I've just uploaded a major update to the Aircraft mod, and in the process, I was informed that I had broken your mod by removing jet-start.ogg. I published a fix immediately, but I think it'd be cleaner for this mod to be updated with the recent changes. If you wish, I can create a pull request on your repo! In this specific case, I changed the way the sound works by scaling it to activity, and it removed the use for jet-start.ogg.
In the update, I also greatly simplified the prototype code. I think it'd be more dynamic to use a different method for generating your main entities: I would use table.deepcopy to take the existing prototype and only changes the diverging parameters. For an example, check out particles.lua in Aircraft.

If you want, I can also remake your thumbnail in the same style as the new Aircraft one!

2 years ago

Thanks for informing me.

Originally I spent probably 2 hours making this entire mod with minimal prior knowledge of LUA. I'll do all of those things you've mentioned, and I'd love to get a new and improved icon - I made mine in paint in approximately 10 seconds :s

2 years ago
(updated 2 years ago)

Would it be possible for you to expose those functions of yours publicly, or maybe add an entity property that's a wrapper around those functions? (Is that even possible?), like airplaneAnimationSource that gets called during the final step to then set the animation via that function - such that there's less duplicated code.

I'm specifically referring to airplaneAnimation(), resist, and addcommonaimlines.
As it stands I've just copy-pasted these methods into my own file

2 years ago
(updated 2 years ago)

While you're at it - making an improved thumbnail, would you be willing to make new spritesheets for my planes? The way I originally did it was to ask a (definite-not-artist) friend to do it, and he literally just used the photoshop/illustrator/whatever feature to change all blue pixels red/green.

Doing the exact same thing is fine; I just have no software to do such a thing, and I have no idea how to - and the spritesheet layout is altered somewhat, so I can't use my existing ones using the same system as you do.

2 years ago
(updated 2 years ago)

Would it be possible for you to expose those functions of yours publicly, or maybe add an entity property that's a wrapper around those functions? (Is that even possible?), like airplaneAnimationSource that gets called during the final step to then set the animation via that function - such that there's less duplicated code.

I'm specifically referring to airplaneAnimation(), resist, and addcommonaimlines.
As it stands I've just copy-pasted these methods into my own file

Hi, I think there's much simpler, these functions are just there to simplify redundant code, but they just add properties into the array. Once the array is complete, at the end of the code it just adds everything to data.raw, so you can access it as-is. For example:

local bettercargo = table.deepcopy(data.raw["car"]["cargo-plane"])
--it copies the entirety of the plane into the array
--then you can simply change the parameters you want different
bettercargo.name = "bettercargo"
bettercargo.braking_power = "650kW"
bettercargo.friction = 0.060
bettercargo.animation.layers[1].tint = {0.5,0.5,0.5,1}
bettercargo.resistances[1].decrease = 6

--and add that to data, as a modified copy called bettercargo
data:extend({ bettercargo })

2 years ago
(updated 2 years ago)

.

2 years ago

Thanks. I'll look into this tonight :)
Didn't realize you could affect nested objects like that.

2 years ago

Since the mod has Aircraft in its dependencies, your data.lua will load after Aircraft's, which means the original plane will already be in data.raw

2 years ago

Ye, I got that part. It was specifically the bettercargo.animation.layers<...> and bettercargo.resistances etc.. that I didn't realize I could directly alter without completely replacing the struct.

2 years ago

in the end, prototypes are just big arrays of arrays :D
You just gotta be carful to not try to access something in a parent that doesn't exist. For example, xxx.yyyy.ttt = 0.6, if yyyy doesn't exist it will crash. So you sometimes have to make checks.
if xxx.yyyy then
__xxx.yyyy.ttt = 0.6
end

2 years ago
(updated 2 years ago)

I've now updated the mod. The thumbnail icon is unchanged, but all other art assets were updated. I literally just copied your(?) new Cargo plane sprites and icons and changed the colour with a website I found online - I hope that's okay :s

2 years ago

Hi ! I've just done a pull request ! I was waiting for you to make your changes to the repo to avoid conflicts.

2 years ago

Thanks man, appreciate it a lot!

New response