Search found 40 matches

by cpeosphoros
Thu May 18, 2017 2:05 pm
Forum: Angels Mods
Topic: Bugs & FAQ
Replies: 3890
Views: 1251433

Re: Bugs & FAQ

We seem to be having issues with Fluid Splitters (both variants). They aren't doing anything? Output is not blocked and the machine has power, but nothing happens. I've tried with and without pumps, and with different pipe types, and still it won't pump Sulfuric Acid. A buddy also tried using a 2-w...
by cpeosphoros
Mon May 15, 2017 6:06 pm
Forum: Angels Mods
Topic: Bugs & FAQ
Replies: 3890
Views: 1251433

Re: Bugs & FAQ

Error loading mods Failed to load mods: __angelspetrochem__/data-final-fixes.lua:1:...gelspetrochem__/prototypes/petrochem-global-override:38:attempt to index field 'ores' (a nil value) Mods to be disabled: *angelspetrochem That's happening with only petrochem (0.5.7) and refining (0.7.9) enabled, ...
by cpeosphoros
Mon May 15, 2017 4:37 pm
Forum: Angels Mods
Topic: Bugs & FAQ
Replies: 3890
Views: 1251433

Re: Bugs & FAQ

Error loading mods Failed to load mods: __angelspetrochem__/data-final-fixes.lua:1:...gelspetrochem__/prototypes/petrochem-global-override:38:attempt to index field 'ores' (a nil value) Mods to be disabled: *angelspetrochem That's happening with only petrochem (0.5.7) and refining (0.7.9) enabled, ...
by cpeosphoros
Sun Jan 15, 2017 1:52 pm
Forum: Mods
Topic: Cpeophoros's Mods
Replies: 21
Views: 16646

Re: Ceophoros's Mods

I'll pack future versions with plain old "concrete" as the whitelisted version only "concrete" literally? or also "stone" and (eg via wildcard matching when you check or setup the whitelist) all other floor names that have "concrete" in them (to include all t...
by cpeosphoros
Sun Jan 15, 2017 1:15 pm
Forum: Modding help
Topic: events.on_tick not working
Replies: 3
Views: 1629

Re: events.on_tick not working

Have you tried using event.tick instead of game.tick? Also, it's slightly faster, and also easier to read and maintain, if you localize your handler, doing something like this: local function checkCycle (event) if event.tick % (60 * seconds) == 0 then work() end end script.on_event(defines.events.on...
by cpeosphoros
Sat Jan 14, 2017 3:29 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

Nexela wrote:Awesome findings. Thanks for looking into it.
You're welcome. You may find those results interesting, too: viewtopic.php?f=25&t=39069
by cpeosphoros
Sat Jan 14, 2017 3:28 pm
Forum: Modding help
Topic: remote.call only returns one value
Replies: 6
Views: 2297

Re: remote.call only returns one value

According to this local jobCount, report = ret[0], ret[1] should be several times faster than using unpack Well, your statement made me curious, about if all those performance tests would hold the same result inside Factorio's customized Lua interpreter. So I've made a test harness and time profile...
by cpeosphoros
Sat Jan 14, 2017 2:05 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

So, internally, this is what each check looks like: (Depending on system, might be some memory copy to working register instructions here) subtract one number from the other. check a flag bit. goto for true. goto for false. That's 4 instructions specifically for the check. for all checks. The only ...
by cpeosphoros
Sat Jan 14, 2017 1:39 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

Could you try profiling another 'countdown' code which is something like this: All right, I did it. Nexela also sent me a PM with another implementation, which gives the flexibility of performing a different action each time actionTick comes up - in my test harness I went on and performed the same ...
by cpeosphoros
Wed Jan 11, 2017 5:14 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

Dividing ist difficult. It's better to multiply, or adding something. For example adding -1. The problem is apparently not in the math operation, but In table accessing. Doing some caching for global.tick, etc shaves some milliseconds off, but the module approach is still cheaper, due to no table a...
by cpeosphoros
Fri Jan 06, 2017 11:47 pm
Forum: Development tools
Topic: Milliseconds time profiler for mods
Replies: 2
Views: 3794

Re: Milliseconds time profiler for mods

