Zomis / FactorioMods

Various mods for the game Factorio
https://mods.factorio.com/mods/zomis
MIT License
15 stars 7 forks source link

Advanced Combinators: Bitwise Operations? #33

Closed Ristellise closed 6 years ago

Ristellise commented 6 years ago

I do not see any bitwise operations for advanced combinators, Is it possible if you could add those?

Zomis commented 6 years ago

Absolutely! http://lua-users.org/wiki/BitwiseOperators How many do you want? :) bitwise-not, bitwise-xor, bitwise-and, bitwise-or definitely, would you like left/right shift/rotate as well?

Ristellise commented 6 years ago

think all of them would be a nice feature to have!

Also I'm getting a crash everytime I press Apply with this code:

set_simple(1,virtual/signal-0,const(1));
set_simple(1,virtual/signal-1,const(1));
comment(Empty command);
set_signal(mod(const(1),const(1)),signal(signal_type(virtual/signal-0),const(1)));
Ristellise commented 6 years ago

Image log: factorio 2018-01-18 21 15 00 568

Zomis commented 6 years ago

Whoops, I will need to add some boundary check there. The problem is that mod(const(1),const(1) evaluates to 0, which makes the command set_signal(const(0),signal(signal_type(virtual/signal-0),const(1))); which fails because the index (the first parameter to set_signal) needs to be within the range of 1..24. I will add a boundary check for that.

Zomis commented 6 years ago

This will be added in the next release, which might be within a few days.

Zomis commented 6 years ago

Fixed and released: https://mods.factorio.com/mod/advanced-combinator