[MOD 0.11.x][WIP] Sensors 0.0.5

Topics and discussion about specific mods
Post Reply
gnz
Inserter
Inserter
Posts: 46
Joined: Wed Jan 14, 2015 5:19 pm
Contact:

[MOD 0.11.x][WIP] Sensors 0.0.5

Post by gnz »

This mod is supposed to add a couple of more sensors for the network, but at the moment it only adds a sensor for rails.

Sensors

Rail sensor

Note: These are enabled by default for now, will add research at a later stage. Graphics are only placeholders for now.

Rail sensors works by placing a new straight rail anywhere you want the sensor to be. When a wagon is on top of it then it will change the content to everything that is in the wagon plus that entity. For example, if a locomotive is on top of it with 23 coal for fuel then it will be filled with 1 x Locomotive and 23 x Coal.

In addition to the items in the wagon there are also two meta items: Speed and Loaded amount. The Speed is a rough multiplication of the internal speed number with an item count of 0 to 1000. If you are using another mod that allows for quicker trains then this is likely larger but I have not tested this at all. The Loaded amount is a percentage amount [0,100] of how full stacks are. Therefore if you have a wagon that is filled with one item of twenty different types then it will report it as not very full at all but it would not be possible to add another item in to it.

There are three types of rail sensors at the moment: Only for moving trains, standing trains and either situation.

Darkness sensor

Note: only placeholder graphics for now and no technology

A sensor that when connected will show a meta item amount of [0,100] where 100 is completely dark. At midnight the level of darkness is 0.85 so that is in reality the maximum value.

Actuators

Electrical actuator

Note: Placeholder graphics and no technology

The electrical actuator will either connect or disconnect the wires to it's neighbours based on the logic network conditions you set on it.

Download link
Changelog
Last edited by gnz on Tue Feb 10, 2015 10:06 pm, edited 3 times in total.

dee-
Filter Inserter
Filter Inserter
Posts: 415
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by dee- »

I gave it a quick test before hopping to bed :)

It detected the train passing over it, sent the signal over the red wire to a remote smart inserter which was told to transfer items from one box into another if more than 1 wood (the fuel) is detected. And the second the locomotive drove over the rail the inserter did his thing. Amazing :P The train's contents also showed up in the alt-view above the rail.

I think it's a good idea to also report the locomotive/wagon itself as then the rail can be used to detect if something is over on it, even when empty. That's something I haven't thought about but like.

The wires are not lined up with the smart chest, they're a bit off to the left side.
When a train is on the rail that sensor line is also above the train. I don't think there's something that can be done about it, and it's not an issue, at least for me.

Untested:
- grabbing items from or putting items into the smart chest in the rail -> okay, can't grab or insert to the smart chest
- can two wagons be on it at the same time (how wide is the "detector") -> okay, no they can't
- placing/removing by drones
- blueprinting
- multiplayer

Questions:
- do you think it would make more sense to detect items from trains/wagons that are a) standing or b) moving?
- should it also need electricity?
- what is the smart chest for? It can be forged separately but is invisible. It's also not needed by the smart rail recipe -> ah, okay, I see you changed the recipes

Oh and I liked you code style, all those log statements made me feel warm all over :D

gnz
Inserter
Inserter
Posts: 46
Joined: Wed Jan 14, 2015 5:19 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by gnz »

dee- wrote:I gave it a quick test before hopping to bed :)

It detected the train passing over it, sent the signal over the red wire to a remote smart inserter which was told to transfer items from one box into another if more than 1 wood (the fuel) is detected. And the second the locomotive drove over the rail the inserter did his thing. Amazing :P The train's contents also showed up in the alt-view above the rail.

I think it's a good idea to also report the locomotive/wagon itself as then the rail can be used to detect if something is over on it, even when empty. That's something I haven't thought about but like.

The wires are not lined up with the smart chest, they're a bit off to the left side.
When a train is on the rail that sensor line is also above the train. I don't think there's something that can be done about it, and it's not an issue, at least for me.

Untested:
- grabbing items from or putting items into the smart chest in the rail -> okay, can't grab or insert to the smart chest
- can two wagons be on it at the same time (how wide is the "detector") -> okay, no they can't
- placing/removing by drones
- blueprinting
- multiplayer

Questions:
- do you think it would make more sense to detect items from trains/wagons that are a) standing or b) moving?
- should it also need electricity?
- what is the smart chest for? It can be forged separately but is invisible. It's also not needed by the smart rail recipe -> ah, okay, I see you changed the recipes

Oh and I liked you code style, all those log statements made me feel warm all over :D
Thanks for testing!

I haven't gotten around to do graphics yet but once I do then I'll line up the wires properly. I'll probably do a round disk where the sensor ( ie. Chest ) is and a pole beside the rail.

I pushed some small changes to the GitHub repository where I removed the craftable proxy chest and added localisation strings. Probably should have done that as 0.0.2 release but if you're keen you can download that.

