Jump to content

Kramped code is inflexible


Recommended Posts

I have been looking at the code of the Kramped component, because I wanted to add naughty points for some new prefabs. I noticed, however, that the Kramped code is highly inflexible. There is not even a lookup statement. Just a huge branching structure with lots of if-checks. If pigman and not werebeast, then 3 naughty points, if catcoon, then 5, if glommer, then 50.

This surprises me, as the code is usually quite flexible. Why not use a lookup table (that can be easily extended) like this?

JUDGEMENTS = {


    ["pigman"] = function(victim)
    if not victim.components.werebeast
    or not victim.components.werebeast:IsInWereState() then
        return 3
    else
        return 0    
    end
    end,
    ["babybeefalo"] = 6,
    ["teenbird"] = 2,
    ["smallbird"] = 6,
    ["beefalo"] = 4,
    ["crow"] = 1,
    ["robin"] = 2,
    ["robin_winter"] = 2,
    ["butterfly"] = 1,
    ["rabbit"] = 1,
    ["mole"] = 1,
    ["tallbird"] = 2,
    ["bunnyman"] = 3,
    ["penguin"] = 2,
    ["glommer"] = 50,
    ["catcoon"] = 5,
}

Edited by Joachim
Link to comment
Share on other sites

Where does it say that? I can't find it on the Krampus page.

If you're right, it would explain a lot about the code. But what determines naughtiness then? Is killing non-monsters always worth 1 point if what you say is true?

Link to comment
Share on other sites

Hmm... I'm not able to find out where I read it... =/

I just remember, cause I'm quite new to the game, somewhere I read about naughtiness and searched it in the dont starve wikia. Then I read half through the Krampus or any other linked article and noticed something that said naughtiness does not exist in DST, so I stopped reading more about naughtiness.

But since I'm not able to find it... maybe I missunderstood something...

Link to comment
Share on other sites

if it exist, of course you are right, that the code is infexible.
But I don't think any dev is reading here... you could try the suggestions part of forum, but it seems this is also not read by any dev (so many important features were suggested there years ago :D)
So the only way to be heard by the devs is a bugreport is guess.

Link to comment
Share on other sites

You could also give a niceness component to the monsters that give naughty points.

And naughty points indeed exist. What you probably read was that naughtiness points are not available for clients. And that the kramped component isn't a player component, and it's now a world component (that tracks all players playing).

Because of that, mods like Combined Status (client only mod) can't display naughtiness (unless you make a server/client mod, that communicates the naughty points to clients).

Link to comment
Share on other sites

17 minutes ago, DarkXero said:

Because of that, mods like Combined Status (client only mod) can't display naughtiness (unless you make a server/client mod, that communicates the naughty points to clients).

ah yes, that might be the place where I read about naghtiness! Thanks for clarifying that :)

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...