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:
+27
@@ -478,6 +478,33 @@ local function set_up_display_from_ghost(entity,tags)
|
||||
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()
|
||||
-- global.translations = nil
|
||||
-- end
|
||||
|
||||
Reference in New Issue
Block a user