How to get current surface and all entities with some name?

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

Qon wrote: ↑
Thu Aug 20, 2020 8:49 am
Pi-C wrote: ↑
Thu Aug 20, 2020 7:28 am
Do you really use the complete entity as table index?
[/code]
What I'd have expected is

Code: Select all

global = {
	things_I_care_about = {
		[1] = {entity, true}
		[2] = {entity, true}
		…
	}
}
Take that with a grain of salt, though -- I'm still decaffeinated. :-)
What you expected gives you a list-like table.
What I used was a map-like table.
"entire entity", not really, it's a reference, or just a typed number.
I get that, but in the code on display, "entity" was used as index, and it was also treated as entity (with the entity.valid check). This wouldn't work, that was my point.
Edit: I would have used entity.index as key if there was something like that. I thought there was, but apparently not. It would not be a list since they keys are non-contiguous. But it would be values that can be printed to console.
Some entities will have entity.unit_number. Entities based on simple-entity won't, but just yesterday, I've learned about script.register_on_entity_destroyed which would allow you to assign unique IDs to any entity that doesn't have a unit_number.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Bilka
Factorio Staff
Factorio Staff
Posts: 3300
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Bilka »

Using the entity as the table key can produce desyncs: https://wiki.factorio.com/Tutorial:Modd ... _reference

Furthermore, "global." does not deserialize LuaEntities when they are inside table keys, meaning they wont work as expected. Example, save/load performed before the print command:
Image

TL;DR: Entities as table keys = no good. Use entity.unit_number or id from script.register_on_entity_destroyed like Pi-C suggests.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Qon »

Pi-C wrote: ↑
Thu Aug 20, 2020 9:32 am
I get that, but in the code on display, "entity" was used as index, and it was also treated as entity (with the entity.valid check). This wouldn't work, that was my point.
Edit: I would have used entity.index as key if there was something like that. I thought there was, but apparently not. It would not be a list since they keys are non-contiguous. But it would be values that can be printed to console.
Some entities will have entity.unit_number. Entities based on simple-entity won't,
My_table[entity] fails. Since entity doesn't have an index I assumed it was supposed to work, even though I could have sworn I had seen it for entities before and searched through the list several times...
I tested with pairs to make sure. But it's called unit_number....

So I meant to write this:

Code: Select all

script.on_init(function(event)
    global.things_I_care_about = {}
    global.count = 0
end)

function add_entity(event)
    global.things_I_care_about[event.entity.unit_number] = entity
    global.count = global.count + 1
end

function remove_entity(event)
    if global.things_I_care_about[event.entity.unit_number] ~= nil then
        global.things_I_care_about[event.entity.unit_number] = nil
        global.count = global.count - 1
    end
end

script.on_event(defines.events.on_something_added,                     add_entity)
script.on_event(defines.events.on_another_event_where_something_added, add_entity)

script.on_event(defines.events.on_something_removed,                remove_entity)

script.on_event(defines.events.on_event_where_I_go_through_my_items, function(event)
    -- If you just need count then 
    -- global.count
    -- is the same as 
    -- table_size(global.things_I_care_about) 
    -- but is faster since it's already calculated

    for unit_number, entity in pairs(global.things_I_care_about) do
        if entity.valid then 
            do_stuff(entity)
        else
            global.things_I_care_about[entity.unit_number] = nil
            global.count = global.count - 1
        end
    end
end)
Pi-C wrote: ↑
Thu Aug 20, 2020 9:32 am
but just yesterday, I've learned about script.register_on_entity_destroyed which would allow you to assign unique IDs to any entity that doesn't have a unit_number.
I get how you would use it instead of an unit_number, but not how you would ID them with it. :?:
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

Qon wrote: ↑
Thu Aug 20, 2020 9:52 am
So I meant to write this:
function add_entity(event)
global.things_I_care_about[event.entity.unit_number] = entity
global.count = global.count + 1
end
That's what I'd expected. :-)
Pi-C wrote: ↑
Thu Aug 20, 2020 9:32 am
but just yesterday, I've learned about script.register_on_entity_destroyed which would allow you to assign unique IDs to any entity that doesn't have a unit_number.
I get how you would use it instead of an unit_number, but not how you would ID them with it. :?:
Just some quick, untested pseudo code:

Code: Select all

local entities = surface.find_entities_filtered{name = "whatever"} or {}
local store = {}

