Closed tomara-x closed 8 months ago
if you can edit the queue while you're in it... it's just as easy as pushing those entities to the end :pleading_face:
b̵̮̕y̶͉͉͗́̕ ̶̨̣̆̏s̷͙̦̈̊ö̸̬̫́ľ̷̲̭̩͈̔́͠o̴̽ͅm̴̡̟͒̀̊͝ó̶̠̲͈́̈́̚͜n̵̜̠̝̅̓,̴̖̘̹̪̿̅͊͑ ̷̟͉̭͓̀̓͐͠b̴͓̣̄̀̂̏ÿ̸̱̻̆ ̴̯̠͖̉̋̊͝t̶̪͍͍͂̇h̶͔̭́̽͊ͅe̶̩͕̞̎͘ ̵̠̻͉̥̊̆͗͠l̶̝̟̫̍̀́y̴̪̒̕r̴̗̿͒à̸̹͊,̶̧͍̉̽ ̵͚̭͙̾͋á̶̘̗̘̕n̵̘̪͙͊̂́d̵̡͉̲̣̈́̾̌͛ ̴̧̫̗̤̍̑́t̵̹̜̐̓̊̌h̷̼̗͍̑̊̏͑e̷̼͇̭̋͗ͅ ̴̤̼̈́̓͘̕b̷̮̹͋͒̓̔ȯ̸̩͎͕͚r̴̮̣̯̀̒r̷̻̳͈͚͌̿̈́̂ǒ̷̞̏͊̔w̷̱̹͗ ̴̻̻̳̈̾͘c̸̳̜̽͝h̸̡̙͈̤̿̀̒̇ẽ̸̥̤́̂̕c̶̠̻͆̽k̷͎̱̋̏̀ȅ̸͉ȓ̴͓̥̙̔̆͘,̶͈̓ ̴́̆͜͠ģ̶̖̝̥̋̆̕r̶̮̪̬͎̈́͐͒ā̷̧̉͘n̴̝̺̋͂̓̾t̸̥̐ ̷̭̤̮̽̇̿̆ṃ̵̐̾̈́͜͝e̸̡͉͖̤͒̔͛͘ ̶̡͐̍̈́t̴̝̝̰̏̀̈́̇ẖ̷̙̍̈͆̕i̴̢͉͋͛͝͠s̶̞̆ ̵̞͙̃p̷̩̦̏ỗ̵̩͠w̶̞̪̃͋̓ę̸͓͆r̷̠͐
does it work if we had a system.before(process) that looks for any loop_targets
and appends its targets to the queue [n times]?
would need to separate the actual queue from this tho, like
q = [1,2,3] and 2 has targets [8,5,7] and n = 2 so the queue in process end up as [1,2,3, 8,5,7, 8,5,7] but that shouldn't grow, like the appended portion has to only be added once... i love your foggy thinking hehe
ye ye, find what has loops get its target (this happens every frame) append those to the queue, while keeping the queue separate (don't modify it) and then loop the whole thing
now, nested loops..
q = [1,2,3] 2.targets = [8,5,7] 2.n = 2 5.targets = [a,b,c] 5.n = 3
queue should be [1,2,3, 8,5,a,b,c,a,b,c,a,b,c,7, 8,5,a,b,c,a,b,c,a,b,c,7]
so we need to find them recursively
q.iter().flatten().chain(loopq.iter())
^ in your face, you sleepy bitch!
use resize for pushing the targets to the loop queue loopq.resize(len+n, targets)
we could just, yknow, implement it by looping. so providing something like 3 or 4 layers. who on earth, ever, in the history of everness, needs more than 4 layers of nested loops?
if i'm thinking about this correctly, this would also act as a guard against infinite loops, right?
so if x targets y (with n count) and y targets x (with m count) this would result in a loop queue like: [y(n times), x(m times), y(n times), x(m times)]
so a finite amount, instead of an infinite loop immediately causing an out of memory
you can still cause ridiculous things if you misuse it tho. like branching loops and each branch targets back to the root. or just pain old big (TM) numbers. i wonder if inf would work hehehehe
hmm.. change detection for the inner loops tho.. i don't wanna update it every frame!
just admire it f63f656
i'm happy with 90eba5e, as the target vec can hold duplicated id's it's easy to construct something like [a,b,c,a,b,c] and then loop that for an arbitrary number, resulting in [a,b,c,a,b,c,a,b,c,a,b,c,...] and it's also good to keep this system small. maybe a different approach (in addition to this) can be an op (in process) that takes the target vec of an input and repeats that (this way it's not even limited to a certain depth of nested loops)
(target copying would be nice too, just like the array copying)
maybe even ditch the idea of "loop" and make it just a "process" op (just process those targets in logic time) and the looping part can be done with this target repeating method instead
this opens up a whole new bag of doritoes.. i would really like a bunch of array ops in addition to repeat, zip, unzip, join, split(how?), push, pop, so much cuteness :smiling_face_with_three_hearts: edit: those are in #98
6bd9b9f yeah, repeat eliminates the need for a loop count, it'll be "process" instead
don't forget inexistent entity checking
good job mara <3
in the order they appear in the targets array
this allows looping any set of ops
they should be kept at order 0 to avoid them being reprocessed in the main queue