Integrated Dynamics

Integrated Dynamics

63M Downloads

Allow editing of an already-programmed variable when put into the logic programmer

tekacs opened this issue · 7 comments

commented

Issue type:

➕ Feature request

Description

This would make debugging/iterating on a chain dramatically easier.

Let me know if I'm missing a feature which already enables this or else, why this isn't supported.

When I put an already-programmed variable into the logic programmer's bottom right slot, I would expect the GUI to populate with its existing contents, allowing me to easily swap out only one of the variable fields, or similarly to the request in #192, add elements to an existing list.

Two motivating examples are:

  • The use case from #192 - adding to a list of filtered items used as a predicate.

  • When building a long/complex chain of operations - realising that an operation in the middle needed an additional filter or map step:

    When currently transforming for example:

    someList = {inventoryReader.items}
    predicate = and (contains someList x) (contains someList y)
    

    into

    someList = {inventoryReader.items}
    mappedList = map uname someList
    predicate = and (contains mappedList x) (contains mappedList y)
    

    This currently requires grabbing /not only/ mappedList, but also x and y and any other parameters used in order to reconstruct this chain - when using for example reduce or apply2 this can get really messy. If we could edit variable cards, you would only need to put the card in the logic programmer and swap someList for mappedList.

commented

I thought that when you overwrite a variable card with logic programmer it keeps it's ID? or am i mis-reading this suggestion

commented

I thought that when you overwrite a variable card with logic programmer it keeps it's ID? or am i mis-reading this suggestion

It does keep the ID. However, at the time of the original request, editing a variable loses the type and value.

commented

So this could be marked as completed?

commented

Something like this would become part of the advanced logic programmer. Hopefully I'll ever get around to implementing that...

commented

@rubensworks Would you be open to a PR for this? If so, any thoughts as to what would need changing?

At a glance, as well as the existing writeElement there needs to be support to (statically) readElement an ILogicProgrammerElement from an ItemStack and then selecting the right operator and variables in the UI based on that information?

As things stand this is my greatest headache in trying to logic program longer chains[1], so I'd be happy to make this happen.

If there's a gameplay element to this (such as this being gated behind the introduction of the 'advanced logic programmer' with other features), then I'm happy to wait for that (although I'll probably implement and play with it on my DEV build locally 😛).

[1]: On par with #367 which may be implementable whilst doing this.

commented

@tekacs If possible, a PR on this would be nice! Your suggestion on how to implement it should work, but I think some additional (non-trivial) server-client synchronization will be required.

This will definitely become part of the advanced LP, but if it can become part of the regular LP already, even better.

commented

Would really like to see this. Lists are particularly problematic when it comes to needing to edit a system.