[MOD 0.14] Text Plates
Re: [MOD 0.14] Text Plates
a really nice mod, and nice graphics, and i also like your other mods eg the biomes or the new programmable vehicles (not yet tested myself, but it looks great) ... BUT:
i got a crash when placing "text plates" with a blueprint while i had the "bluebuild" mod installed.
i don't know which of these two mods causes the problem, or maybe both of them together.
that's why i report this to both mods ...
when i tried to place a blueprint with some textplates (and no other items), factorio crashed on me with this Notice:
- Error while running event on_tick (ID 0)
- LuaEntity API call when LuaEntity was invalid.
- stack traceback:
- __Bluebuild__/control.lua:113: in function 'bluebuild'
- __Bluebuild__/control.lua:51: in function 'bluecheck'
- __Bluebuild__/control.lua:36: in function 'playerloop'
- __Bluebuild__/control.lua:198: in function <__Bluebuild__/control.lua:197>
another problem with this mod:
when i have started to enter some text and want to abort placing tiles, i often don't succeed. using "q" is only possible before i have started entering text, and a simple esc doesn't close the GUI and instead gives me the system menu (for load, save, etc).
best method is to place a tile and remove it, so that i am no longer in "text entering mode". is there a better way to abort the gui?
i got a crash when placing "text plates" with a blueprint while i had the "bluebuild" mod installed.
i don't know which of these two mods causes the problem, or maybe both of them together.
that's why i report this to both mods ...
when i tried to place a blueprint with some textplates (and no other items), factorio crashed on me with this Notice:
- Error while running event on_tick (ID 0)
- LuaEntity API call when LuaEntity was invalid.
- stack traceback:
- __Bluebuild__/control.lua:113: in function 'bluebuild'
- __Bluebuild__/control.lua:51: in function 'bluecheck'
- __Bluebuild__/control.lua:36: in function 'playerloop'
- __Bluebuild__/control.lua:198: in function <__Bluebuild__/control.lua:197>
another problem with this mod:
when i have started to enter some text and want to abort placing tiles, i often don't succeed. using "q" is only possible before i have started entering text, and a simple esc doesn't close the GUI and instead gives me the system menu (for load, save, etc).
best method is to place a tile and remove it, so that i am no longer in "text entering mode". is there a better way to abort the gui?
Re: [MOD 0.14] Text Plates
Text plates uses a single item to build any end shape to avoid clogging your inventory, but to do this it swaps an entity with another entity. It looks like bluebuild keeps a reference to the entity but the reference becomes invalid. It should just be a case of adding a entity.valid check before the line that's causing the crash.Anson wrote:a really nice mod, and nice graphics, and i also like your other mods eg the biomes or the new programmable vehicles (not yet tested myself, but it looks great) ... BUT:
i got a crash when placing "text plates" with a blueprint while i had the "bluebuild" mod installed.
i don't know which of these two mods causes the problem, or maybe both of them together.
that's why i report this to both mods ...
when i tried to place a blueprint with some textplates (and no other items), factorio crashed on me with this Notice:
- Error while running event on_tick (ID 0)
- LuaEntity API call when LuaEntity was invalid.
- stack traceback:
- __Bluebuild__/control.lua:113: in function 'bluebuild'
- __Bluebuild__/control.lua:51: in function 'bluecheck'
- __Bluebuild__/control.lua:36: in function 'playerloop'
- __Bluebuild__/control.lua:198: in function <__Bluebuild__/control.lua:197>
another problem with this mod:
when i have started to enter some text and want to abort placing tiles, i often don't succeed. using "q" is only possible before i have started entering text, and a simple esc doesn't close the GUI and instead gives me the system menu (for load, save, etc).
best method is to place a tile and remove it, so that i am no longer in "text entering mode". is there a better way to abort the gui?
The easiest way to escape text entry is just to click somewhere else on the interface, like the background, or anywhere else on the screen for that matter.
Re: [MOD 0.14] Text Plates
that probably hit the bug on its head :-)Earendel wrote:It looks like bluebuild keeps a reference to the entity but the reference becomes invalid. It should just be a case of adding a entity.valid check before the line that's causing the crash.
for another bug report on bluebuild (on the mod portal), its author Mylon wrote:
"Some of my other mods (like concreep) always check if entities are still valid before doing anything"
seems as if those missing checks are a cause for many problems in many mods, and especially in blueprint mods ...
by doing that, text entry is canceled, and i can use WASD to walk, etc, but i still can't use Q to cancel putting down a plate and close the gui. that function of Q is only reenabled after i put a plate down.Earendel wrote:The easiest way to escape text entry is just to click somewhere else on the interface, like the background, or anywhere else on the screen for that matter.
maybe the problem is also related to several functions that all have a keybind to Q, like vanilla "cancel cursor", vanilla "change weapon", and some mods which use Q too, eg to pick an item from inventory when the cursor points to an item on the map, to make the item when the item is not available in the inventory, etc.
anyway, no big problem to quickly leftclick and rightclick someplace to put and remove a plate.
from now on, this mod and nixies will be included on all my maps :-)
Re: [MOD 0.14] Text Plates
the crashing problem with bluebuild seems to be solved now, but there is one more problem when using both mods :
when textplates are placed as ghosts (either as blueprints or by shift-clicking), they appear on the ground with a nice little icon that indicates what the ghost really should be. and when robots build that entity, everything works fine and i get the proper plate.
BUT when the ghost is not built by robots, but by a simple revive in bluebuild, and thus the "normal" on (player) built entity is called, you seem to do all kinds of checks for cursor, replacing the item, etc. while the item is not really built by the player either and thus the last used plate is placed instead for all ghosts.
in this special case, using the same method as on robot built entity would probably give the correct plate, but since i am no lua or factorio programmer, i have no idea how this result can be achieved, either by adding some function to textplates, or by changing the method to create entities from ghosts in bluebuild which currently does a simple revive.
although the problem is not gamebreaking, and also can be avoided relatively easily by temporarily disabling that method to revive ghosts (with a simple hotkey) thus letting only bots do the work, i would be interested in learning how to program properly, and of course i also would like to use both mods without restrictions :-)
when textplates are placed as ghosts (either as blueprints or by shift-clicking), they appear on the ground with a nice little icon that indicates what the ghost really should be. and when robots build that entity, everything works fine and i get the proper plate.
BUT when the ghost is not built by robots, but by a simple revive in bluebuild, and thus the "normal" on (player) built entity is called, you seem to do all kinds of checks for cursor, replacing the item, etc. while the item is not really built by the player either and thus the last used plate is placed instead for all ghosts.
in this special case, using the same method as on robot built entity would probably give the correct plate, but since i am no lua or factorio programmer, i have no idea how this result can be achieved, either by adding some function to textplates, or by changing the method to create entities from ghosts in bluebuild which currently does a simple revive.
although the problem is not gamebreaking, and also can be avoided relatively easily by temporarily disabling that method to revive ghosts (with a simple hotkey) thus letting only bots do the work, i would be interested in learning how to program properly, and of course i also would like to use both mods without restrictions :-)
Re: [MOD 0.14] Text Plates
When a robot or player places an entity an event is fired which allows a script to react to the placement. In this case the reaction is to replace a placeholder plate with a real plate. If a different script places an entity then no event is fired.Anson wrote:the crashing problem with bluebuild seems to be solved now, but there is one more problem when using both mods :
when textplates are placed as ghosts (either as blueprints or by shift-clicking), they appear on the ground with a nice little icon that indicates what the ghost really should be. and when robots build that entity, everything works fine and i get the proper plate.
BUT when the ghost is not built by robots, but by a simple revive in bluebuild, and thus the "normal" on (player) built entity is called, you seem to do all kinds of checks for cursor, replacing the item, etc. while the item is not really built by the player either and thus the last used plate is placed instead for all ghosts.
in this special case, using the same method as on robot built entity would probably give the correct plate, but since i am no lua or factorio programmer, i have no idea how this result can be achieved, either by adding some function to textplates, or by changing the method to create entities from ghosts in bluebuild which currently does a simple revive.
although the problem is not gamebreaking, and also can be avoided relatively easily by temporarily disabling that method to revive ghosts (with a simple hotkey) thus letting only bots do the work, i would be interested in learning how to program properly, and of course i also would like to use both mods without restrictions
Either bluebuild would specifically need to support textplates and do the conversion itself (the intended text plate type is stored as a signal in the placeholder), or bluebuild would need to call and event or remote interface when it places or revives an entity so that other mods can be set up to react to that event, in which case those mods need to be updated too.
I can look into the issue in more detail later but I'm in the middle of a big update for AAI Programmable Vehicles right now.
Re: [MOD 0.14] Text Plates
if no event is fired automatically, maybe the mod that calls revive can also raise an event to cause the same handling that would be done if the ghost would be revived by bots? or is that thought much too simple?Earendel wrote:When a robot or player places an entity an event is fired which allows a script to react to the placement. In this case the reaction is to replace a placeholder plate with a real plate. If a different script places an entity then no event is fired.
Either bluebuild would specifically need to support textplates and do the conversion itself (the intended text plate type is stored as a signal in the placeholder), or bluebuild would need to call and event or remote interface when it places or revives an entity so that other mods can be set up to react to that event, in which case those mods need to be updated too.
hehe, that is the next item on my todo/check/test list ... how to use AAI, maybe even together with logistic trains and several other mods to get some crazy factory with lots of different transporting and mining methods, eg a beltless factory without bots, and doing mining with a different mod on each ore field :-)Earendel wrote:I can look into the issue in more detail later but I'm in the middle of a big update for AAI Programmable Vehicles right now.
AAI might be used for both of these purposes, mining and transporting, maybe even together with roads that are built from special floor tiles (got that idea when i saw the asphalt mod, and the old paved driving assist, etc)
Re: [MOD 0.14] Text Plates
The mod has been updated to version 0.1.13 which supports a custom event api.
Other mods can use the on_event implementation to trigger on_entity_revived on any mods that have implemented the interface on_entity_revived.
I'm attaching an update version of bluebuild's control.lua that is compatible with the implemented interface so bluebuild and textplates work together.
EDIT: Since version 0.1.15 the above is no longer required but will still work if you need it. Triggering on_built_entity normally is sufficient do to some code enhancements to get things working for nanobots.
Code: Select all
--[[
CUSTOM EVENTS USED
on_entity_revived
raise_event implementation: raise_event('on_entity_revived', {entity=LuaEntity, player_index=player.player_index})
on_event implementation: remote.add_interface("mymod", { on_entity_revived = function(data) return myfunction(data.entity, data.player_index) end})
]]--
local function raise_event(event_name, event_data)
local responses = {}
for interface_name, interface_functions in pairs(remote.interfaces) do
if interface_functions[event_name] then
responses[interface_name] = remote.call(interface_name, event_name, event_data)
end
end
return responses
end
I'm attaching an update version of bluebuild's control.lua that is compatible with the implemented interface so bluebuild and textplates work together.
EDIT: Since version 0.1.15 the above is no longer required but will still work if you need it. Triggering on_built_entity normally is sufficient do to some code enhancements to get things working for nanobots.
- Attachments
-
- control.lua
- (9.2 KiB) Downloaded 205 times
Last edited by Earendel on Sun Mar 05, 2017 10:38 pm, edited 2 times in total.
Re: [MOD 0.14] Text Plates
Hi Earendel and Anson, I am working on the update of Creative Mode, and after fixing the error caused by reviving text plates with magic wand, I just realized I hit the same issue of not getting the correct text plates.
After checking your code, I am now thinking: are we doing it wrong? "We" means modders that revive entities by script, including me of corse.
Normally, ghost entities can only be revived by robots. Shouldn't we raise on_robot_built_entity instead of on_built_entity?
Although this will lose the "player_index" parameter and also make "robot" to be nil, they are not really useful for entity revival.
And I have changed it and tested with mods. No problem so far. It solved the issue perfectly.
Ideally, we won't need the additional remote function for this issue.
I will keep an eye on it.
There's the solved issue. Here comes the unsolved one.
Would you mind raising on_built_entity (on_robot_built_entity) for the replacement entities after replacing the text plates that are built by blueprint, Earendel?
More specifically, inserting the following code at line 209 of your control.lua:
In Creative Mode, to increase the mod compatibility of instant blueprint, by giving time to other mods for destroying entities that shouldn't be instant-blueprinted, I have implemented a delay before the effect of instant blueprint is actually applied.
But then it cannot detect your text plates because they are replaced by the blank plates.
If you can implement this, the problem can be solved.
(I have forked your repo but the last commit is 0.1.11 instead of 0.1.15, so I place the request here.)
After checking your code, I am now thinking: are we doing it wrong? "We" means modders that revive entities by script, including me of corse.
Normally, ghost entities can only be revived by robots. Shouldn't we raise on_robot_built_entity instead of on_built_entity?
Although this will lose the "player_index" parameter and also make "robot" to be nil, they are not really useful for entity revival.
And I have changed it and tested with mods. No problem so far. It solved the issue perfectly.
Ideally, we won't need the additional remote function for this issue.
I will keep an eye on it.
There's the solved issue. Here comes the unsolved one.
Would you mind raising on_built_entity (on_robot_built_entity) for the replacement entities after replacing the text plates that are built by blueprint, Earendel?
More specifically, inserting the following code at line 209 of your control.lua:
Code: Select all
game.raise_event(defines.events.on_built_entity,
{
tick = event.tick,
name = defines.events.on_built_entity,
created_entity = replacement,
player_index = player_index
})
But then it cannot detect your text plates because they are replaced by the blank plates.
If you can implement this, the problem can be solved.
(I have forked your repo but the last commit is 0.1.11 instead of 0.1.15, so I place the request here.)
Re: [MOD 0.14] Text Plates
My message above was a bit out of date because I made some changes for nanobots and the earlier changes for bluebuild became unnecessary.
@Mooncat I've made that change for v0.1.16. I've started calling on_built_entity when ever an entity is swapped, except for the one in the robot event where it uses on_robot_built_entity instead. The event data format is:
This means that other mods can check whether or not the event was called by a mod and if so which mod, also is this an entity replacement and if so what is the unit_number. It might be a useful practice to adopt so we can avoid replacement loops and/or allow entity references to link to the new entity.
@Mooncat I've made that change for v0.1.16. I've started calling on_built_entity when ever an entity is swapped, except for the one in the robot event where it uses on_robot_built_entity instead. The event data format is:
Code: Select all
game.raise_event(defines.events.on_built_entity,
{
tick = event.tick,
name = defines.events.on_built_entity,
created_entity = replacement,
player_index = player_index,
mod = "textplates",
is_replacement = true,
replaced_unit_number = entity.unit_number
})
Re: [MOD 0.14] Text Plates
Thanks a lot.Earendel wrote:My message above was a bit out of date because I made some changes for nanobots and the earlier changes for bluebuild became unnecessary.
@Mooncat I've made that change for v0.1.16. I've started calling on_built_entity when ever an entity is swapped, except for the one in the robot event where it uses on_robot_built_entity instead. The event data format is:This means that other mods can check whether or not the event was called by a mod and if so which mod, also is this an entity replacement and if so what is the unit_number. It might be a useful practice to adopt so we can avoid replacement loops and/or allow entity references to link to the new entity.Code: Select all
game.raise_event(defines.events.on_built_entity, { tick = event.tick, name = defines.events.on_built_entity, created_entity = replacement, player_index = player_index, mod = "textplates", is_replacement = true, replaced_unit_number = entity.unit_number })
I like this approach and I will add this in my mod too. (Have already added "revived=true" in my events for entity revival, according to Nexela's request. It shouldn't hurt to add more useful info.)
- septemberWaves
- Fast Inserter
- Posts: 225
- Joined: Tue Jul 26, 2016 7:49 pm
- Contact:
Re: [MOD 0.14] Text Plates
I have a suggestion for some inter-mod compatibility. I think it would be nice to include support for the various metals from Bob's mods. That would allow a far greater variety of coloration options for the text plates, and also give more uses for those metals.
Re: [MOD 0.14] Text Plates
Can you add ru translation to this mod?
Translation in attachment
Translation in attachment
- Attachments
-
- locale.zip
- (1.3 KiB) Downloaded 162 times
Re: [MOD 0.14] Text Plates
I got a crash with this error. Aparenttly it happened during an alien attack.
- Attachments
-
- error.png (63.28 KiB) Viewed 8705 times
-
- Manual Inserter
- Posts: 1
- Joined: Wed Apr 19, 2017 2:18 pm
- Contact:
Re: [MOD 0.14] Text Plates
It appears this mod causes a crash whenever either a text plate is destroyed or when a blue print is made to replace a destroyed text plate.
This happens on version .16 and .17 (from github) of the mod. It looks like there was a push a few days ago to fix this issue but it does not appear to work.
I tested this in a vanilla version of the game (with only this mod installed) without blueprints researched and I was able to destroy text plates with no issue.
Using a creative mod to get all tech research caused a game crash when a text plate was destroyed, but the crash was attributed to the creative mod for whatever reason.
Haven't yet tested with gaining blueprints the vanilla way since I don't have a way to easily unlock that.
This happens on version .16 and .17 (from github) of the mod. It looks like there was a push a few days ago to fix this issue but it does not appear to work.
I tested this in a vanilla version of the game (with only this mod installed) without blueprints researched and I was able to destroy text plates with no issue.
Using a creative mod to get all tech research caused a game crash when a text plate was destroyed, but the crash was attributed to the creative mod for whatever reason.
Haven't yet tested with gaining blueprints the vanilla way since I don't have a way to easily unlock that.
Re: [MOD 0.14] Text Plates
Because I see CM is involved, I investigated, and saw the cause.
At line 361, on_built_entity is raised with player_index = nil. According to API doc, player_index is not optional, so nil is not expected.
Maybe raise on_robot_built_entity instead, with robot = {name = "whatever", type = "whatever", valid = false} ?
At line 361, on_built_entity is raised with player_index = nil. According to API doc, player_index is not optional, so nil is not expected.
Maybe raise on_robot_built_entity instead, with robot = {name = "whatever", type = "whatever", valid = false} ?
Re: [MOD 0.14] Text Plates
Hello,
as described here viewtopic.php?f=7&t=45940 the colons of the research panel are not localized with this mod installed anymore.
Has anybody else this problem?
Greetings, steinio.
as described here viewtopic.php?f=7&t=45940 the colons of the research panel are not localized with this mod installed anymore.
Has anybody else this problem?
Greetings, steinio.
Re: [MOD 0.14] Text Plates
Yup. It's not just the research, either, at least for me. Happens all over the place, including in the mod enable/disable interface.steinio wrote:Hello,
as described here viewtopic.php?f=7&t=45940 the colons of the research panel are not localized with this mod installed anymore.
Has anybody else this problem?
Greetings, steinio.
It looks like Text Plates is setting a locale definition for the "colon" keyword, which is overriding the locale for that same keyword in __core__/locale/xx/core.cfg.
I was able to fix it by renaming the colon keyword to something else in both strings.cfg and plate_types.lua in Text Plates.
Re: [MOD 0.14] Text Plates
That's a weird bug, but it's fixed now.undarl wrote:Yup. It's not just the research, either, at least for me. Happens all over the place, including in the mod enable/disable interface.steinio wrote:Hello,
as described here viewtopic.php?f=7&t=45940 the colons of the research panel are not localized with this mod installed anymore.
Has anybody else this problem?
Greetings, steinio.
It looks like Text Plates is setting a locale definition for the "colon" keyword, which is overriding the locale for that same keyword in __core__/locale/xx/core.cfg.
I was able to fix it by renaming the colon keyword to something else in both strings.cfg and plate_types.lua in Text Plates.
Re: [MOD 0.14] Text Plates
I'm getting some inconsistent behaviour with Blueprints. I made a bunch of Blueprints in a cheat mode game, and saved them in my general player's library. In these BPs, I sometimes included Text Plate "labels" for input and/or output Belts or Pipes, so that for instance I could know that for this structure, this Belt has to receive Iron Plate, and this Belt Copper Plate, and then out of this Belt comes Electronic Circuits.
But the Text Plates aren't reproduced when I plonk down the Blueprints in a newly started game.
What gives?
But the Text Plates aren't reproduced when I plonk down the Blueprints in a newly started game.
What gives?