Creating Assembly machine with integrated Electric pole
Re: Creating Assembly machine with integrated Electric pole
Thanks Julius
I was ready to update my mod with the german translation you provided, and a different thumbnail... but I don't see any button on mods.factorio.com to upload the next version.... Am I blind ? Should I upload it as a new mod ?
I was ready to update my mod with the german translation you provided, and a different thumbnail... but I don't see any button on mods.factorio.com to upload the next version.... Am I blind ? Should I upload it as a new mod ?
Re: Creating Assembly machine with integrated Electric pole
I have spotted an error that generates a crash (on_entity_died, I though it would be the same as on_entity_mine, but there is no "player_index")
It's corrected on my side, but I must update my released mod.
For now, I just marked it as depreciated
It's corrected on my side, but I must update my released mod.
For now, I just marked it as depreciated
-
- Inserter
- Posts: 34
- Joined: Sun Dec 17, 2017 8:33 pm
- Contact:
Re: Creating Assembly machine with integrated Electric pole
For updating a Mod click on 'my mods' select your mod, go to 'downloads' and click edit
Re: Creating Assembly machine with integrated Electric pole
Thank you againjulius1701 wrote: ↑Tue Oct 29, 2019 9:29 am For updating a Mod click on 'my mods' select your mod, go to 'downloads' and click edit
-
- Inserter
- Posts: 34
- Joined: Sun Dec 17, 2017 8:33 pm
- Contact:
Re: Creating Assembly machine with integrated Electric pole
Just ask if you need help
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Creating Assembly machine with integrated Electric pole
regarding viewtopic.php?p=463562#p463562
1a) You can't.
1b) You can't.
1c) You can't.
Basically the overlay image "build preview" shown in the mouse cursor before building anything is not part of the game state and so mods have no control over it whatsoever. The only way you can change it is by hacking around with proxy-placement items like you already do.
Not sure if any of the events is early enough to fetch the info you'd need in a fast_replaceable_group scenario.
For the "pole graphic should be above machine" you can simply position the pole 1/256's tile south of the assembling machine.
2) Don't fucking drop stacks. I think it's the worst mechanic in the game and won't have any part in it. Items on the floor have shitty visibility and can contaminate belts etcpp. It's a mess. You should put excess items directly into the players inventory and fail if it's full. Use LuaInventory.can_insert().
For wire selectability you can make the fake pole selection_priority = 51. Assembling machines can not have wire connections.
1a) You can't.
1b) You can't.
1c) You can't.
Basically the overlay image "build preview" shown in the mouse cursor before building anything is not part of the game state and so mods have no control over it whatsoever. The only way you can change it is by hacking around with proxy-placement items like you already do.
Not sure if any of the events is early enough to fetch the info you'd need in a fast_replaceable_group scenario.
For the "pole graphic should be above machine" you can simply position the pole 1/256's tile south of the assembling machine.
2) Don't fucking drop stacks. I think it's the worst mechanic in the game and won't have any part in it. Items on the floor have shitty visibility and can contaminate belts etcpp. It's a mess. You should put excess items directly into the players inventory and fail if it's full. Use LuaInventory.can_insert().
For wire selectability you can make the fake pole selection_priority = 51. Assembling machines can not have wire connections.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Creating Assembly machine with integrated Electric pole
. If it's really not manageable, this will always suck in my mod1a) You can't.
1b) You can't.
1c) You can't.
I remember you told so and I tried. but "position.x-0.1" doesn't work, it's concidered as "position.x-1"For the "pole graphic should be above machine" you can simply position the pole 1/256's tile south of the assembling machine.
moreover, it doesn't look necessary anymore
This is the current behaviour.2) Don't fucking drop stacks. I think it's the worst mechanic in the game and won't have any part in it. Items on the floor have shitty visibility and can contaminate belts etcpp. It's a mess. You should put excess items directly into the players inventory and fail if it's full. Use LuaInventory.can_insert().
But regarding how pissed you are with this feature, and concidering how much you helped, I will put this "don't drop on floor" as an option in mod settings .
«Nothing is lost, everything is transformed, except if this option is checked » ^^
I will check thatFor wire selectability you can make the fake pole selection_priority = 51. Assembling machines can not have wire connections.
I have an additional question:
Where can I put that, so my tables are initialized early enough to be modified by other mods, and still accessible in control.lua?
(I will provide a better function to feed those tables)
Code: Select all
local correspondancyTableMachineToProxy={}
local correspondancyTableProxyToMachine={}
local function initCorrespondancyTables()
correspondancyTableMachineToProxy={}
correspondancyTableMachineToProxy["assembling-machine-1"]="proxy-assembling-machine-pole-1"
correspondancyTableMachineToProxy["assembling-machine-2"]="proxy-assembling-machine-pole-2"
correspondancyTableMachineToProxy["assembling-machine-3"]="proxy-assembling-machine-pole-3"
correspondancyTableProxyToMachine={}
correspondancyTableProxyToMachine["proxy-assembling-machine-pole-1"]="assembling-machine-1"
correspondancyTableProxyToMachine["proxy-assembling-machine-pole-2"]="assembling-machine-2"
correspondancyTableProxyToMachine["proxy-assembling-machine-pole-3"]="assembling-machine-3"
end
Thank you !
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Creating Assembly machine with integrated Electric pole
The "click a pole to upgrade in place" is an interesting idea, but yea. Mod api support is limited and simply adding crafting recipes to make pre-combined items is much easier.
South is "position.y+1/256" not x minus. Factorio uses screen coordinates where top is negative y.
Control stage is not a shared state like data/settings. If you want to allow other mods to add more combinations you'll have to use remote.add_interface() to expose access to the corresponding functions.
South is "position.y+1/256" not x minus. Factorio uses screen coordinates where top is negative y.
Control stage is not a shared state like data/settings. If you want to allow other mods to add more combinations you'll have to use remote.add_interface() to expose access to the corresponding functions.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Creating Assembly machine with integrated Electric pole
It would have been uncomplete without this feature. I'm happy that both mecanismes work fine... to bad it's not reflected on-mouse_over, but it's not a blocking issueeradicator wrote: ↑Tue Oct 29, 2019 5:03 pm The "click a pole to upgrade in place" is an interesting idea, but yea. Mod api support is limited and simply adding crafting recipes to make pre-combined items is much easier.
correct. but it's the same for x and y, at least when using it in "surface.create_entity({name = newMachineName, position = position, ...}"eradicator wrote: ↑Tue Oct 29, 2019 5:03 pmSouth is "position.y+1/256" not x minus. Factorio uses screen coordinates where top is negative y.
but earlier I have seen something about that : https://lua-api.factorio.com/latest/Con ... oundingBox
Position VS chunkPosition VS TilePosition.
TilePosition uses the same format as Position except it rounds any x/y down to whole numbers. I guess create_entity expect a TilePosition in parameter "position".
ok, thankseradicator wrote: ↑Tue Oct 29, 2019 5:03 pm Control stage is not a shared state like data/settings. If you want to allow other mods to add more combinations you'll have to use remote.add_interface() to expose access to the corresponding functions.
Re: Creating Assembly machine with integrated Electric pole
Create entity uses position. Entities may be grid aligned, meaning that they are placed either at integer or .5 coordinates (depending on entity size). Entities may be non-grid aligned, meaning that they are placed exactly where you put them. Examples for grid aligned entities: Assemblers, belts, power poles. Examples for non-grid aligned entities: Trees, landmines, cars. You can change whether an entity is grid aligned using the "placeable-off-grid" entity prototype flag.Alex33 wrote: ↑Tue Oct 29, 2019 5:26 pm but earlier I have seen something about that : https://lua-api.factorio.com/latest/Con ... oundingBox
Position VS chunkPosition VS TilePosition.
TilePosition uses the same format as Position except it rounds any x/y down to whole numbers. I guess create_entity expect a TilePosition in parameter "position".
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Creating Assembly machine with integrated Electric pole
Ok, thanks youBilka wrote: ↑Tue Oct 29, 2019 5:43 pmCreate entity uses position. Entities may be grid aligned, meaning that they are placed either at integer or .5 coordinates (depending on entity size). Entities may be non-grid aligned, meaning that they are placed exactly where you put them. Examples for grid aligned entities: Assemblers, belts, power poles. Examples for non-grid aligned entities: Trees, landmines, cars. You can change whether an entity is grid aligned using the "placeable-off-grid" entity prototype flag.Alex33 wrote: ↑Tue Oct 29, 2019 5:26 pm but earlier I have seen something about that : https://lua-api.factorio.com/latest/Con ... oundingBox
Position VS chunkPosition VS TilePosition.
TilePosition uses the same format as Position except it rounds any x/y down to whole numbers. I guess create_entity expect a TilePosition in parameter "position".
Actually, Eradicator already mentioned the "placeable-off-grid" flag, and I tried to apply it, unsuccessfully. it worked when positioning the pylon alone or the proxy, but not when applying the pylon on existing machine, using my current mecanisme.
Anyway, I trust your judgment/knowledge, I made a mistake somewhere.
As another modification made it unnecessary and I stopped investigation, but maybe I will have to come back to it to extend the mod for the [2x2] entities.
I'm currently investigating about blueprint usage:
here is an unconvenient notice on (defines.events.)on_player_setup_blueprint, property mapping:
When player creates a blueprint, the proxy is not recognized (probably because the pylon is not selectable), so only the assembling machine is registered in event.mapping. I wanted to edit this mapping: for each assembling-machine, check if it's paired with a pylon, and if it is, change the registered entity.name. (defines.events.on_player_setup_blueprint,UpdateBlueprint).mapping :: LazyLoadedValue (dictionary uint → LuaEntity): The blueprint entity index to source entity mapping. Note: if any mod changes the blueprint this will be incorrect.
it went well until the replace name part.
In case you think it's still manageable despite the warning, let me know, I can show you my tests...
otherwise, what do you think can be done to manage proxys in blueprints ? Is there a way to create and store some tables "LazyLoadedValue" (1 table per blueprint that contains proxy), and to retrieve it later, event if the player loads a saved game?
As usual, thank you very much !
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Creating Assembly machine with integrated Electric pole
Actually i assumed that you don't need to manipulate blueprints. And why is the *proxy* even in a blueprint. And how does the player attach wires if the pole isn't selectable? Maybe i'm missing something
My assumption:
Proxy item is used to build real_asm + real_pole.
When player creates uses bp tool they get a bp that contains real_asm + real_pole.
Pole connections and recipe are thus automatically stored in bp.
Bots can then build both of them as they see fit, or you can make only the real_asm buildable and call .revive() on the pole in on_robot_built.
You'd only have to handle removal of ghosts (by mining or deconstruction) and make sure that removal of real_asm or real_pole ghost also removes it's counterpart.
My assumption:
Proxy item is used to build real_asm + real_pole.
When player creates uses bp tool they get a bp that contains real_asm + real_pole.
Pole connections and recipe are thus automatically stored in bp.
Bots can then build both of them as they see fit, or you can make only the real_asm buildable and call .revive() on the pole in on_robot_built.
You'd only have to handle removal of ghosts (by mining or deconstruction) and make sure that removal of real_asm or real_pole ghost also removes it's counterpart.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Creating Assembly machine with integrated Electric pole
The proxy currently not in the blueprint, there is only the machine.eradicator wrote: ↑Wed Oct 30, 2019 5:15 pm Actually i assumed that you don't need to manipulate blueprints. And why is the *proxy* even in a blueprint.
I wanted to replace it by the proxy, so it's handled as a "build_proxy" feature by robots, with the actual build_proxy mechanisme
You're not missing anything... currently the player can't attach wires to the pole... it's one done automatically when placing it near an existing pole, or by adding an electric pole near it.eradicator wrote: ↑Wed Oct 30, 2019 5:15 pm And how does the player attach wires if the pole isn't selectable? Maybe i'm missing something
I will try to manage regarding your assumption, and check what happens if pole is selectable. I fear it will piss people off (including me) when they try to select the assembling machine, but hit the pole instead...
Then, I will try to manage blueprints as you explained.
Thank you Eradicator