• Content count

  • Joined

  • Last visited

Community Reputation

1,769 Excellent


About CarlZalph

  • Rank


Visited by the Title Fairy
  • Visited by the Title Fairy

Recent Profile Visitors

7,248 profile views
  1. I'm not sure what you're asking for, but this is what I think you're trying to ask for. local function HookThis(component) AddComponentPostInit( component, function(inst) if not GLOBAL.TheWorld.ismastersim then return end inst.inst:AddTag("Ayy") end ) end local HookThese = { "burnable", "container", "crop", "dryer", "harvestable", "machine", "wardrobe", "sleepingbag", "deployable", } for _,v in pairs(HookThese) do HookThis(v) end
  2. I learned LUA through the reading of the documentation on it online, using a local LUA 5.1 installation to run scripts for language syntax testings, and pouring over the DST code base. For modding in DST you will be reading over every crevice of the code base repeatedly to find things until you get a basic grasp over many things. Depending on what you want to end up with you'll have to become knowledgeable in the area before being able to work on it effectively. Use a program like N++ that has a find in files option to find specific strings is very handy. I have prior knowledge on programming under my belt, so learning the language wasn't hard. Some things that had me check up online that come to mind were some syntax things, how everything is a variable, meta tables, and the very neat but easily broken debug library. Meta tables are sort of like operator overloads in other languages, but has some other uses that act more like hooks than anything. Something you'll need is time to learn and the motivation to do so.
  3. In data/scripts/prefabs/beeswax.lua: local function _OnFireMelt(inst, StartFireMelt, StopFireMelt) inst.firemelttask = nil inst:RemoveEventCallback("firemelt", StartFireMelt) inst:RemoveEventCallback("stopfiremelt", StopFireMelt) if not inst.melted then if inst:IsAsleep() then inst:Remove() else inst.melted = true inst.persists = false inst.components.inventoryitem.canbepickedup = false inst:AddTag("NOCLICK") inst.AnimState:PlayAnimation("melt") inst:ListenForEvent("onanimover", inst.Remove) inst:ListenForEvent("entitysleep", inst.Remove) end end end Has an error with the specific event it should be listening for to remove itself post animation. inst:ListenForEvent("onanimover", inst.Remove) Should be: inst:ListenForEvent("animover", inst.Remove)
  4. Yeah, net variables are used to pass information to the client and RPCs are for the client to pass information to the server. Since this is all on the client only, then you'll be missing out on server-only state changes. I believe the replica stategraph is used only when the server-client is the same. I don't believe clients ever get information about the stategraph in a full client-server setup. I know I tried looking for a way to hook animation changes but it was a bit hairy. I'll look back into this some time later.
  5. From data/scripts/debugtools.lua: local table_keys = {} for k,v in pairs(obj) do if type(k) == "table" then table.insert(table_keys, k) else table.insert(keys, k) end end table.sort(keys) for i,k in ipairs(table_keys) do -- sort breaks on keys that are tables, so just put them on the end table.insert(keys, k) end The call to table.sort(keys) makes no attempt to sort same-type variable types and will error out when, for example, a string is compared to a number for sorting. This can be fixed by splitting each type into their own subtable and then sorting each subtable and then adding them to the keys table. local tosort_keys = {} for k,v in pairs(obj) do local thetype = type(k) tosort_keys[thetype] = tosort_keys[thetype] or {} table.insert(tosort_keys[thetype], k) end for k,v in pairs(tosort_keys) do if k ~= "table" -- sort breaks on keys that are tables, so just put them unsorted then table.sort(v) end for k,v in pairs(v) do table.insert(keys, v) end end
  6. From my recollection of the stategraphs and replicas the client state graph self applies a busy tag on many states but doesn't do the same for being hit. The check for the component existing is for the case of a client being the same as the host (hosting a room without caverns enabled). If you're just wanting to tell the client that their server-side state graph changed then perhaps you might find a net variable to be useful that either contains the string of the current state, or an index thereof to shorten the network payload.
  7. From the hounded component it takes the average of all of the active players' ages into consideration. There's a 10% chance that a fire hound will spawn if the average player age is >15 days and <30 days and the season is not winter or spring. If you're playing on a public room, then chances are there people who are new and drag the overall average down below this threshold. Take, for example, 9 players with the ages of 15 and 1 player with the age of 14. This averages to 14.9 and is below the threshold.
  8. The mod the person is using bypasses this by adding a custom RPC call to run certain functions in relation to the set user's privs. As for the colouring the colour is set on client connect by the server on the C-side as far as I'm aware.
  9. The issue is that mandrakes when hit, but not killed, will lose their leader in the follower component and not get another. If the mandrake is in the follow behaviour in the "BACKOFF" stage when hit, then it will perpetually run away. Otherwise, it will sit and not follow anyone anymore. A simple hotfix to this is to make the timer always run in scripts/prefabs/mandrake_active to scan for new potential players to latch onto for a leader and never cancel the timer.
  10. From the still image it looks like Wes is juggling a couple of balls. ..Juggle emote?
  11. For those using my file structure for dynamic keybinds, the game update from today put a restriction on a filepath directory.

    Move the 'DST_Scripts' folder into the DoNotStarveTogether folder and edit the root customcommands.lua file to use "../DST_Scripts/" as the path, instead of "../../DST_Scripts/".


    I would put this in the thread that has it, but it's so old that it's archived.

    Putting it here so perhaps maybe someone somewhere will see this and find it useful if it's applicable to them.

    1. Mobbstar


      ask joew or a moderator like MrL to unlock

    2. ImDaMisterL


      Ask JoeW if you want, mods still don't have the ability to unarchive topics :(

  12. Sanity Loss around Ponds?

    @pickleplayer I'd recommend checking out my posting, as the code I posted in the other thread will be more compatible with other mods should multiple mods try to add their own custom rates in it. As it stands if anyone else does the same for yours, then the last loaded mod will override the function for the prefab.
  13. Which can be changed by my mod here: Or through the use of the mouse wheel to scroll along the tabs.
  14. Sanity Loss around Ponds?

    At the bottom of my post there lies code that will do what you want with some very minor tweaking.