User:Joshinils: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 22: | Line 22: | ||
Screenshot command: | Screenshot command: | ||
< | <syntaxhighlight lang="lua" line='line'> | ||
/c game.take_screenshot{resolution = {x = 1000, y = 1000}, zoom = 2, show_entity_info = true} | /c game.take_screenshot{resolution = {x = 1000, y = 1000}, zoom = 2, show_entity_info = true} | ||
</ | </syntaxhighlight> | ||
Remaining research command: | Remaining research command: | ||
< | <syntaxhighlight lang="python" line='line'> | ||
/c global.research = function(amount) | /c global.research = function(amount) | ||
if amount == nil then | if amount == nil then | ||
Line 35: | Line 35: | ||
end | end | ||
end | end | ||
</ | </syntaxhighlight> | ||
Reveal circular area around input (default <code>(x=0,y=0)</code>, can be exchanged with <code>game.player.position</code>) | Reveal circular area around input (default <code>(x=0,y=0)</code>, can be exchanged with <code>game.player.position</code>) | ||
< | <syntaxhighlight lang="lua" line='line'> | ||
/c global.reveal=function(input) | /c global.reveal=function(input) | ||
--[[set radius the first time this gets run]] | --[[set radius the first time this gets run]] | ||
Line 59: | Line 59: | ||
global.radius=global.radius+32 | global.radius=global.radius+32 | ||
end | end | ||
</ | </syntaxhighlight> | ||
Delete everything (when <code>input == nil</code>) | Delete everything (when <code>input == nil</code>) | ||
< | <syntaxhighlight lang="lua" line='line'> | ||
/c global.delete=function(input) | /c global.delete=function(input) | ||
local surface=game.players[1].surface | local surface=game.players[1].surface | ||
Line 72: | Line 72: | ||
end | end | ||
end | end | ||
</ | </syntaxhighlight> | ||
Revision as of 06:27, 5 September 2017
As I'm usig this bit so often, here it is to copy-paste:
== Siehe auch == * [[Research/de|Forschung]] * [[Technologies/de|Technologien]]
! Technologie !! Kosten !! Auswirkung !! Aufaddierte <br/>Auswirkung
Block that puts foo and bar nex to each another if there is space, else it wraps and puts them underneath:
<div><ul> <li style="display:inline-block;"> foo </li> <li style="display:inline-block;"> bar </li> </ul></div>
Screenshot command:
/c game.take_screenshot{resolution = {x = 1000, y = 1000}, zoom = 2, show_entity_info = true}
Remaining research command:
/c global.research = function(amount)
if amount == nil then
game.print(game.player.force.research_progress * 100 .. "% done")
else
game.print(amount -game.player.force.research_progress * amount .. " packs needed")
end
end
Reveal circular area around input (default (x=0,y=0)
, can be exchanged with game.player.position
)
/c global.reveal=function(input)
--[[set radius the first time this gets run]]
global=global or {}
global.radius=global.radius or 128
radius_squared=global.radius*global.radius
origin=input or {x=0, y=0}
for x=-global.radius, global.radius, 32 do
for y=-global.radius, global.radius, 32 do
if x*x+y*y<radius_squared then
game.player.force.chart(game.player.surface, {{origin.x+x, origin.y+y }, {origin.x+x, origin.y+y }})
end
end
end
game.print("r="..global.radius)
--[[increase radius every successive time it is run, may be set outside of this function]]
global.radius=global.radius+32
end
Delete everything (when input == nil
)
/c global.delete=function(input)
local surface=game.players[1].surface
for c in surface.get_chunks() do
for key, entity in pairs(surface.find_entities_filtered({area={{c.x*32, c.y*32}, {c.x*32+32, c.y*32+32}}, type=input})) do
entity.destroy()
end
end
end
Subpages