Read access to LuaEntityPrototype.max_logistic_slots

Things that already exist in the current mod API
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Read access to LuaEntityPrototype.max_logistic_slots

Post by eradicator »

I can see it in the prototype explorer but can't read it from the API. LuaEntity.filter_slot_count isn't an option because I need to know the maximum number of possible filters (which can be infinite).
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
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Read access to LuaEntityPrototype.max_logistic_slots

Post by eradicator »

Thank you very much! I must've had a mind-block because the prototype explorer shows it as max_logistic_slots.

Thead can be moved to "already exists".
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.
curiosity
Filter Inserter
Filter Inserter
Posts: 469
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Read access to LuaEntityPrototype.max_logistic_slots

Post by curiosity »

There is about as much in common (if not less) between prototype explorer and data/control stage as between the stages themselves. So take what it shows with a grain of salt.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Read access to LuaEntityPrototype.max_logistic_slots

Post by eradicator »

curiosity wrote: Sun Aug 15, 2021 7:03 am There is about as much in common (if not less) between prototype explorer and data/control stage as between the stages themselves. So take what it shows with a grain of salt.
Not as bad as you make it sound, but I know what you mean. And I did ctrl+f "slot" and "logistic" all over the place because max slots not being exposed felt odd. Alas it somehow slipped through.
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14248
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Read access to LuaEntityPrototype.max_logistic_slots

Post by Rseding91 »

Yeah. The prototype explorer takes the internal variable name we use (the C++ variable name) and does this to it:

Code: Select all

std::string PrototypeExplorerWidgets::demangleMemberName(std::string_view name)
{
  {
    constexpr std::string_view key{ "this->" };
    if (StringUtil::startsWith(name, key))
      name = std::string_view(name.data() + key.size(), name.size() - key.size());
  }

  const std::string lower = StringUtil::toLowerCopy(name);

  std::string result;
  result += lower[0];

  char last = ' ';
  for (size_t i = 1; i < name.size(); ++i)
  {
    if (name[i] != lower[i])
      if (last != 'i' || lower[i] != 'd')
        result += ' ';
    result += lower[i];
    last = lower[i];
  }

  return result;
}
So, it sometimes matches the Lua API, sometimes matches the data stage names. Sometimes it's neither.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Already exists”