[MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Topics and discussion about specific mods
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.x] AmmoBox 0.2.1

Post by Afforess »

callmewoof wrote:I appreciate the mod! I was wondering though after looking at the files, is there a reason it needs to be so complicated? Like, what's with the logger stuff? Isn't the principal of requesters built into the base game? I know it isn't literally that simple, but in the end an object is just saying "hey I have 1 requester slot, FYI". I hope that doesn't sound rude, I mean the mod works and again thanks, but what's the hurdle from it being much simpler? I'm sure I'm missing something, probably obvious, so I appreciate if you/anyone can answer. Thanks!
The main reason for complexity is that you can't have an entity act as two different types (gun turret and logistics container). So what happens instead is that when you place it, a hidden logistics chest is placed on half the space and the turret checks it to find ammo. in addition, some extra complexity is introduced due to the lack of any way for mods to tell when a player right clicks on an entity. I think there are definitely places the code could be simplified in some places, because this was my first "real" mod, and I wasn't super-familiar with lua or the API when I wrote it. The logging code is simply for debugging, and also was written for 0.11 before there was a good way to append to files... Again, it could be greatly simplified now.

As it states on the readme in Github, I'm open to contributions if you want to attack the code and fix or clean up things.

callmewoof
Inserter
Inserter
Posts: 27
Joined: Fri Apr 24, 2015 3:46 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by callmewoof »

Thank you so much for your answer! It makes a lot more sense now. I don't think I'd be able to tweak or improve it though. Too bad the game has limitations like that, but I suppose that's hard-coded and simply the design choice they went with. Oh well!

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Afforess »

callmewoof wrote:Thank you so much for your answer! It makes a lot more sense now. I don't think I'd be able to tweak or improve it though. Too bad the game has limitations like that, but I suppose that's hard-coded and simply the design choice they went with. Oh well!
Glad it makes sense, and I wasn't the one to come up with the "hidden entity" trick, I believe TreeFarm was the first mod I saw using it, but there may be even older mods that did it.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by kiba »

Don't think it's a design choice, but rather that the developers hadn't gotten around to it yet.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Afforess »

kiba wrote:Don't think it's a design choice, but rather that the developers hadn't gotten around to it yet.
I am not sure. I've talked with rseding in IRC ages ago, and I don't think there is going to be a way for modders to ever create new "types" of entities, because the entity types are backed by a C++ class, which obviously modders don't have control over. Having an entity with multiple types likely is a similar problem, I haven't see the source code, but from the API docs, it seems that the developers went the OOP inheritance model for entities, and multiple inheritance is generally regarded as evil.

Again, I can't see the source code, but it is possible to make reasoned speculation based on the API documentation, and it does not seem like the game was designed to allow multiple entity types.

User avatar
MtnDew
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sun Aug 02, 2015 3:29 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by MtnDew »

Added to an existing save with Dytech and it seems your research for the turret 1 is the same name as his and seems to be overridden in the research tree. Can't research it so you can't ever get it. I can see it on filters and so forth but just can't research it. Unless you are planning on making turrets 2 etc. Then might I suggest an alternative name like logistics turret or something.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Afforess »

MtnDew wrote:Added to an existing save with Dytech and it seems your research for the turret 1 is the same name as his and seems to be overridden in the research tree. Can't research it so you can't ever get it. I can see it on filters and so forth but just can't research it. Unless you are planning on making turrets 2 etc. Then might I suggest an alternative name like logistics turret or something.
Yeah, I just checked and both the recipe and the tech having naming collisions. AmmoBox loads first, (A loads before D) and then Dytech overrides my recipe & tech definition.

I will release a new version that fixes the naming collisions this weekend. It's not straightforward because I will probably have to rename everything to avoid this. I have to check if a gun-turrets-2 already exists and make sure it unlocks my recipe, and also prefix the recipe and entity with 'ammobox-' so to prevent the collisions and this issue from cropping up again.

User avatar
Buggi
Fast Inserter
Fast Inserter
Posts: 100
Joined: Wed May 27, 2015 6:23 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Buggi »

So the devs went with Objects instead of interfaces for different types of entites?

Sigh...

With interfaces you could have entities have the functionality of many different types of things.

So like,
class LogicTurret : ILogisticContainer, ITurret

In LUA you could add a hook for item types and expand on it with "Functionality" flags. The code could read the LUA entity definition item ID as well as functionality ID's and ensure the game manages the different features accordingly.

like this:

Code: Select all

