Request: APIs to know the existence of sticker on entity, and also add or remove sticker on it.
I'm looking for
LuaEntity::has_sticker(name) → boolean
LuaEntity::add_sticker(name)
LuaEntity::remove_sticker(name) → boolean (whether the entity had the said sticker so it is removed successfully)
There is so much potential for the sticker system.
sticker related APIs
Re: sticker related APIs
It is already kind of possible.
Add sticker to biter
Remove all stickers from biter:
You got the idea.
Add sticker to biter
Code: Select all
biter.surface.create_entity{ name="slowdown-sticker", position=biter.position, target=biter }
Code: Select all
for _,e in pairs(biter.surface.find_entities_filtered{type="sticker", area=biter.bounding_box}) do
e.destroy()
end
Re: sticker related APIs
Wow, that's great! Don't know the "target" parameter can be used for sticker.
hm... I wonder the performance impact of using find_entities_filtered to remove stickers. Really not a fan of using such a search function since you already know the sticker is on the biter.
But yes, I can use this before the actual implementation. Thanks!
hm... I wonder the performance impact of using find_entities_filtered to remove stickers. Really not a fan of using such a search function since you already know the sticker is on the biter.
But yes, I can use this before the actual implementation. Thanks!
Re: sticker related APIs
For such a small area a bounding box search vs a position search is almost identical performance wise.Mooncat wrote:Wow, that's great! Don't know the "target" parameter can be used for sticker.
hm... I wonder the performance impact of using find_entities_filtered to remove stickers. Really not a fan of using such a search function since you already know the sticker is on the biter.
But yes, I can use this before the actual implementation. Thanks!
I think biters already keep track of what stickers are attached to them so I'll just add the ability to read stickers off a biter for 0.15.
If you want to get ahold of me I'm almost always on Discord.
Re: sticker related APIs
That's awesome! Thanks!Rseding91 wrote:For such a small area a bounding box search vs a position search is almost identical performance wise.Mooncat wrote:Wow, that's great! Don't know the "target" parameter can be used for sticker.
hm... I wonder the performance impact of using find_entities_filtered to remove stickers. Really not a fan of using such a search function since you already know the sticker is on the biter.
But yes, I can use this before the actual implementation. Thanks!
I think biters already keep track of what stickers are attached to them so I'll just add the ability to read stickers off a biter for 0.15.
- Ranakastrasz
- Smart Inserter
- Posts: 2174
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: sticker related APIs
Huh. I wonder if this would work for the player. If so, would work great for several buff-like animations I want to display.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16