Page 1 of 1

A new prototype type to declare magic entities?

Posted: Sat Sep 12, 2020 4:03 am
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.

Re: A new prototype type to declare magic entities?

Posted: Sat Sep 12, 2020 10:31 am
by eradicator
A freetext "tag=" on PrototypeBase would be sufficient.

Re: A new prototype type to declare magic entities?

Posted: Sun Sep 13, 2020 9:11 am
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.

Re: A new prototype type to declare magic entities?

Posted: Sun Sep 13, 2020 9:58 pm
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.