data:extend(
{
  {
    type = 'ammo-turret',
    name = 'logic-turret',
    functions = 'turret, logicContainer,circuitNetwork',
    .....
}
Then the game would see the flags, know what settings to look for, and what functionality to implement.

Just a thought.
- Buggi -
Here's my Humble YouTube channel: https://www.youtube.com/c/FlexibleGames

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Afforess »

Buggi wrote:So the devs went with Objects instead of interfaces for different types of entites?

Sigh...

With interfaces you could have entities have the functionality of many different types of things.

So like,
class LogicTurret : ILogisticContainer, ITurret

In LUA you could add a hook for item types and expand on it with "Functionality" flags. The code could read the LUA entity definition item ID as well as functionality ID's and ensure the game manages the different features accordingly.

like this:

Code: Select all

data:extend(
{
  {
    type = 'ammo-turret',
    name = 'logic-turret',
    functions = 'turret, logicContainer,circuitNetwork',
    .....
}
Then the game would see the flags, know what settings to look for, and what functionality to implement.

Just a thought.
I agree, I've suggested as much before, and the Factorio devs explained that changing the entity system in such a fundamental way at this late stage is a non-starter. At this point I am just working within the framework we have.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by kiba »

Afforess wrote:
Buggi wrote:So the devs went with Objects instead of interfaces for different types of entites?

Sigh...

With interfaces you could have entities have the functionality of many different types of things.

So like,
class LogicTurret : ILogisticContainer, ITurret

In LUA you could add a hook for item types and expand on it with "Functionality" flags. The code could read the LUA entity definition item ID as well as functionality ID's and ensure the game manages the different features accordingly.

like this:

Code: Select all

data:extend(
{
  {
    type = 'ammo-turret',
    name = 'logic-turret',
    functions = 'turret, logicContainer,circuitNetwork',
    .....
}
Then the game would see the flags, know what settings to look for, and what functionality to implement.

Just a thought.
I agree, I've suggested as much before, and the Factorio devs explained that changing the entity system in such a fundamental way at this late stage is a non-starter. At this point I am just working within the framework we have.
Technical debt...it sucks.

Does this mod works with bob's mod?

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.2.1 - Fun with Turrets & Logistics

Post by Afforess »

kiba wrote: Technical debt...it sucks.

Does this mod works with bob's mod?
I haven't tried, but I think I will test it after I make the changes to make it compatible with Dytech.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Afforess »

MtnDew wrote:Added to an existing save with Dytech and it seems your research for the turret 1 is the same name as his and seems to be overridden in the research tree. Can't research it so you can't ever get it. I can see it on filters and so forth but just can't research it. Unless you are planning on making turrets 2 etc. Then might I suggest an alternative name like logistics turret or something.
I just released AmmoBox 0.3.0 which should fix the compatibility with Dytech. Let me know if you encounter more incompatibilities or other bugs.

Jelgadis
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Feb 23, 2016 8:53 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Jelgadis »

this mod + addon are Awesome!!
can you add 1 more turret codes with hidden recipe to expand please? (ammobox-gun-turret-3 or ammobox-some-turret something like this...)

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Afforess »

Jelgadis wrote: can you add 1 more turret codes with hidden recipe to expand please? (ammobox-gun-turret-3 or ammobox-some-turret something like this...)
I'm not really sure what you are asking for... expand what?

Jelgadis
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Feb 23, 2016 8:53 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Jelgadis »

Afforess wrote:
Jelgadis wrote: can you add 1 more turret codes with hidden recipe to expand please? (ammobox-gun-turret-3 or ammobox-some-turret something like this...)
I'm not really sure what you are asking for... expand what?
first, sorry for my bad english.

I wanna add more ammobox-turrets.. MK3.. MK4..etc

but I don't have good skill for codes.

If you add 1 more turret code in this mod, maybe I can handle it.

can you do it for me please?

User avatar
jockeril
Filter Inserter
Filter Inserter
Posts: 361
Joined: Sun Feb 08, 2015 11:04 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by jockeril »

not only am I excited to try this out - I'v also decided to contribute a Hebrew translation for it ! :D
[request] RTL support please

My mods

Formally Hebrew translator for FARL & EvoGUI mods

join me on
- Twitter[@jockeril],
- Twitch.tv/jockeril,
- Youtube/jocker-il (or JoCKeR-iL)
- and steam !
Image

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Afforess »

jockeril wrote:not only am I excited to try this out - I'v also decided to contribute a Hebrew translation for it ! :D
Fantastic! I'll take a look and get it included in a new release. :D

User avatar
Bl4ckmail
Inserter
Inserter
Posts: 29
Joined: Sun Aug 16, 2015 10:31 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Bl4ckmail »

Lol i never saw your mod before and decided to make aLogistic turrets mod myself and uploaded it yesterday. And now i get to see this post.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by Afforess »

Bl4ckmail wrote:Lol i never saw your mod before and decided to make aLogistic turrets mod myself and uploaded it yesterday. And now i get to see this post.
:lol: You might want to take a look at how I made the logistics container invisible, and the turret in-operable. It's a bit more polished that way.

If you want to build off this mod and have your mod add new gun turret types (e.g sniper?), that would also be cool. I don't really have any plans to expand this mod, I'm happy with the way it works now.

thurak126
Burner Inserter
Burner Inserter
Posts: 15
Joined: Mon Dec 08, 2014 11:39 am
Contact:

Re: [MOD 0.12.11+] AmmoBox 0.3.0 - Fun with Turrets & Logistics

Post by thurak126 »

One thing I have noticed is that the Gun Turret Mk2 does not remember its logistic requested items in blueprints, in 0.12.27 anyway, not tested in previous versions. Also do you have any plans for other types of x100 ammo, or just bullets and flamethrowers?

Post Reply

Return to “Mods”