Guest User

Untitled

a guest
Jan 14th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. -----------------------------------------------------------------------------------------------------
  2. local function entity_settings_pasted(event)
  3.     -- copy paste entity settings from one display to another
  4.     local source = event.source
  5.     local dest = event.destination
  6.     if source and dest and source.valid and dest.valid then
  7.         if (source.name == "SD1030" or source.name == "SD1050" or source.name == "SD1070") and (dest.name == "SD1030" or dest.name == "SD1050" or dest.name == "SD1070") then
  8.             local display1
  9.             local display2
  10.             for i, display in ipairs(global.display) do
  11.                 if source == display.entity then
  12.                     display1 = display
  13.                 end
  14.                 if dest == display.entity then
  15.                     display2 = display
  16.                 end
  17.             end
  18.            
  19.             display2.signal = display1.signal
  20.             display2.units = display1.units
  21.             display2.Kunits = display1.Kunits
  22.             display2.percent = display1.percent
  23.             display2.zero = display1.zero
  24.             display2.scale = display1.scale
  25.         end
  26.     end
  27. end
  28.  
  29. script.on_event(defines.events.on_entity_settings_pasted, entity_settings_pasted)
Advertisement
Add Comment
Please, Sign In to add comment