Simple Questions and Short Answers

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Honktown
Smart Inserter
Smart Inserter
Posts: 1045
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Simple Questions and Short Answers

Post by Honktown »

Pi-C wrote: Sat Feb 29, 2020 4:37 pm I've an entity based on the flamethrower. I want it to be able to use one of two possible fluids (exchanging fluids works once the fluidbox has been emptied). To make things both complicated: the two fluids look differently (so I've recolored the stream graphics for one of them) and do different damage. Is it possible to set different streams in the prototype, so that the one matching fluid A will be used if the turret contains fluid A, and the other one if it contains fluid B?

I guess I could do some trickery in the control stage (replacing entities depending on its contents), but it would be much cheaper if I could do everything with just one prototype.
Going by the wiki the only potential modification is damage:
https://wiki.factorio.com/Types/StreamAttackParameters

An experiment would be if liquids can be used as an ammo category, then the projectile effect would belong to the liquid ammo. The turret would effectively be a gun turret that gets ammo from fluidboxes. Would be simple with "fluid" as items (like flamethrower ammo), but combining ammo and fluidboxes? Unsure.

An easier control effect is possible if a gun-turret can have a fluidbox: if there's fluid the turret can fire, take it out of the fluidbox and insert the fake liquid ammo (if matching fluid or empty.... don't over-fill.... etc)
I have mods! I guess!
Link
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Simple Questions and Short Answers

Post by Pi-C »

Honktown wrote: Sat Feb 29, 2020 5:15 pm An experiment would be if liquids can be used as an ammo category, then the projectile effect would belong to the liquid ammo. The turret would effectively be a gun turret that gets ammo from fluidboxes. Would be simple with "fluid" as items (like flamethrower ammo), but combining ammo and fluidboxes? Unsure.

An easier control effect is possible if a gun-turret can have a fluidbox: if there's fluid the turret can fire, take it out of the fluidbox and insert the fake liquid ammo (if matching fluid or empty.... don't over-fill.... etc)
I think you've got me wrong. I don't want to mix fluid and solid ammo. It's about water turrets that are able to shoot either water or steam (obviously, the fluidbox must have been cleared before one can switch ammo). It would be nice if the steam stream would be automatically picked if the turret contains steam, and the water stream otherwise. But I guess I'll go with replacing entities (perhaps in on_entity_damaged -- could be a bit late because a wrong stream could already have been released when a target is hit, shouldn't be too important, though.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Honktown
Smart Inserter
Smart Inserter
Posts: 1045
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Simple Questions and Short Answers

Post by Honktown »

Pi-C wrote: Sat Feb 29, 2020 5:28 pm ...
I understood what the goal was, but I didn't think it was doable (besides the control change). In my mind, replacing the entities might take a lot of performance, but I could be wrong. Good luck!
I have mods! I guess!
Link
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

I cannot find the infinity underground belt or a auto loader to a belt in the /editor - how to?
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Simple Questions and Short Answers

Post by disentius »

They are under the question mark icon.
editor menu.png
editor menu.png (236.49 KiB) Viewed 5118 times
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

disentius wrote: Sun Mar 01, 2020 11:12 am They are under the question mark icon.

editor menu.png
The loader yes - but the underground belt not - and also the possibility to empty a belt to a "infinity" box without the use of a inserter - is this probably a mod?
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Simple Questions and Short Answers

Post by disentius »

I am not sure what you mean by "underground belt"...
Loaders/unloaders are on the belt tab, infinity chests and pipes are on the question mark tab. You kan use the infinity chests/pipes for both loading and unloading.

Here is an example setup for use(paste in editor mode). What are you missing?
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

disentius wrote: Sun Mar 01, 2020 1:04 pm I am not sure what you mean by "underground belt"...
Loaders/unloaders are on the belt tab, infinity chests and pipes are on the question mark tab. You kan use the infinity chests/pipes for both loading and unloading.

Here is an example setup for use(paste in editor mode). What are you missing?
Yes. Thanks for your kind assistance
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Simple Questions and Short Answers

Post by disentius »

Beer please :D
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

disentius wrote: Sun Mar 01, 2020 1:07 pm Beer please :D
Acutally I saw this loading icon and was looking for it:
Icon.png


you were indeed very helpful as this obvious and simple solution is often not visible - to simple thinking Mac users :-)


