Afforess / Big_Brother

Factorio Mod - Big Brother
ISC License
10 stars 12 forks source link

[Not A Bug][Implementation Question] [Also contains bugfix for different issue] #4

Closed ReikaKalseki closed 7 years ago

ReikaKalseki commented 7 years ago

I have a turret range research that works similarly to the radar upgrades - i.e. replacing the entity with upgraded clones. However, because the turrets all drop the base (original) entity, and the conversion-to-upgraded-entity is done with on-built and similar events, the blueprints "skip" upgraded turrets. I notice you managed to solve this for the radars, and digging through your code, I found your creation of a "blueprint dummy" radar and corresponding item. I can confirm that this is the fix, as removing it breaks radars like my turrets. However, I do not see how this works, as the minable drops, like my turrets, are of the original, even for the BP dummy. Moreover, when I imitate your solution, like this, it does not work.

Also, your "invisible radars in blueprints" is because of these lines.

ReikaKalseki commented 7 years ago

Never mind on both counts; I realized you are actually stacking both entities together, and while the 'real' radar is still skipped, the BP copy is not, yet is normally invisible. My 'fix' for the above made me realize that (two superimposed radars, one of which is not animating), and that said fix triggers said render issue, making it a poor fix.

I also found my own fix, namely making each turret drop the upgraded version, then using events to "fix" the drops.

Afforess commented 7 years ago

Sorry I was away and didn't comment at the time. It's not a great fix, I agree, and it causes invisible radars in the blueprints.

@ReikaKalseki Have you found the item route to be less troublesome? I didn't approach it that way because I didn't really want to have to try and catch all the various ways the upgraded-items could be generated in events and "fixing" them to the original item. However, I originally wrote this mod back in 0.13 when a lot of inventory events were not exposed, so the situation may have improved.

ReikaKalseki commented 7 years ago

@ReikaKalseki Have you found the item route to be less troublesome?

Mostly. The two big caveats are A) that some turrets need to be skipped, as they have no minable (usually technical entities), which also needs to be accounted for during turret/etc conversion (lest you get a "no such entity" error) and that B) some things, such as the bluebuild mod, spawn the item directly, not firing off the appropriate events.