stormbringer951 / CaptainsLog

2 stars 3 forks source link

Add toggle to remove arrows from vanilla Fleet Logs #76

Open stormbringer951 opened 1 year ago

stormbringer951 commented 1 year ago

Not clear how to implement; make request to Alex to change defaults

jaghaimo commented 1 year ago

You could replace objects of BreadcrumbIntel class with MyBreadcrumbIntel objects which extends BreadcrumbIntel and overrides getArrowData(). Messy and ugly :(

stormbringer951 commented 1 year ago

You could replace objects of BreadcrumbIntel class with MyBreadcrumbIntel objects which extends BreadcrumbIntel and overrides getArrowData(). Messy and ugly :(

Yeah, it's something I'm resistant to but having the arrows is really ugly.

I suppose I can add it as an optional extension feature defaulted off; would probably have to implement some way of replacing old BreadcrumbIntel items if I want to uninstall. Would just have to be very careful that I only selectively replace intel items I mean to.

jaghaimo commented 1 year ago

If you do replacement route, I'd do it via composition AND inheritance + Lombok delegates. E.g. something like:

@RequiredArgsConstructor
public class WrappedBreadcrumbIntel extends BreadcrumbIntel {

    @Delegate
    private final BreadcrumbIntel actualIntel;

    public List<ArrowData> getArrowData(MapWhatever asd) {
       if (SomeSettings.wantsToShowArrows()) {
          return super.getArrowData(asd);
       }
       return null;
    }
}

This way, your new intel behaves exactly like the old one. You just remove it from intel manager, and add your wrapper instead. No need to mess with scripts that run against that intel, or anything it does, really.

You probably need to override isEnded / isEnding and shouldBeRemoved to cleanup in case the original is considered done.

Just an idea.

stormbringer951 commented 1 year ago

If you do replacement route, I'd do it via composition AND inheritance + Lombok delegates.

Huh. Not played with Lombok before, that's much neater than I feared. Actually, looking through the whole Lombok feature list, it has a lot of cool stuff.

Would also make uninstalling CaptainsLog and restoring the delegated intel much cleaner. Hrmmm...