So I offer you a free Corona safety net in return for your help _ the tex in German reads:
Stay save against a infection - drink Corona Beer
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Simple Questions and Short Answers

Post by Pi-C »

Regarding entity health:

We can read the health of an entity, and in on_entity_damaged, we can see the final_damage_amount an entity will take at the end of a tick. However, there seems to be no way to find out the health of that entity before this damage.

The Lua-API description has this to say about the health property:
Health of the entity. Setting health to less than 0 will set health to 0, entities with 0 health can not be attacked. Setting health to higher than max health will set health to max health.
What does that mean? Will it be possible that health has a negative value while on_entity_damaged is still running? I want to know this to implement damage-immunity without additional healing.

Say, a unit that should be immune to my turret's damage has taken damage from it. One way to restore its health is to add final_damage_amount to health. However, this wouldn't work (it would restore more health than damage done) if health_before_damage - final_damage_amount < 0, but health was automatically set to 0.

Another way I could imagine would be to set event.final_damage_amount to 0 -- but will that work, or has the damage already been applied when the event script is called, so that health_in_event = health_before_damage - final_damage_amount?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

When I try to place the loader (second line - right loader) he offsets a few pixels to the left and cannot connect to the box - pls help
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Simple Questions and Short Answers

Post by disentius »

Thanks for the beer:)
If you look closely, you will see one end has a belt extension.
Connect that one to the belt and reverse direction of loader with "r"
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

disentius wrote: Sun Mar 01, 2020 6:13 pm Thanks for the beer:)
If you look closely, you will see one end has a belt extension.
Connect that one to the belt and reverse direction of loader with "r"
Have one more "Corona" on me :D
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Simple Questions and Short Answers

Post by eradicator »

Pi-C wrote: Sun Mar 01, 2020 4:00 pm in on_entity_damaged [...] there seems to be no way to find out the health of that entity before this damage.
Correct. What you want is not supported by the engine. There've been several threads about it in the past.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Honktown
Smart Inserter
Smart Inserter
Posts: 1045
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Simple Questions and Short Answers

Post by Honktown »

brunzenstein wrote: Sun Mar 01, 2020 6:10 pm When I try to place the loader (second line - right loader) he offsets a few pixels to the left and cannot connect to the box - pls help
The loader is backwards. When loaders are placed, R shifts their in-out direction, but shift-R I think actually flips them around. When you go to place them, R actually flips the entity around, but I think most mods add "snapping" code so that when it gets placed, it figures in/out and picks a direction.
I have mods! I guess!
Link
Pi-C
Smart Inserter
Smart Inserter
Posts: 1742
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Simple Questions and Short Answers

Post by Pi-C »

I've some trouble with surface.find_entities_filtered. How exactly does it work? I've used it with position, radius, and direction, and I expected this would look for entities in a segment (determined by "direction") of a circle with the given radius around position. However, I run this search on_tick
Just during testing, of course! Will be changed to more sane values later on.
, the area should be quite large (radius = 50), and I see entities in the area. Could it be that the search is performed just along a line (length == radius) in the given direction, not in an area at all?

EDIT: Indeed that was the reason: as soon as I removed "direction", entities were found. The description isn't really clear about direction and position+radius being exclusive:
If no area and no position are given, then the entire surface is searched. If both area and position are specified, returns only entities matching the position. If position and radius are given, returns only entities within that radius of the position.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

How do I convert a sandbox save to a normal playable one?
How do I drive a Locomotive when in sandbox?
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Simple Questions and Short Answers

Post by brunzenstein »

brunzenstein wrote: Thu Mar 05, 2020 8:05 pm How do I convert a sandbox save to a normal playable one?
How do I drive a Locomotive manually when in sandbox?
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2413
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Simple Questions and Short Answers

Post by Jap2.0 »

brunzenstein wrote: Thu Mar 05, 2020 8:05 pm How do I drive a Locomotive when in sandbox?
You should be able to hover over it with the mouse and press enter (or whatever you use to get into a locomotive).
Not sure on the second one; the only thing I can think of is manually undoing all of its effects via console, eg. /c game.player.create_character() to spawn a character (wiki).
There are 10 types of people: those who get this joke and those who don't.
Post Reply

Return to “Gameplay Help”