I intentionally made the sensor inoperable so that it doesn't act as a cloning box, but as you said you can hover over it and you'll see the content. Perhaps adding a meta item for train speed will allow you to do rules based on if the train is stopped or not? Some train speed item that isn't there for stopped trains and speed*100 items when moving? Not sure what it be used for though but I guess someone might find a use.

I don't think it should take electricity, mostly because it be a pain to do but also because a sensor is relatively passive so no work is being done.

The sensor radius is roughly the rail square so it will detect what is above that. I believe you can link them but I should play more with logic networks myself.

I'm not sure if this will work with construction robots, should probably test that myself. I see no reason why it wouldn't work in multiplayer.

Thanks for the compliment about the code. I tried to do it OOP since I have a couple of other sensors in mind.

dee-
Filter Inserter
Filter Inserter
Posts: 415
Joined: Mon Jan 19, 2015 9:21 am
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by dee- »

Hi there :)

I'm not sure about the "speed item". Inserters can (currently) only react to one item so it would have to be either the desired item or the speed item which to me does not offer much.
Then it would be better to have two separate rails, one that detects only on standing trains/wagons and one also detecting when they move.
But that's also a bit ugly :D

The git is already on my desktop 8-) btw you have the ".git"s in the zip, not sure if intended. Quite handy :lol:

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by Choumiko »

Havent tried it, but i need to compliment the code too, might use parts of it once i get to refactorioing (pun intended :D ) SmartTrains
For robots you should only need to register the onrobotbuiltentity and onrobotpremined events, so the proxys get added/removed

gnz
Inserter
Inserter
Posts: 46
Joined: Wed Jan 14, 2015 5:19 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by gnz »

dee- wrote:Hi there :)

I'm not sure about the "speed item". Inserters can (currently) only react to one item so it would have to be either the desired item or the speed item which to me does not offer much.
Then it would be better to have two separate rails, one that detects only on standing trains/wagons and one also detecting when they move.
But that's also a bit ugly :D

The git is already on my desktop 8-) btw you have the ".git"s in the zip, not sure if intended. Quite handy :lol:
Yes, you're right. I've added them as you suggested now. I might add the speed item anyway though since it probably be nice to be able to have a way to tell if there are trains on the way, or something like that. That is if I can manage to create some other items that could react to the sensors, which I'll probably toy around with this week. If you have any other ideas for sensors then I'm all ears!

Ah, the .git wasn't intended, seems like not particularly needed for most people here. Came from my laziness of structuring but since I'll likely do some artwork then I moved around folders so I can still be lazy. With that said, I would love if everyone here used git as their base for mods since then I could make a script to automatically check for updated mods.

gnz
Inserter
Inserter
Posts: 46
Joined: Wed Jan 14, 2015 5:19 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by gnz »

Choumiko wrote:Havent tried it, but i need to compliment the code too, might use parts of it once i get to refactorioing (pun intended :D ) SmartTrains
For robots you should only need to register the onrobotbuiltentity and onrobotpremined events, so the proxys get added/removed
Feel free! The important part is the class.lua which allows me to subclass things neatly. I really enjoy your SmartTrain mod btw, seems pretty stable now so perhaps you should move it out of WIP so it gets more exposure?

Thanks for the tip about robots, I forgot to put it in in this version so I'll add it in the next couple of days when I add some form of graphics.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by Choumiko »

gnz wrote:I really enjoy your SmartTrain mod btw, seems pretty stable now so perhaps you should move it out of WIP so it gets more exposure?

Thanks for the tip about robots, I forgot to put it in in this version so I'll add it in the next couple of days when I add some form of graphics.
I'd love to move it out of WIP, but i feel i need to clean up the code first and add at least an option/rule "leave station when x blabla" ;) But glad you enjoy it, i haven't used it in a real game yet to be honest, just been imagining features i would like to use (same for FARL) :D

gnz
Inserter
Inserter
Posts: 46
Joined: Wed Jan 14, 2015 5:19 pm
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.1

Post by gnz »

Choumiko wrote:
gnz wrote:I really enjoy your SmartTrain mod btw, seems pretty stable now so perhaps you should move it out of WIP so it gets more exposure?

Thanks for the tip about robots, I forgot to put it in in this version so I'll add it in the next couple of days when I add some form of graphics.
I'd love to move it out of WIP, but i feel i need to clean up the code first and add at least an option/rule "leave station when x blabla" ;) But glad you enjoy it, i haven't used it in a real game yet to be honest, just been imagining features i would like to use (same for FARL) :D
Toting my own horn here a bit, but the reason I made the logistic wagons mod was because it felt like the perfect pairing with SmartTrains. Having a logistic robot construction yard with passive provider chests that run off and fill up when needed is a bliss. I'm a bit tempted to add roboport etc things to it but that feels almost like cheating.

loganb
Inserter
Inserter
Posts: 44
Joined: Mon Jul 25, 2016 3:58 am
Contact:

Re: [MOD 0.11.x][WIP] Sensors 0.0.5

Post by loganb »

Hey, I don't know if this mod is still being developed, but I'd love to play around with this rail sensor. Hope you consider re-releasing this on the new mod portal!

Post Reply

Return to “Mods”