• Announcements

    • JoeW

      UPDATED - Studio Note & Rhymes with Play Streams Temporarily Canceled.   03/06/2020

      UPDATE (3/19/20): Just a quick note regarding the team at Klei Entertainment. As noted previously, everybody at Klei Entertainment is working from home due to the Covid-19 outbreak. Many of us have been working especially hard to help maintain operations as we all move out of the office and into our homes and with everything being done online, extra time must be spent in organizing conversations and trying to maintain communication. As some of you may know, we have a very open office and we are almost always in contact with each other as we go about our days. Some of us work across multiple teams and that work has become a bit more challenging for everybody.   That being said, at this time the transition has not caused any major disruption in our operations, but it would be overly optimistic to expect that we won't have any delays at all. We're going to have to be especially mindful about this in the coming weeks and make sure we don't take on too much work so we can keep things running smoothly.  We will let you know as we see how these changes affect our timelines.  Thanks UPDATE (3/10/20):
      The test yesterday went well. We got the whole office (mostly) to work from home without significant issue. As a result, Klei Staff that can work from home have been asked to do so until further notice.  This means that we will have to cancel the Rhymes with Play stream until we are all back in the office. This shouldn't affect anything else at least in the short term, but if things change I will update you all here.  Original Post: Hey everybody,  This Tuesday March 10th, 2020 the entire staff at Klei will be working remotely for 1 day in an effort to prepare the studio to work remotely for a little while if the need arises.  Klei is already set up pretty well to allow for working remotely, however we are going to have a one day "dry run" with the whole studio so that we can identify and avoid any issues or downtime that may arise should choose to implement a work from home policy due to COVID-19 outbreak concerns. Unfortunately this does mean that we will be canceling the “Rhymes with Play” Art stream this coming Tuesday, however unless the situation changes we expect everything at the studio to be back to normal Wednesday and we’ll continue our regular stream schedule Thursday March 12th. If the situation changes at all, we'll let you know. Thanks for your understanding.


  • Content count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Nominative99

  • Rank
    Junior Member
  1. Hello Again! I need some assistance in regards to some custom items I've worked on for a friend. I was recently notified of a game crashing bug that only occurs with more than one person on a sever. Alone it doesn't crash, but once someone joins, boom. The items in question buff the player by temporarily giving them either a cooling or heating radius. I am using Ultroman's Aura Code and other references I've looked into to turn the crafter into a walking heater/cooler for a duration of time (the reason for the aura was for possible changes in case my friend wanted that buff to apply to other characters nearby by increasing the buffing range). I definitely screwed up in the heating & cooling, but unfortunately the error log is rather obscure to me, and since it doesn't crash with one player, so I can't seem to pinpoint this. I did browse through any existing examples of say portable heaters, thermal stones and similar items, but I was never comfortable when coding this. It was rather hard for me to tell whether or not my character was warming up or cooling down when these items applied their buff. Any assistance or insight will be greatly appreciated. I've attached the client_log and two item prefab files. This is what I have for the Heating. Cooling is pretty much the same but with different temp values. local assets = { Asset("ANIM", "anim/wyrdflask_heating.zip"), Asset("ATLAS", "images/inventoryimages/wyrdflask_heating.xml"), } local prefabs = { "wyrd", "wyrdflask" } -- HEATING AURA WORKS DIFFERENTLY THIS ONLY APPLIES THE BUFF -- ONCE BUT THE BUFF LASTS BASED ON WHAT heatingAuraDuration -- IS. RADIUS IS SET TO 1 SO THAT WYRD IS THE ONLY ONE WHO -- GETS THE BUFF. --------------------------------------- -- LOCAL EASY TO FIND VARIABLES - START --------------------------------------- -- TUNING.TOTAL_DAY_TIME = 8 MINUTES = 480 SECONDS / X = TOTAL TIME. -- WORK WITH DIVISION/MULTIPLICATION OF TOTAL DAY TIME -- EX: TUNING.TOTAL_DAY_TIME * 2 = DAYS local heatingAuraDuration = TUNING.TOTAL_DAY_TIME/1.6 -- 5 MINUTES local heatingAuraRadius = 1 -- RADIUS OF AURA local heatingTick = 0.1 -- DELAY IN WHICH HEATING AURA ACTIVATES WHEN CRAFTED --------------------------------------- -- LOCAL EASY TO FIND VARIABLES - END --------------------------------------- -------------------------------- -- WYRD EXCLUSIVE PICKUP - START - --CODE REFERENCED FROM maliblues : https://forums.kleientertainment.com/forums/topic/113820-help-preventing-custom-item-from-going-into-backpackschestsetc/?do=findComment&comment=1287064 -------------------------------- local function OnPutInInventory(inst) local owner = inst.components.inventoryitem:GetGrandOwner() if owner == nil then return elseif owner.components.inventory and owner.prefab ~= "wyrd" then inst:DoTaskInTime(0.1, function() owner.components.inventory:DropItem(inst) owner.components.talker:Say("That flask is cursed...") end) end if owner.components.container then --for chests --test when in backpack with diff owner inst:DoTaskInTime(0.1, function() owner.components.container:DropItem(inst) end) end end -------------------------------- -- WYRD EXCLUSIVE PICKUP - END -------------------------------- ------------------------------------------------------ -- RETURNS ORIGINAL FLASK AFTER TIME REACHES 0 - START ------------------------------------------------------ local function OnFinished(inst) local owner = inst.components.inventoryitem.owner local flask = SpawnPrefab("wyrdflask") inst:Remove() if owner ~= nil and owner.components.inventory then -- CHECK IF THE OWNER ITEM IS VALID AND NOT A CONTAINER owner.components.inventory:GiveItem(flask) elseif owner ~= nil and owner.components.container then -- OR IF THE OWNER IS VALID AND IS A CONTAINER owner.components.container:GiveItem(flask) else inst.components.lootdropper:SpawnLootPrefab("wyrdflask") -- DROPS NORMAL FLASK AS BASIC LOOT IN THE CASE OF ABOVE end end ------------------------------------------------------ -- RETURNS ORIGINAL FLASK AFTER TIME REACHES 0 - END ------------------------------------------------------ ----------------------- -- HEATING CODE - START ----------------------- -- Heated Character emits constant temperatures depending on the temperature range it's in local heats = { 30, 40, 60 } local function GetHeatFn(receiver) return heats or 20 end local function turnOnHeating(receiver) receiver:AddTag("HASHEATER") receiver:AddComponent("heater") receiver.components.heater.heatfn = GetHeatFn receiver.components.heater:SetThermics(false, true) end local function turnOffHeating(receiver) receiver:RemoveTag("HASHEATER") receiver:RemoveComponent("heater") end ----------------------- -- HEATING CODE - END ----------------------- --------------------- -- START OF AURA CODE --------------------- local onEndAura = function(receiver, wyrdflask_heatingGUID, wyrdHeatingAura) -- Fail-safe. if not receiver or not receiver:IsValid() then return end -- If the receiver has the heating aura task, cancel it. if receiver[wyrdHeatingAura] then receiver[wyrdHeatingAura]:Cancel() receiver[wyrdHeatingAura] = nil end turnOffHeating(receiver) end local onApplyAura = function(receiver, wyrdflask_heating) -- "receiver" = Player -- "wyrdflask_heating" = Item applying the aura -- Fail-safe. if not receiver or not receiver:IsValid() then return end -- Use the created entitie's unique ID to create a unique name. local wyrdflask_heatingGUID = wyrdflask_heating.GUID --Create a single instance of the aura to prevent stacking from multiples of the same flask. local wyrdHeatingAura = "wyrdHeatingAuraID" -- If the receiver does not already have our heating aura on from this particular -- wyrdflask_heating, start the heating aura task, and store it in a variable on the receiver. if not receiver[wyrdHeatingAura] then -- TASK APPLIES HEATING EFFECT receiver[wyrdHeatingAura] = receiver:DoTaskInTime(heatingTick, function(receiver) turnOnHeating(receiver) end) end -- Ending the Aura after some time -- Create a unique variable-name to store the end-aura task on the receiver. local endwyrdHeatingAura = "wyrdHeatingEntireAura" -- If the receiver already has an end-aura task, then we need to cancel it, -- so we can restart it with a refreshed end-time. if receiver[endwyrdHeatingAura] then receiver[endwyrdHeatingAura]:Cancel() receiver[endwyrdHeatingAura] = nil end -- Use DoTaskInTime to schedule calling the function that ends the aura after a while without renewals. -- We store the task on the receiver using our unique variable-name. receiver[endwyrdHeatingAura] = receiver:DoTaskInTime(heatingAuraDuration, onEndAura, wyrdflask_heatingGUID, wyrdHeatingAura) end local applyAuraInRange = function(inst) -- Store the position of the aura-emitting entity in x, y, z variables. local x,y,z = inst.Transform:GetWorldPosition() -- Any player that is not a ghost or in limbo. -- AURA RADIUS = 1 - MAKES IT SO WYRD IS THE ONLY ONE WITH THE HEATING BUFF local ents = TheSim:FindEntities(x, y, z, 1, {"player"}, {"playerghost", "INLIMBO"}, nil) -- Apply the aura to any of the found entities within the radius, including the aura-emitting -- entity itself if it fits the tag-list parameters! for i, v in ipairs(ents) do onApplyAura(v, inst) end end ------------------- -- END OF AURA CODE ------------------- -- Write a local function that creats, customizes, and returns an instance of the prefab. local function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("wyrdflask_heating") inst.AnimState:SetBuild("wyrdflask_heating") inst.AnimState:PlayAnimation("idle") MakeInventoryFloatable(inst, "small", 0.2) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end --inst:AddTag("undroppable") inst:AddComponent("lootdropper") inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem:SetOnPutInInventoryFn(OnPutInInventory) inst.components.inventoryitem.keepondeath = true inst.components.inventoryitem:EnableMoisture(false) inst.components.inventoryitem.atlasname = "images/inventoryimages/wyrdflask_heating.xml" inst:AddComponent("fueled") inst.components.fueled:InitializeFuelLevel(heatingAuraDuration) inst.components.fueled:StartConsuming() inst.components.fueled:SetDepletedFn(OnFinished) MakeHauntableLaunch(inst) inst:DoTaskInTime(0, applyAuraInRange) -- APPLY THE AURA INSTANTLY return inst end -- Finally, return a new prefab with the construction function and assets. return Prefab( "wyrdflask_heating", fn, assets) client_log.txt wyrdflask_heating.lua wyrdflask_cooling.lua