DarkXero

  • Content count

    3,015
  • Joined

  • Last visited

Community Reputation

2,881 Excellent

About DarkXero

  • Rank
    Senior Member

Badges

Don't Starve Together
  • Contributor
Oxygen Not Included
  • Alpha Contributor

Recent Profile Visitors

10,933 profile views
  1. Yeah, you're right. Fair enough. local function EpicFilter(ret) local newret = {} for i, e in ipairs(ret) do if not e:HasTag("structure") then newret[i] = e end end return newret end -- absolute madman stuff local hax = GLOBAL.debug.getlocal AddPrefabPostInit("world", function(world) if world.ismastersim then local t = GLOBAL.getmetatable(GLOBAL.TheSim).__index local fe = t.FindEntities t.FindEntities = function(...) local ret = fe(...) if ret then local i = 1 while true do local name, value = hax(2, i) if not name then break end if name == "inst" then if value:HasTag("epic") then ret = EpicFilter(ret) else break end end if name == "self" then if value.inst and value.inst:HasTag("epic") then ret = EpicFilter(ret) else break end end i = i + 1 end end return ret end end end) -- special bearger collision edge case local _work = GLOBAL.require("components/workable") local _destroy = _work.Destroy _work.Destroy = function(self, destroyer) if destroyer and destroyer:HasTag("epic") then return end return _destroy(destroyer) end This one is server side too.
  2. if not GLOBAL.TheNet:GetIsServer() then return end local _HammerFn = GLOBAL.ACTIONS.HAMMER.fn GLOBAL.ACTIONS.HAMMER.fn = function(act) act.target.components.workable = act.target.components.hammerworkable local ret = _HammerFn(act) act.target.components.workable = nil return ret end local function AntiWork(inst) inst.components.hammerworkable = inst.components.workable inst.components.workable = nil end local function HammerFix(inst) if inst:HasTag("structure") and inst.components.workable and inst.components.workable.action == GLOBAL.ACTIONS.HAMMER then inst:DoTaskInTime(0, AntiWork) end end AddPrefabPostInitAny(HammerFix) Should be good as a server mod?
  3. It would help if you posted the mod or more data. AnimState should propagate correctly to clients when changing (using "Show"). As an example, here's the correct usage: -- prefab file local function PlayerFix(inst) if not inst:HasTag("depleted") then inst.extractor.AnimState:Show("salt") end end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() -- ... inst.entity:AddNetwork() -- here inst:ListenForEvent("ms_playerjoined", function(world, player) PlayerFix(inst) end, TheWorld) -- ... inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end -- ... return inst end More interesting would be to see the extractor prefab. It's probably missing a AddNetwork that would solve this without hassle.
  4. I was going to write it but then I realized that I ****** up and I was the one generating the new herds with my debug lines. So yeah, domestication it is. The other way was my fault. My bad for raising hopes. If I figure something out I will post new results.
  5. It's not the only way but it is a valid way. A domesticated beefalo abandons its herd and when it goes feral it creates a new one.
  6. They behave like goats now (kind of). No more exponential growth. No more servers with 40 herds and over 300 beefalo. Or phantom herds. Kill all but one, and lure it with feeding or saddle and ride it to displace the herd. Beefalo herd updates every 8 seconds for members within a 20 units radius (about 3 and a half tiles). Important to not fully domesticate the lone beef, or the herd won't be able to find a feral parent inside the herd to attach the baby. Another way would be the following: 1) Wait until there's baby beefalo. 2) Kill everything but 1 baby beefalo. 3) Relocate the lone baby beefalo with teleportation. When the baby grows, the baby will be deleted. The herd will be empty and removed. The herd will no longer be valid. A new grown beefalo will spawn on its place. Since the herd is no longer valid, a new herd will spawn there. A problem may arise where you teleport the baby, but the beefalo herd was on the mood and spawning babies, so a new baby spawns next to your baby. If your baby grows, the herd will still be valid. Now you will have your grown baby, and the new baby, running against the wall trying to return to the herd that's far away. To avoid this problem you would need to do the herd relocation outside Spring or if they're in the mood. All of this because the herd only updates positions for the members that are nearby. It is truly a conundrum. What's the difference between a herd with a member that's 10 units away from the update range versus a herd with a member that's 50 units away from the update range? Maybe the telelocator staff should make teleported units leave the herd and make their own? But then we could make new herds from a single herd: teleport one goat and one beefalo from a herd to duplicate herds... Would it be balanced to make gigantic meat farms with telelocator staffs and bases? We could also make it so if you have 1 member only, the herd position updates no matter what. This would fix the telelocation issue. But then this means that any herds with 1 single member will wander to zones of the map where they shouldn't be. Beefalo would wander way outside the savannah, since the herd point would keep moving with them. We could also apply the goat treatment: if you have one beefalo, you push it to where you want the herd. -- babybeefalo.lua local function SetFullyGrown(inst) local herd = inst.components.herdmember ~= nil and inst.components.herdmember:GetHerd() or nil local count = herd ~= nil and herd.components.herd ~= nil and herd.components.herd.membercount or nil local grown = SpawnPrefab("beefalo") grown.Transform:SetPosition(inst.Transform:GetWorldPosition()) grown.Transform:SetRotation(inst.Transform:GetRotation()) grown.sg:GoToState("grow_up_pop") if count ~= nil and count == 1 then -- add before removing or herd will be destroyed if herd ~= nil and herd.components.herd ~= nil and herd:IsValid() then herd.components.herd:AddMember(grown) end inst:Remove() else inst:Remove() if herd ~= nil and herd.components.herd ~= nil and herd:IsValid() then herd.components.herd:AddMember(grown) end end end This would turn the beefalo herds into goat herds. So yeah, if you have any ideas or feedback, discuss it.
  7. Slow Domesticated Beefalo Speed

    @Ozzey_Lee @fimmatek Bug is ancient and rare. Back from when domestication appeared. Both client and server logs are useless here. Any chance any of you can provide a cluster_x folder with the world with the bugged beef?
  8. @myxal Thank you very much for the world. I have been tinkering with it. It allowed me to see: Unfortunately, those bugs are the cause of beefalo overpopulation, not the cause for the empty beefaloherds growing. Upon closer inspection of the empty beefaloherds, you can rest assured they do nothing, because they can only spawn a baby beefalo when there's a parent to attach it (which must be a member of the herd). I found half of the cause of the empty beefaloherds. There are special beefalo in your world that have no herd (herd in herdmember component is set to nil), BUT have a herd location saved on the knownlocations component. So basically, every time you log out and log in, more herds appear, because it creates one for itself (it doesn't have one) but it doesn't join it (it fails because it remembers it has one). Also, because of the fail everytime (and how the code works), it creates 3 new empty herds each time. As for why exactly some beefalo could have herd set to nil, but have a herd knownlocation memorized: it's a mystery to me. Technically, this in particular, should be impossible. But I don't know if you may have used any console commands that caused this, or mods that might have interfered, or maybe the bug comes from older versions. Another tidbit, is that the beefalo also remembered a "loiteranchor" knownlocation, which means it was fed or was ridden (presumably to domesticate it). When I pulled all the herdless beefalo to me, I got 2. One that was feral. And one that was domesticated. Both with loiteranchor and herd locations, and both without herd assigned in herdmember. Here are some commands to repair the world: -- 1) clean buggy beef for k, v in pairs(Ents) do if v.prefab == "beefalo" and v.components.herdmember.herd == nil then v:Remove() end end -- 2) clean empty herds for k, v in pairs(Ents) do if v.prefab == "beefaloherd" and v.components.herd.membercount == 0 then v:Remove() end end -- extra) pull buggy beef for inspection for k, v in pairs(Ents) do if v.prefab == "beefalo" and v.components.herdmember.herd == nil then v.Transform:SetPosition(ThePlayer.Transform:GetWorldPosition()) end end Here is a command to spawn a domesticated beef: c_spawn("beefalo"); c_sel().components.hunger:DoDelta(400); c_sel().components.domesticatable:DeltaDomestication(1); c_sel().components.domesticatable:TryBecomeDomesticated(); After that, no more herd spawning on log in. Of course, you still have a massive population to clean. You can kill them all and spawn a lone beefalo every 10 seconds to make herds of size 1 wherever you please. Overpopulation still has to be fixed, of course.
  9. -- babybeefalo.lua local function SetFullyGrown(inst) local grown = SpawnPrefab("beefalo") grown.Transform:SetPosition(inst.Transform:GetWorldPosition() ) grown.Transform:SetRotation(inst.Transform:GetRotation() ) grown.sg:GoToState("grow_up_pop") inst:Remove() end -- herd.lua self.task = self.inst:DoPeriodicTask(math.random() * 2 + 6, _OnUpdate, nil, self) -- herdmember.lua self.task = self.inst:DoTaskInTime(5, OnInit) Assuming that herds never merge, consider the following situation: You have a herd of 1 beefalo, 1 baby beefalo spawns. The baby beefalo is added to the herd. Now you have a herd of 2. The baby beefalo grows until he's fully grown. He gets removed from the herd. Now you got a herd of 1. A beefalo spawns on the baby place. But it isn't linked to the herd. What happens next? The beefalo in 5 seconds will get a herd, if it doesn't have one. Either the herd picks up the beefalo via GatherNearbyMembers, or the beefalo makes its own. If the beefalo makes its own, since herds don't merge, you will end up with a herd of 1 and another herd of 1, and both will grow. And the same might happen to them. This causes beefalo overpopulation. NOTE: This applies to single player Don't Starve as well; I will mention it next patch time comes.
  10. Herds never merge

    -- herd.lua function Herd:MergeNearbyHerds() if not self.gatherrange or self:IsFull() then return end local x,y,z = self.inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, self.gatherrange, {"herd"}) for k,v in pairs(ents) do if v ~= self.inst and v.components.herd and v.components.herd.gathertag == self.membertag and v.components.herd.membercount < 4 and (self.membercount + v.components.herd.membercount) <= self.maxsize then for k2,v2 in pairs(v.components.herd.members) do self:AddMember(k2) end v:Remove() end end end Notice the "gathertag". There's no other place in the code where a "gathertag" is mentioned. Therefore, herds never merge. NOTE: This applies to single player Don't Starve as well; I will mention it next patch time comes.
  11. @ScottHansen I can replicate the crashing at around the minute 50 mark or snapshot 8. You don't need godmode or anything of the like. What's required is to have either "Command Line Arguments: -threaded_physics -threaded_render" or "use_threaded_renderer = true" in client.ini. So you guys should go revert some of the commits made by @bizziboi. Or announce the render args are deprecated or something. Without threaded render the game doesn't crash... at least for now. And it doesn't look like it will crash anytime soon (after many hours).
  12. The Obligatory Forum Upgrade Thread

    I got the O2 badge but can't remember posting in the subforum. So, uh, there's that to fix. The color palette is the same ol' orange black white, but now there are clear distinctions between different content. It's welcomed. I don't like that the reply box text is light grey (unlike posts), because I have to concentrate to read what I'm currently writing. Overall, the update gets a thumbs up from me. Most important of all: there's a Lua syntax option in the code writing box. And looks like the "Paste" function is broken? Welcome the white void that shall not be deleted.
  13. TOADSTOOL_DARK_HEALTH = 99999
  14. Hope all is well.

    You were a large driving force to get me to spew code out in the Mods and Tools subforum before you could do the same.

     

    1. DarkXero

      DarkXero

      All is well.

      Thank you for your kind words.