Cunning fox

  • Content Count

    337
  • Joined

  • Last visited

Community Reputation

568 Excellent

7 Followers

About Cunning fox

  • Rank
    Senior Member
...

Recent Profile Visitors

4196 profile views
  1. I thought I was the only one who noticed them! These white dots are so annoying
  2. Oh, right, sorry. It's just exams season in my university rn, I don't have that much time on mods, but I'll update it asap!
  3. This should work AddPrefabPostInit("orangestaff", function(inst) local _targetfn = inst.components.reticule.targetfn inst.components.reticule.targetfn = function(...) local data = _targetfn(...) local player = ThePlayer if data and player and player.replica.sanity and player.replica.sanity:GetPercent() == 0 then return nil end return data end end)
  4. DISCLAIMER: This guide is for modded items only. Klei prohibited creating custom skins for official items, and this library won't be able to add them. Hey everyone! Since I haven't found up-to-date and easy to use library for creating custom skins for items, I decided to make my own one and share it with you I used @Kzisor / Ysovuka's library as a base for mine. 1. Installation First of all, you'll need to download the library from here: Then, you'll need to put it in your mod's folder. I'll be using path scripts/libs/skins_api.lua. After that, you'll need to include this library for your mod. Add this line into your modmain: modimport("scripts/libs/skins_api.lua") All set! The library is installed, and we can actually add our skins. 2. Making custom skin prefab Unlike Klei's skins, modded skins use different prefabs for every skin. So, you can different properties for every skin! They even can have different functionality. So, you have 2 options: Make a separate prefabs file for skins (or each skin) Make prefab's skins directly in the base prefab's file. To register your skin you'll need to use CreateModPrefabSkin(name, properties) function, where name is a string with the name of your skin, and properties is a table. For example: CreateModPrefabSkin("dummy_formal", { assets = { Asset("ANIM", "anim/dummy_formal.zip"), }, base_prefab = "dummy", fn = formal, rarity = "Timeless", reskinable = true, build_name_override = "dummy_formal", type = "item", skin_tags = { }, release_group = 0, }) Assets: a table of assets for your skin; base_prefab: Prefab of the items you're making a skin for. fn: Prefab's constructor. Acts like a regular prefab constructor. rarity: Your item's rarity. reskinable: Will your item be reskinable using the Clean Sweeper. build_name_override: The build of the skin. The rest of the properties is only used by Klei, so it's better to just keep them unchanged. If you're confused about the Fn, here's an example: Let's say that you want to make a skin for something similar to a carrot. You have a constructor function: local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() inst.AnimState:SetBank("carrot") inst.AnimState:SetBuild("carrot") inst.AnimState:PlayAnimation("planted") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("pickable") inst.components.pickable:SetUp("carrot", 10) inst.components.pickable.onpickedfn = onpicked return inst end To make a skin you'll need to create a new constructor like this: local function carrot_skin() local inst = fn() inst.AnimState:SetBuild("skinned_carrot_build") return inst end Here we create a default carrot (using fn()), and then apply some changes to it (change the carrot's build). After that, we'll need to return our skin, just like a regular prefab. At the end of the file you need to put: return Prefab("carrot", fn, assets), CreateModPrefabSkin("dummy_formal", { assets = { Asset("ANIM", "anim/skinned_carrot.zip"), }, base_prefab = "carrot", fn = carrot_skin, -- This is our constructor! rarity = "Timeless", reskinable = true, build_name_override = "skinned_carrot", type = "item", skin_tags = { }, release_group = 0, }) 3. Updating the recipe and adding strings After creating your skins' prefab, you'll need to update your recipe too. After you've added your item's recipe with AddRecipe, you'll need to call MadeRecipeSkinnable(recipe_name, atlas_data), where recipe_name is the name of your recipe, and atlas_data is a table, containing info about your skin's inventory image. MadeRecipeSkinnable("dummy", { dummy_formal = { atlas = "images/inventoryimages/dummy.xml", image = "dummy_formal.tex", }, }) The second argument is the table. Here you'll add atlas and image of the skin. Here, dummy_formal is the name of the skin, the atlas is a path to .xml file, and the image is the name of the texture. After that, you'll need to name your skin, using STRINGS.SKIN_NAMES table. Is works just like adding names to regular prefabs, but the name of the prefab has to be lowercased. STRINGS.SKIN_NAMES.dummy_formal = "Formal dummy" All set! Your modded item now should have its own skin. 4. Applying skins on placers. If your item is a structure and has a placer, you'll want to apply a skin to its placer too. To do it, you'll need to modify your MakePlacer, to make it look like this: MakePlacer("dummy_placer", "dummy", "dummy", "anim", nil, nil, nil, nil, nil, nil, placer) placer here is a custom function that'll be applying the skin itself. If should look like this: local function placer(inst) inst.ApplySkin = function(inst, skin) if skin == "dummy_formal" then inst.AnimState:SetBuild("dummy_formal") end end end Here placer function adds ApplySkin function. The skin argument is the name of the skin for the item. In this example, we check if the skin is dummy_formal, and apply custom build for a placer if it's true. That's all you need to add a skin for your item! If you have any questions or feature requests, feel free to ask them in the comments! Mods that use this library (You can use them as an example) The Dummy Mod
  5. Version 1.0.2

    108 downloads

    This is the API for making your own skins for modded items. Guide on how to do it is here:
  6. inst:ListenForEvent("builditem", function(inst, data) -- Your code here -- Data contains: { item = prod, recipe = recipe, skin = skin, prototyper = self.current_prototyper } -- See components/builder.lua:458 end)
  7. AddPrefabPostInit("pigshrine_placer", function(inst) inst.AnimState:SetBank("Some_bank") inst.AnimState:SetBuild("Some_build") inst.AnimState:PlayAnimation("Some_anim") end)
  8. There's no return anywhere near _OnLoad
  9. Well, the game doesn't have that much of a graphics options, but the best ones are: Enabled distortion shaders when the player is insane: Enables bloom shaders to glowing entities: Resolution and refresh rate to max, obviously (I'm running DST in windowed mode, so it's disabled for me): Small textures and netbook mode disabled. Small textures mode compresses all textures and fonts. Netbook mode: Sets FPS cap to 30 FPS. Texture streaming: disabled. This one basically only loads textures when needed. Not really graphics options, but theese make the game look nicer: Enables screen shaking (during boss fights, earthquakes, etc): Enables o with two dots for Wigfrid:
  10. When the player leaves the game on a boat and then rejoins the game they're teleported to the portal if they're suppose to drown. It's done through DoTaskInTime, reference to which is not saved anywhere. I want to change this behavior, but right now there's no way to change it (at least not ugly one). I suggest changing: prefabs/player_common.lua:809 inst:DoTaskInTime(0, function() --V2C: HACK! enabled false instead of nil means it was overriden by weregoose on load. -- Please refactor drownable and this block to use POST LOAD timing instead. if inst.components.drownable ~= nil and inst.components.drownable.enabled ~= false then local my_x, my_y, my_z = inst.Transform:GetWorldPosition() if not TheWorld.Map:IsPassableAtPoint(my_x, my_y, my_z) then for k,v in pairs(Ents) do if v:IsValid() and v:HasTag("multiplayer_portal") then inst.Transform:SetPosition(v.Transform:GetWorldPosition()) inst:SnapCamera() end end end end end) To: inst.portal_teleport_task = inst:DoTaskInTime(0, function() --V2C: HACK! enabled false instead of nil means it was overriden by weregoose on load. -- Please refactor drownable and this block to use POST LOAD timing instead. if inst.components.drownable ~= nil and inst.components.drownable.enabled ~= false then local my_x, my_y, my_z = inst.Transform:GetWorldPosition() if not TheWorld.Map:IsPassableAtPoint(my_x, my_y, my_z) then for k,v in pairs(Ents) do if v:IsValid() and v:HasTag("multiplayer_portal") then inst.Transform:SetPosition(v.Transform:GetWorldPosition()) inst:SnapCamera() end end inst.portal_teleport_task = nil end end end)
  11. Ok, well, thank you for your answers. I thought it automatically made them a wildfire targets.