for _, entity in ipairs(entities) do
	if entity.unit_number then 
		store[entity.unit_number] = entity
	else
		local id = script.register_on_entity_destroyed(entity)
		store[id] = entity
	end
end
EDIT: Fixed indexing by unknown variable "unit_number", it must be "store[entity.unit_number]", of course!
Last edited by Pi-C on Thu Aug 20, 2020 12:25 pm, edited 1 time in total.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Qon »

Pi-C wrote: ↑
Thu Aug 20, 2020 10:07 am

Just some quick, untested pseudo code:

Code: Select all

	if entity.unit_number then 
		store[unit_number] = entity
	else
		local id = script.register_on_entity_destroyed(entity)
		store[id] = entity
	end
	 
Right. I read the documentation, skipped over the return value because of some automatic assumtion that it didn't return anything, and then wondered how you would get an id when it doesn't return anything... :oops:

You would need to store the ID in a different table though. unit_number and script.register_on_entity_destroyed() aren't guaranteed to be unique when cross-tested.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

Qon wrote: ↑
Thu Aug 20, 2020 11:05 am
You would need to store the ID in a different table though. unit_number and script.register_on_entity_destroyed() aren't guaranteed to be unique when cross-tested.
Good to know that! It was just an assumption on my part, but it makes sense that things like entity.index, entity.unit_number, and this ID would use different scopes.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Pi-C wrote: ↑
Thu Aug 20, 2020 10:07 am

Code: Select all

local entities = surface.find_entities_filtered{name = "whatever"} or {}
local store = {}

for _, entity in ipairs(entities) do
	if entity.unit_number then 
		store[unit_number] = entity
	else
		local id = script.register_on_entity_destroyed(entity)
		store[id] = entity
	end
end
Still not work

Code: Select all

