fCPU


Factorio Customizable Processing Unit. Allow to write any logic on low level machine code. The fCPU acts like a programmable microcontroller with a vector coprocessor that supports many useful instructions.

Content
9 months ago
0.18 - 2.0
11.4K
Logistic network Circuit network

b uiss and ugpf bug

7 months ago
(updated 7 months ago)

There seems to be a bug affecting uiss and ugpf in 0.4.33. Trying to use either command with parameter 2 being a signal copied from a wire causes the destination register to be set to a null signal.

mov r1 [item=iron-plate] 
ugpf r2 r1 'stack_size' ; works
mov r1 red1 ; red1 is some number of iron plate
ugpf r2 r1 'stack_size' ; sets r2 to null

Tested by modifying opcodes.lua to dump the signal value:

  uiss = function(_) -- Utility Item Stack Size
    Assert.two(_)
    local signal = io.gettype(_[2], {'type', 'register'})
    if signal.type ~= 'item' then
      io.setsignal(_[1], NULL_SIGNAL)
      local str = signalToStr(signal)
      Assert.exception('Expecting [item=...] signal type, got \''.. str .. ' ' .. dump_value(signal) ..'\'.')
    else
      local proto = prototypes.item[signal.name]
      Assert.check(proto ~= nil, 'Unknown item name specified.')
      io.setsignal(_[1], { signal=signal, count=proto.stack_size })
    end
  end,

The output of this indicated that the signal object only has a name field, no type. This causes the if condition to be true, and the destination register to be set to a null signal.

Removing the if signal.type ~= 'item' then statement from both uiss and ugpf seems to fix the issue and hasn't (so far) caused any new problems for me.

New response