• Content count

  • Joined

  • Last visited

 Content Type 




Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Everything posted by rezecib

  1. Try to keep the "I have a problem with my mod" posts to their own topics. I read literally everything in this subforum, so I will see it. First off, I know this is a really long post. The thing is, modding is complicated, and there are a bajillion directions you can go with it, so just trying to cover the basics is still quite a lot of stuff. I tried to organize it so that you can skip to parts that are relevant to you, though. Unfortunately, I don't think I can fix the within-post links, which worked in the old forum software but there doesn't seem to be a way to repair them now. If you're skipping this because it's too long, or are only going to skim for parts you want, here's the minimal set of things I recommend you read: Introduction General Advice Basic Lua guide (you have to open the spoiler for this before you can jump to its sub-entries) LuaGuideLooseTyping'>Loose Typing LuaGuideMinimal'>Minimal Evaluation LuaGuideTables'>Tables LuaGuideObjects'>Tables as objects (and how to modify their functions nicely) Reading the code Start with another mod or game files Tips on fixing crashes Transitioning from Don't Starve to Don't Starve Together Using the same code for both games New TheThings New stuff in the modinfo List of things that are mosty the same (with notes on minor differences) Differences New things in prefabs Informal explanation of major engine differences (replicas, classifieds, netvars, and RPCs) Component Actions Other miscellaneous differences List of things that are currently not (nicely) moddable Other guides for DST Selected useful guides from the single-player mod forums Introduction I decided to write this modding tutorial because when I was getting started modding, none of the tutorials really did it for me. I don't want to devalue the effort that was put into the other tutorials-- and there are many (here's a compilation of guides for DS), and many of them are great at explaining how to do specific things. The reason why there aren't any good tutorials on generally getting started is that getting started is actually really hard, and there are a lot of directions you could go, so it's really hard to cover them all. Hopefully this tutorial at least helps with that a little. General Advice I think most people get started with an idea. So you have a thing you'd like to mod into the game, maybe a new item or character. How do you get started? Well, the first thing is you have to know how to write code (that is, in general, in any language). There are lots of tutorials/lessons/etc around the internet for learning that. Next, you need to be able to read and write Lua code specifically. Personally, being told to "go learn Lua" isn't something that works for me. If it does for you, then definitely go do that! It'll probably give you a well-rounded understanding of the language. If it doesn't work for you, though, then you probably need to dig into some existing Lua code. The best place to do that is the game's code. Think of things in the game that are similar to what you want to do, find them in the files, and keep reading/poking at them until you understand how they work. At first, this will be hard-- there are aspects to Lua you may not understand. You'll just have to look them up as you go. As for general information on how the game logic is put together, the thing that I found most helpful was Wots The Diff??. Basic Lua Guide A few aspects of Lua are really, really important, though, so I've written a little very informal guide on some of them: Minimal evaluation (or short-circuit evaluation): Tables: Tables as objects (and how to modify their functions nicely): Reading the code Next, you have to be able to read the game's code. I can't stress this enough; how can you expect to mod something if you can't even go about figuring out how it works in the first place? You don't have to understand how ALL the code works, but you need to be able to understand at least the part you're modifying. I think the biggest problem people have here is that they don't know how to go about looking at the game's code. So I'll give some recommendations. Start with another mod or game files Once you're about to start writing the code for the mod, I wouldn't recommend just starting completely fresh. It's way simpler and easier to take the most similar mod you know of, or the most minimal mod you know of, copy that folder, then rename and change things. This ensures you have all the pieces you need (modmain, modinfo, etc), and then you can see what you need to change. Similarly, when you're making a new item or creature, start by copying over the most similar item/creature from a mod or the game files. This ensures that you aren't missing crucial stuff. So, for example, you want to make a new equippable; start by copying over spear.lua, and look at a mod that adds an item to see that you need to add it to the PrefabFiles table in the modmain. Once you have the copy, you can start renaming things and changing the assets or properties. Tips on fixing crashes Transitioning from Don't Starve to Don't Starve Together So all of that covers most of the stuff I can think of for how to generally approach modding. Now let's cover the differences from DS to DST (because there are plenty of tutorials for how to do specific stuff in DS). Using the same code for both games New TheThings New stuff in the modinfo List of things that are mosty the same (with notes on minor differences) Differences New things in prefabs Informal explanation of major engine differences (replicas, classifieds, netvars, and RPCs) Classifieds: Networked variables: Remote Procedure Calls (RPCs): Simplex's explanation of the purposes of replicas and classifieds: Components previously attached to players The main other engine change that I'm aware of is that some components that were before attached to the player are now attached to the world, instead (such as hounded, hunter, and kramped). Additionally, many of the components attached to the world have been rewritten to sync over the network and are currently pretty unmoddable (that includes clock, weather, ambientlighting, etc). As part of this, some things that were previously handled by ListenForEvent are now handled by WatchWorldState. Looking at worldstate.lua (in components) is the best way to see what was changed, but pretty much any clock/weather related events are now accessed by WatchWorldState. Component Actions Other miscellaneous differences Probably a few more things that aren't occurring to me now. List of things that are currently not (nicely) moddable Other guides for DST Selected useful guides from the single-player mod forums Hopefully this guide was helpful, and if you have anything you think I should add (especially more things we specifically can't do, or need to be done slightly differently in DST), definitely let me know!
  2. function Text:SetSize(sz) if LOC then sz = sz * LOC.GetTextScale() end self.inst.TextWidget:SetSize(sz) self.size = sz end function Text:SetSize(sz) return self.size end I assume the second entry was intended to get GetSize. It also seems a bit problematic that self.size stores the inflated size, so if one were to store sometextwidget.size and use it to set it later, it would cause compounding of the LOC.GetTextScale() multiplier.
  3. Geometric Placement

    Version 2.4.11


    This should work with all versions of the game (vanilla, Reign of Giants, Shipwrecked, and Don't Starve Together). Also available on the Steam Workshop (single-player, DST). Snaps objects to a grid when placing and displays a build grid around it (unless you hold ctrl). Credits to zkm2erjfdb and Levorto for writing the original single-player versions (Architectural Geometry and Assisted Geometry). This mod is a replacement for those mods; if you have one of them enabled as well, unpredictable things will happen. Description of the options: CTRL Turns Mod: "On" makes it so that the mod is off by default, but turns on while holding CTRL. "Off" does the opposite, temporarily disabling the mod while holding CTRL. Options Button: By default, "B" (for controllers, right-stick click in single-player and left-stick click from the scoreboard in DST). Brings up a menu for changing these options. Note that it cannot save these options in-game like it can on the configuration menu, so if you find new favorite settings with this, you should make those changes in the configuration menu too. Toggle Button: By default, "V" (no binding for controllers). Toggles between the most recently used geometries (it will guess if it doesn't know, which should only happen if you just transferred between the caves and the surface or joined the game). In-Game Menu: If set to "On" (default), the options button will bring up the menu. If set to "Off", the button will simply toggle the mod on and off (like it did before the menu was added). Show Build Grid: Determines whether it shows the grid at all. Grid Geometry: The shape and layout of the grid. Square is the normal one, aligned with the game's X-Z coordinate system. The hexagonal geometries allow you to do the tightest possible plots. Walls and turf always use the square geometry. Refresh Speed: How much of the available time to use for refreshing the grid. Turning this up will make the grid update faster, but may cause lag. Hide Placer: If set to on, the ghost-version of the thing you're about to place is hidden, and instead the point where you'll place it is marked. Hide Cursor: If set to on, the item you're placing won't show up on the cursor while you're placing it (sometimes it gets in the way of being able to see where you'll put it). Fine Grid Size: The number of points in each direction that it uses for things with a fine grid (most things). Wall Grid Size: The number of points in each direction that it uses for walls. Sandbag Grid Size: The number of points in each direction that it uses for sandbags. Turf Grid Size: The number of points in each direction that it uses for turf/pitchfork. Colors: Red/Green is the game's normal color scheme. Red/Blue should be more readable to players with red-green colorblindness. Black/White is there for fully colorblind players, or players who want the grid to be more readable at night. Outlined uses black and white with outlines to give the best visibility in all situations. Tighter Chests: Allows chests to be placed more closely together. This doesn't always work in DST. I keep this only as a legacy setting because the other geometry mods override a special case the game makes for chests. Controller Offset: Allows you to disable the usual offset that rotates around the player when placing objects. Defaults to off. Show Nearest Tile: In addition to showing each of the points, this can set it to show the outline of the nearest tile, making it easier to align placement with the turf. Hide Blocked Points: Instead of showing red/black points where you can't place things, this can set it to hide those points instead. Overlay Grid: Instead of letting points be hidden behind trees, beefalo, or the player, this makes them overlay on top so the full grid is visible.
  4. Combined Status

    But Combined Status doesn't show the stats of items, maybe you're thinking of Display Food Values or the Crockpot Simulator?
  5. Combined Status

    Version 1.7.7


    Works with all versions of the game (Don't Starve, Reign of Giants, Shipwrecked, and Don't Starve Together). Also available on the Steam Workshop (single-player, DST) This mod enhances the HUD to better show the player's stats and various information about the world, such as temperature, season, and moon phase. This is a client-only mod, so whoever has enabled it will see the changes, and whoever doesn't won't, regardless of what server you're on and whether the server has the mod or not. Unfortunately Naughtiness is not available to clients in Don't Starve Together, so adding it would make it so everyone would have to have the mod. Temperature is available, however. Credits to Kiopho and Soilworker for making the mods for single-player, and giving me permission to publish and maintain the DST versions! Configuration options: Temperature: Whether to show the temperature of the player. Defaults to Show. Show World Temp: Whether to show the temperature of the world. Defaults to Hide. Show Temp Badges: Whether to show small images to indicate which temperature is which. Badges only get shown if this is set to Show and both player and world temperatures are enabled. Defaults to Show. Temperature Unit: Whether to use the game's internal units (default), or approximations of Fahrenheit or Celsius. In Game Units, the player freezes at 0 and overheats at 70, with warning occurring 5 away. In Celsius, the player freezes at 0 and overheats at 35, with warning occurring 2.5 degrees away. In Fahrenheit, the player freezes at 32 and overheats at 95, with warning occurring 4.5 degrees away. Show Waning: Whether to show if the moon is waxing or waning by adding new icons. Defaults to Show. (The game normally only shows icons for one direction). In Don't Starve Together, this is always on regardless of what you set, because it's a feature of the main game now. Show Moon: Whether to show the moon only at Night (the game's default), during night and dusk (Dusk, the mod's default), or Always. Predict Full Moon: Whether to predict the day of the next full moon, shown when hovering over the moon icon. Defaults to Yes. Flip Moon: Whether to flip the moon phase icon to show it like it is in the Southern Hemisphere, instead of the default Northern Hemisphere. Defaults to No. Season Clock: Clock, the default, shows a full clock of the seasons. Compact shows a smaller badge with the season and day count, while Micro shows an even smaller badge. No disables the season clock entirely. Naughtiness: Whether to show the naughtiness of the player. Doesn't work in Don't Starve Together, as naughtiness is not available to clients. Defaults to Show. Log Meter: Whether to show the log meter for Woodie when he is human. Only relevant to singleplayer, as Don't Starve Together always shows the log meter already. Defaults to Always. Cave Clock: Whether to always show the clock in the caves. Only relevant to singleplayer Reign of Giants, as the data is not available in vanilla and the clock shows in Don't Starve Together. Defaults to Show. Stat Numbers: Whether to show the sanity, hunger, and health numbers without having to mouse over the badges. Defaults to Always. Show Max Text: Whether to show the "Max:" text when hovering over the sanity, hunger, and health badges to see their maximum values. Defaults to Show. HUD Scale: Lets you adjust the size of the badges and clocks independently of the game's HUD scale. Defaults to 1.
  6. Combined Status

    @Zeldicon What do you think could be updated in response to Warly and the food changes?
  7. In scripts/prefabs/veggies.lua, placers were added for each of the veggie seeds in the MakeVeggie function. However, they don't get added to the returned prefab table because only the first three return values are captured. This is also an obstacle for Geometric Placement compatibility, as the placer prefab is missing.
  8. Combined Status

    @legends0356 It needs to be extracted from the zip, so that it goes: mods/CombinedStatus/modinfo.lua; if the modinfo isn't visible at a path like mods/somemodname/modinfo, then the game won't see it.
  9. Combined Status

    I don't maintain the server version so it's up to them to update it
  10. Normally when the Aporkalypse starts, the existing season and its progress is saved, to be resumed later when the Aporkalypse ends. However, seasonmanager_pork.lua doesn't include pre_aporkalypse_season and pre_aporkalypse_percent in its OnSave and OnLoad methods. The aporkalypse component does save/load the current season, but it doesn't pass it back to SeasonManager in EndAporkalypse() (and it also doesn't save the season percent).
  11. When moving around a meteor impact, such as the ones near the Iron Hulk (ancient robot things), they seem to slide over the ground slightly. This is fixed by setting their anim orientation to OnGround: inst.AnimState:SetOrientation(ANIM_ORIENTATION.OnGround) They might need some further adjustment after this (perhaps rotation or something).
  12. Geometric Placement

    @MP98 Let me know if you figure it out, although it may not be something I can solve. It's also possible it's affected by predictive mode (I play with prediction off, and they may have changed the code for it in a way that interferes).
  13. Regardless of the auto-sweeper's orientation, its decor box extends 5 cells to the right (from the center cell of the auto-sweeper), while extending the correct 3 cells in all other directions.
  14. @PeterA Sorry to cause problems with that, I've removed the code that was referring to the old optionsscreen so it should be much safer to remove now (obviously will still crash for anyone stuck on older versions of the mod, but nothing to be done about that).
  15. [DST] Gesture Wheel

    @TheHacker Gesture Wheel is DST-only (10 is the api version for DST). Single-player doesn't have any emotes, so it wouldn't make sense to have the wheel for them (and porting over the emotes themselves is a bit hard, definitely outside of what I want to do with this mod).
  16. [DST] Gesture Wheel

    Version 1.7.4


    Gesture wheel makes emotes a little easier by providing a custom interface for using them. Also available on the Steam Workshop. By default, the hotkey is set to G (but you can configure it in the mod config options). Holding G will bring up the gesture wheel, then moving your mouse in a particular direction will select a gesture. When you release G, your character will do the gesture. On controllers, pressing in the left stick activates the wheel, and selection is done with the left stick. I included several options that you might want to change: Toggle button: This defaults to G, but you can set it to any letter key. Hopefully when mods get proper controls options, this will be nicer to work with Wheel size: Sets how big the wheel is; defaults to 1, but can be set from 0.1 to 2. Center wheel: this determines whether the wheel comes up around your mouse or the center of the screen. Restore cursor position: "Relative", the default setting, moves it back where it was before, adding the extra movement you did for the gesture. "Absolute" sets it back where it was before without adding the extra movement, "Center" only moves the mouse to the center of the wheel when it's brought up, and "Off" doesn't move the mouse at all. If Center Wheel is disabled, only "Absolute" does anything. Show picture or text: You can have it show just the picture, just the text, or both. Controller stick: You can set it to use the left or the right stick to open the wheel. Limit to 8: Off (the default) uses all the emotes, but the wheel is getting pretty crowded (current at 12 emotes), so On limits the wheel to 8 emotes, which are chosen with the remaining options (Right Emote, Down-Left Emote, and so on).
  17. Geometric Placement

    @invent1on should also be fixed by updating the game
  18. Combined Status

    @NinjaFairy It doesn't give me that warning on Steam. You're probably not installing it correctly; it should have an icon when you have it installed, with the folder structure like so: mods/CombinedStatus/modmain.lua
  19. Geometric Placement

    Download 2.1.8 instead
  20. Geometric Placement

    If you have Steam it's much easier to subscribe to it on the Workshop there and then just enable it in-game. Otherwise you need to find the game files, and the "mods" folder inside there. Then download this, extract the zip, and then put the GeometricPlacement folder in the mods folder, so that it goes mods/GeometricPlacement/modmain.lua (if you have an extra folder around it, it won't work).
  21. Combined Status

    No? I wrote both and use both.
  22. Geometric Placement

    @CrackZer a screenshot of the crash message might help
  23. Combined Status

    @sandman31 If you update the game, it should work. Alternatively, you can edit the mod's modmain and change this line: local DST = GLOBAL.TheSim:GetGameID() == "DST" to this: local DST = false --GLOBAL.TheSim:GetGameID() == "DST"
  24. The colorful coral tiles generally seem to be considered shallow water by most of the game, but technically aren't GROUND.OCEAN_SHALLOW. So seaweed spawns there naturally, but if you remove it with a trawl net you can't replant it there.
  25. When a circuit overloads, the bridges are targeted first. However, CircuitManager assigns wire bridges to the circuit they cross over, rather than the circuit they are linked to. This means that wire bridges don't overload if there's no circuit under them, and overload at the wrong time. I've attached a save demonstrating this. It consists of a heavi-watt circuit and a normal circuit, each with more than 1 kW power drain. The wire bridge on the left should be part of the heavi-watt circuit, but overloads when the normal circuit is powered. If it's removed, the two wire bridges on the right do not overload, but a wire does instead. I believe this is due to the following part of CircuitManager.Rebuild: HashSet<UtilityNetworkLink>.Enumerator enumerator3 = this.bridges.GetEnumerator(); while (enumerator3.MoveNext()) { UtilityNetworkLink current3 = enumerator3.Current; int cell = Grid.PosToCell(current3.transform.position); ushort circuitID3 = this.GetCircuitID(cell); if (circuitID3 != 65535) { this.circuitInfo[(int)circuitID3].bridges.Add(current3); } } It uses the center cell of the wire bridge to determine which circuit it's attached to. Instead it could use UtilityNetworkLink.GetCells() to get the cells the bridge is actually linked to, and use one/both of those to determine the circuit. WireBridgeBug.sav