function UpdateAll(entity,add) 
	if entity.name == "ds-energy-loader" then
		if add==true then
			global.generators[entity.unit_number] = entity
			global.generators_count = global.generators_count + 1
			game.players[1].print("placed "..global.generators_count .." arr " .. #global.generators)
		else
			if global.generators[entity.unit_number] ~= nil then
				global.generators[entity.unit_number] = nil
				global.generators_count = global.generators_count - 1
				game.players[1].print("removed "..global.generators_count .. " arr " .. #global.generators)
			end
		end
	end
end
Image

And problem that i found
I can pass through an object:

Code: Select all

{
	type = "electric-energy-interface",
	name = "ds-energy-loader",
	icon = "__base__/graphics/icons/accumulator.png",
	icon_size = 64,
	flags = {"placeable-neutral", "placeable-player", "player-creation"},
	minable = {hardness = 0.2, mining_time = 0.5, result = "ds-energy-loader"},
	max_health = 250,
	energy_source = {
		type = "electric",
		usage_priority = "tertiary",
		buffer_capacity = "0GJ",
		render_no_power_icon = false,
		--input_flow_limit = "0MW",
		--output_flow_limit = "1000GW",
	},
	allow_copy_paste = true,
	collision_box = {{-0.9, -0.9}, {0.9, 0.9}},
    	selection_box = {{-1, -1}, {1, 1}},
	collision_mask = {},
	picture = accumulator_picture( {r=0.6, g=1, b=1, a=1} ),
	energy_production = "0kW",
	energy_usage = "0kW",
	corpse = "medium-remnants",
    subgroup = "other",
}
Did I create a ghost type by any chance?

And last problem... How to scale sprite?
I try this parameters

Code: Select all

drawing_box = {{-4, -5}, {4, 4}}
but
Image
Object must be like accumulator with the protruding part from above
Sprite size: 800x1260
It's another entity, type - simple-entity-with-owner
Last edited by SLywnow on Thu Aug 20, 2020 12:16 pm, edited 1 time in total.

Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Qon »

SLywnow wrote: ↑
Thu Aug 20, 2020 12:06 pm

Code: Select all

game.players[1].print("placed "..global.generators_count .." arr " .. #global.generators)
You can't use #global.generators on tables that are not lists (list = contiguous integers keys starting from 1 only) and expect the count.
You can use table_size(global.generators)
Read doc: https://lua-api.factorio.com/latest/Libraries.html
but table_size() is "slow" compared to reading global.generators_count since it loops through all values in the table, so only use it for debugging if you have something like global.generators_count already available. table_size() is implemented in C++ so it's faster than looping through it yourself though.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Qon wrote: ↑
Thu Aug 20, 2020 12:16 pm
SLywnow wrote: ↑
Thu Aug 20, 2020 12:06 pm

Code: Select all

game.players[1].print("placed "..global.generators_count .." arr " .. #global.generators)
You can't use #global.generators on tables that are not lists (list = contiguous integers keys starting from 1 only) and expect the count.
You can use table_size(global.generators)
Read doc: https://lua-api.factorio.com/latest/Libraries.html
but table_size() is "slow" compared to reading global.generators_count since it loops through all values in the table, so only use it for debugging if you have something like global.generators_count already available. table_size() is implemented in C++ so it's faster than looping through it yourself though.
oh, thank, i used it just for debugging, i remove it in future
Yes now i can see that the count in the array matches the variable

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

SLywnow wrote: ↑
Thu Aug 20, 2020 12:18 pm
Qon wrote: ↑
Thu Aug 20, 2020 12:16 pm
You can't use #global.generators on tables that are not lists (list = contiguous integers keys starting from 1 only) and expect the count.
You can use table_size(global.generators)
Read doc: https://lua-api.factorio.com/latest/Libraries.html
but table_size() is "slow" compared to reading global.generators_count since it loops through all values in the table, so only use it for debugging if you have something like global.generators_count already available. table_size() is implemented in C++ so it's faster than looping through it yourself though.
oh, thank, i used it just for debugging, i remove it in future
Yes now i can see that the count in the array matches the variable
Same thing goes for pairs() and ipairs(), by the way. You won't get the right result with ipairs() if the indexes aren't subsequent numbers (1, 2, …, n-1, n), but if you can guarantee that your table is indexed that way, ipairs will be faster. I think that it's safe to assume that ipairs can be used if you've made the table yourself (you'll know its structure) or if it's a table generated on the fly by some command like surface.find_entities_filtered{} etc.

Also, there's something fishy with your logging message:

Code: Select all

if global.generators[entity.unit_number] ~= nil then
	global.generators[entity.unit_number] = nil
	global.generators_count = global.generators_count - 1
	game.players[1].print("removed "..global.generators_count .. " arr " .. #global.generators)
end
You'll print out the number of remaining generators, not the number of removed ones! Yes, it's just a debugging message of no real consequence. But it may produce output that could be confusing in a few days …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

SLywnow wrote: ↑
Thu Aug 20, 2020 12:06 pm
And problem that i found
I can pass through an object:

Code: Select all

{
	collision_box = {{-0.9, -0.9}, {0.9, 0.9}},
    	selection_box = {{-1, -1}, {1, 1}},
	collision_mask = {},
}
Did I create a ghost type by any chance?
No, but the thing has an empty collision_mask. If you don't want to change it, either don't assign collision_mask, or use "collision_mask = nil". For everything that is not set (i.e. it is nil), the default values will be filled in automatically at the end of the data stage. But {} is an empty table, which is different from nil -- so nothing will collide with your entity.

There's that sweet new feature in Factorio where you can use <CTRL>+<SHIFT>+>F> on an entity to see its prototype data. Use that for debugging! It will show you the real prototype data, which aren't fully available in the data stage.
And last problem... How to scale sprite?
If only Factorio could scale images! :mrgreen:
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Pi-C wrote: ↑
Thu Aug 20, 2020 12:55 pm
You'll print out the number of remaining generators, not the number of removed ones! Yes, it's just a debugging message of no real consequence. But it may
That was my goal to debugging. Is count of entities inside array same as my count value

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Pi-C wrote: ↑
Thu Aug 20, 2020 1:10 pm
There's that sweet new feature in Factorio where you can use <CTRL>+<SHIFT>+>F> on an entity to see its prototype data. Use that for debugging! It will show you the real prototype data, which aren't fully available in the data stage.
Thank you, I didn't know about it

And last problem... How to scale sprite?
Pi-C wrote: ↑
Thu Aug 20, 2020 1:10 pm
If only Factorio could scale images! :mrgreen:
Yes yes, i already already found this
Can this be changed dynamically (I have to restart the game too many times to find the correct shift)? And in General, is it possible to dynamically change sprites (not animation, but just put a different sprite at a certain event)?

or how to change entity? I try this, but it didn't work

Code: Select all

local placeto = "ds-energy-interface-st1"
		if global.dysonsphere > stage3 then
			placeto = "ds-energy-interface-st4"
		elseif global.dysonsphere > stage2 then
			placeto = "ds-energy-interface-st3"
		elseif global.dysonsphere > stage1 then
			placeto = "ds-energy-interface-st2"
		end
		
		--checks
		local entities = nil
		if global.dysonsphere > stage3 then
			entities = player.surface.find_entities_filtered{force="player", name="ds-energy-interface-st3"}
		elseif global.dysonsphere > stage2 then
			entities = player.surface.find_entities_filtered{force="player", name="ds-energy-interface-st2"}
		elseif global.dysonsphere > stage1 then
			entities = player.surface.find_entities_filtered{force="player", name="ds-energy-interface-st1"}	
		end
		
		if entities ~=nil then
			for _, entity in pairs(entities) do
				create_entity{name=placeto,position=entity.position,player=entity.player,force = game.forces.player}
				entity.destroy{}
			end
		end
Item spawn only ds-energy-interface-st1 and i need to change it to correct entity, also i must change all ds-energy-interface-st to correct when global.dysonsphere > some stage

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

SLywnow wrote: ↑
Thu Aug 20, 2020 1:38 pm
And last problem... How to scale sprite?
Pi-C wrote: ↑
Thu Aug 20, 2020 1:10 pm
If only Factorio could scale images! :mrgreen:
Yes yes, i already already found this
Can this be changed dynamically (I have to restart the game too many times to find the correct shift)?
I don't think so. You can access entity.prototype to read its values, but that's read only.
And in General, is it possible to dynamically change sprites (not animation, but just put a different sprite at a certain event)?
You could use the rendering class. For example, I use this code in GCKI to put a key-icon on locked vehicles in ALT-mode:

Code: Select all

-- Set icon
if not v.entity.active then
    v.lock_icon = rendering.draw_sprite{
        sprite = "GCKI_locked-icon",
        target = v.entity,
        target_offset = {0, -0.5},
        surface = v.entity.surface,
        render_layer = "entity-info-icon-above",
        only_in_alt_mode = true,
    }
-- Remove icon
elseif v.lock_icon then
    rendering.destroy(v.lock_icon)
    v.lock_icon = nil
end
or how to change entity? I try this, but it didn't work

Code: Select all

if entities ~=nil then
	for _, entity in pairs(entities) do
		create_entity{name=placeto,position=entity.position,player=entity.player,force = game.forces.player}
		entity.destroy{}
	end
end
Halfway there! You create the entity, but you don't know anything about it:

Code: Select all

if entities ~=nil then
	for _, entity in pairs(entities) do
		local new_entity = create_entity{name=placeto,position=entity.position,player=entity.player,force = game.forces.player}
		if new_entity then 
			global.store[new_entity.unit_number].data = global.store[entity.unit_number].data
			global.store[entity.unit_number] = nil
			entity.destroy{}
		end
	end
end
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Qon »

Pi-C wrote: ↑
Thu Aug 20, 2020 12:55 pm
Same thing goes for pairs() and ipairs(), by the way. You won't get the right result with ipairs() if the indexes aren't subsequent numbers (1, 2, …, n-1, n), but if you can guarantee that your table is indexed that way, ipairs will be faster.
ipairs isn't faster:
https://lua-api.factorio.com/latest/Libraries.html wrote:pairs()

In standard Lua, the order of iteration when using pairs() is arbitrary. Because Factorio has to be deterministic, this was changed in Factorio's version of Lua. Factorio's iteration order when using next(), which pairs() uses for iteration, depends on the insertion order: Keys inserted first are iterated first. However, Factorio also guarantees that the first 1024 numbered keys are iterated from 1-1024, regardless of insertion order. This means that in usual usage, pairs() does not have any drawbacks compared to ipairs().
Or do you have proof?

Also motivation:
Qon wrote: ↑
Thu Aug 20, 2020 8:49 am
But not in Lua. In Lua, lists are tables, which are key-value maps anyways. So they are basically maps with integer keys and not continous memory with pointer arithmetic access. So it doesn't matter here and you can use them as maps always basically.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

Qon wrote: ↑
Thu Aug 20, 2020 2:23 pm
Pi-C wrote: ↑
Thu Aug 20, 2020 12:55 pm
Same thing goes for pairs() and ipairs(), by the way. You won't get the right result with ipairs() if the indexes aren't subsequent numbers (1, 2, …, n-1, n), but if you can guarantee that your table is indexed that way, ipairs will be faster.
ipairs isn't faster:
https://lua-api.factorio.com/latest/Libraries.html wrote:pairs()

In standard Lua, the order of iteration when using pairs() is arbitrary. Because Factorio has to be deterministic, this was changed in Factorio's version of Lua. Factorio's iteration order when using next(), which pairs() uses for iteration, depends on the insertion order: Keys inserted first are iterated first. However, Factorio also guarantees that the first 1024 numbered keys are iterated from 1-1024, regardless of insertion order. This means that in usual usage, pairs() does not have any drawbacks compared to ipairs().
Or do you have proof?
Nothing I could point to, just a faint memory of having read about this somewhere …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Pi-C wrote: ↑
Thu Aug 20, 2020 2:10 pm
You could use the rendering class. For example, I use this code in GCKI to put a key-icon on locked vehicles in ALT-mode:

Code: Select all

-- Set icon
if not v.entity.active then
    v.lock_icon = rendering.draw_sprite{
        sprite = "GCKI_locked-icon",
        target = v.entity,
        target_offset = {0, -0.5},
        surface = v.entity.surface,
        render_layer = "entity-info-icon-above",
        only_in_alt_mode = true,
    }
-- Remove icon
elseif v.lock_icon then
    rendering.destroy(v.lock_icon)
    v.lock_icon = nil
end
Yes, that's it! I can even drew animation, I think I'm implementing the mod as I wanted.
Pi-C wrote: ↑
Thu Aug 20, 2020 2:10 pm
Halfway there! You create the entity, but you don't know anything about it:

Code: Select all

if entities ~=nil then
	for _, entity in pairs(entities) do
		local new_entity = create_entity{name=placeto,position=entity.position,player=entity.player,force = game.forces.player}
		if new_entity then 
			global.store[new_entity.unit_number].data = global.store[entity.unit_number].data
			global.store[entity.unit_number] = nil
			entity.destroy{}
		end
	end
end
After viewing the examples, I realized that I forgot to specify the surface... Now it's work, but i rewrite it to render class

User avatar
SLywnow
Inserter
Inserter
Posts: 30
Joined: Sat Apr 25, 2020 7:37 pm
Contact:

Re: How to get current surface and all entities with some name?

Post by SLywnow »

Pi-C wrote: ↑
Thu Aug 20, 2020 2:10 pm
You could use the rendering class. For example, I use this code in
Thank you again, i complete code part (maybe i add new items or technologies, but I won't change anything else in control.lua)
With Rendering class i made animation with light and text, it's really useful
Image
Pi-C wrote: ↑
Thu Aug 20, 2020 2:10 pm
Qon wrote: ↑
Wed Aug 19, 2020 3:53 pm
Yoyobuae wrote: ↑
Wed Aug 19, 2020 2:07 am
I have a little hobby - make video about modding in different games, like minecraft, something on source e.t.c (the main show on the channel is unity (it's in Russian, so I don't think it makes sense to give a link))
I think I will record a few videos about modding in factorio. May I mention all of you as those who helped me figure it out?

Pi-C
Smart Inserter
Smart Inserter
Posts: 1720
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Pi-C »

SLywnow wrote: ↑
Fri Aug 21, 2020 12:43 am
Pi-C wrote: ↑
Thu Aug 20, 2020 2:10 pm
You could use the rendering class. For example, I use this code in
Thank you again, i complete code part (maybe i add new items or technologies, but I won't change anything else in control.lua)
With Rendering class i made animation with light and text, it's really useful
Image
For some reason the image wasn't displayed here -- but after copying the link from your post I did see it, and the rendering looks quite impressive! :-)
I think I will record a few videos about modding in factorio. May I mention all of you as those who helped me figure it out?
I can't speak for the others, of course, but I'm not opposed to that idea -- thanks for the offer! Also, perhaps you should include the link after all. I don't speak much Russian (just some faint memories from school way back in the past, and I don't know about Qon and Yoyobuae. But this is a forum where the threads are preserved for a long time, so somebody who understands enough Russian to make sense of your explanations may actually benefit from your series in the future …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: How to get current surface and all entities with some name?

Post by Qon »

SLywnow wrote: ↑
Fri Aug 21, 2020 12:43 am
With Rendering class i made animation with light and text, it's really useful
Qon wrote: ↑
Wed Aug 19, 2020 3:53 pm
I have a little hobby - make video about modding in different games, like minecraft, something on source e.t.c (the main show on the channel is unity (it's in Russian, so I don't think it makes sense to give a link))
I think I will record a few videos about modding in factorio. May I mention all of you as those who helped me figure it out?
Cool picture :)
Sure!
Also tell us when the mod is released ;)
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Post Reply

Return to β€œModding help”