1
0

Add remote interface to allow other mods to query / change sprites in… (#20)

* Add remote interface to allow other mods to query / change sprites in display frames
* update map marker if present
This commit is contained in:
billbo99
2022-07-11 21:29:56 +01:00
committed by GitHub
parent 9d8443c9b2
commit 18299fd3f5
+27
View File
@@ -478,6 +478,33 @@ local function set_up_display_from_ghost(entity,tags)
end end
end end
remote.add_interface(
"IndustrialDisplayPlates",
{
get_sprite = function(event)
if event and event.entity and event.entity.valid then
local spritetype, spritename = get_render_sprite_info(event.entity)
return {spritetype=spritetype, spritename=spritename}
else
return nil
end
end,
set_sprite = function(event)
if event and event.entity and event.entity.valid and event.sprite and game.is_valid_sprite_path(event.sprite) then
destroy_render(event.entity)
render_overlay_sprite(event.entity, event.sprite)
if get_has_map_marker(event.entity) then
local spritetype, spritename = get_render_sprite_info(event.entity)
change_map_markers(event.entity, spritetype, spritename)
end
end
end
}
)
-- local function reset_globals() -- local function reset_globals()
-- global.translations = nil -- global.translations = nil
-- end -- end