New version: require "socket" local fileName = "loop.log" local input ----------------------- -- Utility functions -- ----------------------- local function write(dt, line) local lineOut = string.format("%09.3f: %s", dt, line) io.write(lineOut .. "\n") print(l...
by cpeosphoros
Fri Jan 06, 2017 11:00 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

Ok, call me a stubborn OCD'ed person ;), but I went and time profiled it. This is the harness: require "LOGGER" local function tickCounter(tick) global.tickswait = global.tickswait - 1 if global.tickswait == 0 then global.tickswait = 60 global.counter = global.counter + 1 end end local fun...
by cpeosphoros
Fri Jan 06, 2017 9:36 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

function on_tick(event) if global.tickswait < 1 then --do code here else global.tickswait = global.tickswait - 1 -- 60 ticks pro second end end Don't forget to create it. "if event.tick % WAIT_TICKS == 0" is way less expensive, performance-wise. No it's not. That's about 6 times slower th...
by cpeosphoros
Fri Jan 06, 2017 5:06 pm
Forum: Modding help
Topic: /slap 5
Replies: 17
Views: 5761

Re: /slap 5

Rseding91 wrote:
Articulating wrote:
Rseding91 wrote:For 0.15 you can register your own console commands in mods.
Will this be available in scenarios? Or will it have to be registered in the data section?
It's done the same way custom events are done now.
Nice!
by cpeosphoros
Fri Jan 06, 2017 5:04 pm
Forum: Modding help
Topic: insert items in active armor
Replies: 5
Views: 2568

Re: insert items in active armor

Adil wrote:Armor has a grid, not inventory.

Code: Select all

   
if armor.grid then
    armor.grid.put({name="fusion-reactor-equipment"})
end
Have a look at https://mods.factorio.com/mods/arumba/A ... ated_Start code.

Basically, it does armor.grid.put, but has some nice tricks there.
by cpeosphoros
Fri Jan 06, 2017 4:59 pm
Forum: Modding help
Topic: Sleep(), wait()
Replies: 14
Views: 6327

Re: Sleep(), wait()

darkfrei wrote:

Code: Select all

function on_tick(event)
  if global.tickswait < 1 then
    --do code here
  else
    global.tickswait = global.tickswait - 1 -- 60 ticks pro second
  end
end
Don't forget to create it.
"if event.tick % WAIT_TICKS == 0" is way less expensive, performance-wise.
by cpeosphoros
Wed Jan 04, 2017 6:25 pm
Forum: Modding help
Topic: Optimization - tile/surface management
Replies: 2
Views: 1232

Re: Optimization - tile/surface management

Hey everyone! Since code says more than 100 words - I'm trying to achieve something like this: local pos = player.position local startingSurface = player.surface local tiles = {} for i = -1000, 1000 do for j = -1000, 1000 do tiles[#tiles + 1] = { name = ((i < -10 or i > 10) or (j < -10 or j > 10)) ...
by cpeosphoros
Wed Jan 04, 2017 5:47 pm
Forum: Modding help
Topic: game.read_file ?
Replies: 10
Views: 3257

Re: game.read_file ?

I guess, I dunno I just would have thought more people (especially those creating the mods) would follow what the documentation or information regarding what a method says, perhaps hiding the method behind some massive warning banner would work in the documentation, I know its a little more work fo...
by cpeosphoros
Wed Jan 04, 2017 5:35 pm
Forum: Modding help
Topic: remote.call only returns one value
Replies: 6
Views: 2297

Re: remote.call only returns one value

Nebelwolfi wrote:

Code: Select all

local jobCount, report = unpack(remote.call(...))
Very elegant. I will adopt it, thank you. I was using an interface callback, which though not performance relevant (real tail calls, yay Lua!!!), were quite ugly hacks.
by cpeosphoros
Wed Jan 04, 2017 5:32 pm
Forum: Mods
Topic: Cpeophoros's Mods
Replies: 21
Views: 16646

Re: Cpeophoros's Mods

Most entities (at least the ones that matter) all have a unit_number which is unique. Nice to know, thank you, it's not clear from the documentation. But I need a human readable Id, so it will work with the GUI. What I've done was add a simple counter-generated unique number to all backer names, so...

Go to advanced search