allow utility-sprites in add_custom_alert

Things that we aren't going to implement
Post Reply
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

allow utility-sprites in add_custom_alert

Post by Optera »

What?
Extend add_custom_alert to allow utility sprites
Why?
To use for example warning-icon.png with add_custom_alert mods have to create a virtual signal for something that's already defined as utility-sprite.
It feels weird how we can use

Code: Select all

[img=utility/warning_icon]
in normal rich text but not as icon for custom alerts.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: allow utility-sprites in add_custom_alert

Post by Rseding91 »

Custom alerts were created for the programmable speaker and use in conjunction with the circuit network (which also uses SignalID). As a result the custom alert class doesn't store images. It stores SignalIDs, so this simply isn't possible.

Code: Select all

class CustomAlert : public Alert
{
  using super = Alert;
public:
  CustomAlert() = default;
  CustomAlert(Entity* entity, MapPosition position, uint32_t tick, SignalID icon, const LocalisedString& message, bool showOnMap);
  CustomAlert(const CustomAlert&) = delete;
  CustomAlert(CustomAlert&& other) noexcept;
  void load(MapDeserialiser& input);
  void save(MapSerialiser& output) const;
  CustomAlert& operator=(const CustomAlert&) = delete;
  CustomAlert& operator=(CustomAlert&& other) noexcept;

  const Sprite* getIcon() const;

  SignalID signalID; // used to determine the icon showed
  LocalisedString message;
  bool showOnMap = true;
};
The class would have to be altered to store additionally the string sprite name as defined by Lua, save/load logic added for it, and the surrounding code altered. That all seems well outside of what I want to do.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”