A new prototype type to declare magic entities?

Things that we aren't going to implement
User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 248
Joined: Fri Feb 16, 2018 5:21 am
Contact:

A new prototype type to declare magic entities?

Post by mrudat »

It would be useful to be able to declare that a given entity is magic (has additional behaviour that is supplied by a control script), so that if a mod creates a derived entity, it too can be flagged as being magical, without requiring explicit support in both mods.

something like:

Code: Select all

data:extend{
  {
    type = "magic-entity",
    name = "battey-powered-miner",
    entity = "battery-powered-miner"
    control_script = "aai-vehicles-miner"
  }
}
and then, in control, instead of a hard-coded list of magic entities, you can do a find_magic_entity_filtered{control_script='script-name'}, and apply magic to all of the desired entities with no further effort required to support other mods that want to make more magic entites.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: A new prototype type to declare magic entities?

Post by eradicator »

A freetext "tag=" on PrototypeBase would be sufficient.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 248
Joined: Fri Feb 16, 2018 5:21 am
Contact:

Re: A new prototype type to declare magic entities?

Post by mrudat »

eradicator wrote: Sat Sep 12, 2020 10:31 am A freetext "tag=" on PrototypeBase would be sufficient.
Ah, but what if you want to make something magic in two ways; if you have just one tag, only one value can be associated; you could also do a set of tags, so this thing is interesting to mod 1 and mod 2.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: A new prototype type to declare magic entities?

Post by eradicator »

mrudat wrote: Sun Sep 13, 2020 9:11 am
eradicator wrote: Sat Sep 12, 2020 10:31 am A freetext "tag=" on PrototypeBase would be sufficient.
Ah, but what if you want to make something magic in two ways; if you have just one tag, only one value can be associated; you could also do a set of tags, so this thing is interesting to mod 1 and mod 2.
Sorry i meant to write that in plural. A group of freetext strings. Like LuaEntity.tags or LuaEntityPrototype.flags. As those two names are already in use you'd have to name it something else. Or allow non-hardcoded flags.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Won't implement”