Jump to content

Mod Character Tag Limit


Recommended Posts

@SuperDavid Had an issue like this before, I'm not sure what that person did for a workaround.

What I would suggest doing, if you're able to do it, is to use netvariables instead of just tags and then hook your respective functions that you're using internally to use your netvar values in addition to their normal default tag-checking behaviour.

In this case the player's eater component's TestFood for the server-side logic, and then the component action to let clients know that they're able to eat the items by adding your own component action for the edible component to include the ACTIONS.EAT action.

Link to comment
Share on other sites

If you use net variables, like CarlZalph suggested, you can decrease the network load by working with bytes rather than entire strings, which are more expensive. That's another advantage you have.

Question: how many tags did your character have and why does it need so many tags?

Edited by Joachim
Link to comment
Share on other sites

My character has so many tags because it seems to be adding a eater tag to my character. If I am not suppose to eat something it removes the tag on my character with

self.inst:RemoveTag(v.tag.."_eater")

I got the mod in a current "stable" condition because I moved beefalowool eat function into the scruffy.lua from the it originally being in modmain.lua

Something strange is I can't find where it adds the tag.

Edited by SomeoneStrange
Link to comment
Share on other sites

  • Developer
14 hours ago, SomeoneStrange said:

My character has so many tags because it seems to be adding a eater tag to my character. If I am not suppose to eat something it removes the tag on my character with


self.inst:RemoveTag(v.tag.."_eater")

I got the mod in a current "stable" condition because I moved beefalowool eat function into the scruffy.lua from the it originally being in modmain.lua

Something strange is I can't find where it adds the tag.

first off you have a hard limit of 32 tags per entity, this can technically be bypassed, but its really not worth it as the extra network load would be really bad.
secondly tags get added to your entity from a number of sources:

  • like adding a component with a replica, that adds a "_componentname" tag
  • stategraphs have a number of tags which not only get added to the "stategraph tag list" but also get applied to the player
--List with the quotes so the code is more searchable as tags
local SGTagsToEntTags =
{
    ["attack"] = true,
    ["autopredict"] = true,
    ["busy"] = true,
    ["dirt"] = true,
    ["doing"] = true,
    ["fishing"] = true,
    ["flight"] = true,
    ["giving"] = true,
    ["hiding"] = true,
    ["idle"] = true,
    ["invisible"] = true,
    ["lure"] = true,
    ["moving"] = true,
    ["nibble"] = true,
    ["noattack"] = true,
    ["nopredict"] = true,
    ["pausepredict"] = true,
    ["sleeping"] = true,
    ["working"] = true,
}
--snip
    if TheWorld.ismastersim or self.inst.Network == nil then
        for k, v in pairs(SGTagsToEntTags) do
            if self.tags[k] then
                self.inst:AddTag(k)
            else
                self.inst:RemoveTag(k)
            end
        end
    end
  • and a number of other various sources(seriously just search AddTag in find in files for the games source code, you'll find a number of tags that get added to your prefab without your doing heck just look in scripts/prefabs/player_common.lua MakePlayerCharacter @ line 1087

basicaly to note, you probably have a ton of tags that get added without your knowing, but 99% of the time you shouldn't be adding tags on a per item basis, as thats a sure way to run out of tags.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...