Jump to content

Recommended Posts

Yes, you'd need AddPrefabPostInit() for that, but that's not quite viable when interacting with character mods (unless you get yours to always load last). I came up with the following solution:

AddPrefabPostInit("world", function(inst)	print(">> Hello, world!")	GLOBAL.assert( GLOBAL.GetPlayer() == nil )	local player_prefab = GLOBAL.SaveGameIndex:GetSlotCharacter()	-- /*	--[[	-- Unfortunately, we can't add new postinits by now. So we have to do	-- it the hard way...	--]]	-- */	GLOBAL.TheSim:LoadPrefabs {player_prefab}	local oldfn = GLOBAL.Prefabs[player_prefab].fn	GLOBAL.Prefabs[player_prefab].fn = function()		local inst = oldfn()		-- /*		--[[		-- Add components here.		--]]		-- */				print(">> Hello, " .. player_prefab .. "!")		return inst	endend)

Thanks, will check that later.

  • Developer

Well, it is directly impacting me :(. The mod I'm working on modifies the grow/regen rate of plants, and hooking into pickable is a gigantic pain (currently, you pretty much have to overwrite regentime and regentimefn, which I don't want to do [i multiply the default regentime by a potentially different value on each new regen task]). With growable, for example, I can just hook into StartGrowing and be done with it. The rewritten pickable that I attached has been working great for me (no bugs that I've found).

Also, another question, and I don't really know if you're the one to talk to this about, but I've reported a few code bugs (this and this) in the bug tracker that are not getting any response (while pretty much 100% of the others get some sort of response). I just want to make sure they aren't going unnoticed, or, if they are, if I should be reporting them in a different place/different way.

 

The bug forum is indeed the correct place for those, I'm not sure why they haven't gotten any attention. I'll see what's up. I know Wade's not ignoring you on purpose. ;)

  • Developer

And what with the Hunter mod:

Also after adding component to the character by using SimPostInit, that component is not able to load any saved data. Is there a good way for adding custom component to a character so the component can write and read data from save at load time?

 

Also it seems that gate wall mod got affected byt the same error with vanishing textures:

 

Yeah, there are lingering issues in general with vanishing textures that we're still hunting down. Looking in to it!

 

That's an interesting problem of the data loading on characters; thanks for reporting it and thanks @simplex for a solution. Please use that for now, and I'll put this on my list of improvements to make.

Yeah, there are lingering issues in general with vanishing textures that we're still hunting down. Looking in to it!

 

That's an interesting problem of the data loading on characters; thanks for reporting it and thanks @simplex for a solution. Please use that for now, and I'll put this on my list of improvements to make.

Thanks for support.

hello, im trying to hide hud and lock camera for quite some time.found this code in older version (in playercontroller.lua):table.insert(self.inputhandlers, TheInput:AddKeyDownHandler(KEY_P, function() if TheInput:IsKeyDown(KEY_CTRL) then TheCamera:SetPaused(not TheCamera.paused) end end))table.insert(self.inputhandlers, TheInput:AddKeyDownHandler(KEY_H, function()if TheInput:IsKeyDown(KEY_CTRL) thenif self.inst.HUD.shown thenself.inst.HUD:Hide()elseself.inst.HUD:Show()endendend))and it seems not compatible with newer version, so no idea what to do. any help would be greatly appreciated

Hey, I found some time to do some mod updating and decide to update my "working signposts" mod first. Unfortunately I ran into some trouble.

 

I use the console screen widget as a base for my own widget to add text to the signpost. However, the game now has a new 'UI focus' feature where the console's text box can active or not active. The UI focus is reallllly sensitive and its very easy for the focus to be lost (i.e. the mouse is in the wrong place, or if you bump the mouse), so no text is entered when you type. Then when you click on the text box, rather than resetting the focus on the text box, the text box just closes. This is rather fiddly. Is there a way to force the UI focus onto a particular UI entity so it cannot be lost?

chromiumboy, two ways:To completely ignore any focus changes:

TheFrontEnd:LockFocus(true) --// in a function like OnBecomeActive()
To set the focus to a specific child Widget whenever the parent Screen is moused over:
self.focus_forward = self.child_widget --// in the Screen's constructor, or in the console's case, DoInit()
The second is better if you have any other widgets that you still want to be focus-able (buttons, for example). It's what I use in my Better Console mod. Edited by squeek

Hey, I found some time to do some mod updating and decide to update my "working signposts" mod first. Unfortunately I ran into some trouble.

 

I use the console screen widget as a base for my own widget to add text to the signpost. However, the game now has a new 'UI focus' feature where the console's text box can active or not active. The UI focus is reallllly sensitive and its very easy for the focus to be lost (i.e. the mouse is in the wrong place, or if you bump the mouse), so no text is entered when you type. Then when you click on the text box, rather than resetting the focus on the text box, the text box just closes. This is rather fiddly. Is there a way to force the UI focus onto a particular UI entity so it cannot be lost?

I'd just wait until the Tuesday preview.  A lot of the UI/HUD is changing (again).

 

@squeek, that Better Console looks sweet, imma give it a go.

Edited by tehMug

@IpsquiggleIn the Clock component's OnUpdate function, you guys are currently using a temporary hack that checks for GetWorld():IsCave() before calling TheSim:SetAmbientColours(), so as to avoid conflicts with the NightmareClock. Could you replace this test for the check of a proper flag, defined by a setter in the clock component? I ask this because I'm having to tag Up and Away's world entity as a cave, which makes GetWorld():IsCave() return true in places I wouldn't want it to.

@Ipsquiggle

I noticed that when you die in a cave (or regen it), the save files for its associated ruins, if any, will just remain there, forever (or at least until the slot itself is deleted). Is this somehow intended? Is there a reason for the ruins to use a different cave number? (since they have a different level number, I don't see a reason for this, given that a cave will contain at most one ruins entrance).

  • Developer

@simplex

 

Your first concern with clock/caves... There are a few problems with creating a world that isn't survival or caves that you've brought up so I'd like to have a look at that whole bit so it's more granular and configurable. But until then:

 

This component was changed a bit since the last update, including I believe the line you were referring to. I'm not entirely sure what your goal is here so I can't propose a solution besides the obvious setting of daycolour, duskcolour and nightcolour in a postinit.

 

 

 

For the second point: We're still closing the loop on the way death and travel will work between the caves and the upworld; it's likely cave levels will all be persistent, only being deleted when the slot is deleted. That new behaviour will probably show up next update.

We're still closing the loop on the way death and travel will work between the caves and the upworld; it's likely cave levels will all be persistent, only being deleted when the slot is deleted. That new behaviour will probably show up next update.

But you'll keep the option of erasing a cave by cave number, right? The Up and Away world is being implemented as a cave level type, with a new world being generated as beanstalks are climbed, being destroyed as beanstalks are chopped down. Having them be persistent would just leave unused saves in the players' save folder.The only grip I have with our current system for level creation is that even though new worlds are generated and destroyed, the cave number just keeps increasing (which makes sense for caves themselves, since sinkholes only appear at worldgen). I'd like to reuse cave numbers I had previously used for a cloud realm, but I don't imagine I could properly do that until we have mod savedata that persists across mod disabling (and the associated save being loaded). Having to work with worldgen under the assumption that all savedata may disappear has been a great pain, since we're not only adding new prefabs/components/etc. but also new levels, a new world entity and new ground types. We're actually not using standard assets and prefabs at all (except for anims and sounds), so if a player loads our world with the mod disabled they'll just be stranded among complete emptiness (and with no proper way* of getting out of it, since the level exit itself was lost alongside all other savedata).Having persistent mod savedata would also allow for tracking level dependencies, so that if a beanstalk is chopped down not only its immediate level would be purged, but also higher ones (this situation being an exact analogue of the ruins situation). In caves, however, the level progression is linear, so cave numbers could be reused, but in our case we're aiming for a tree level structure (the major deterrent for that being the inability to erase the level tree). To store a tree in an array, my thought is to use the standard "preorder and inorder define a tree" theorem/algorithm (it would be simpler, cleaner and more reliable across mod updates if level numbers were not restricted to be numbers, though). Our current implementation artificially imposes a linear progression, just because of these issues (but it's quite flexible: if you spawn a beanstalk inside a cave, it will function as a cave exit, and if you spawn a beanstalk_exit on the surface or inside a cave it will function as a sinkhole).And if it's not too much trouble, could you also allow persistent mod data at the save file level, alongside the ones you mentioned before (profile and slot level)? This is the form of savedata we "already have", except for it being erased when the save is loaded and the mod is disabled (so that the OnLoad methods won't be called to fetch the data, and in the next time saving there wouldn't be OnSave methods to save them back anyway).* All I can think of is adding an emergency exit: a Sim post init that checks whether we are in a cloud level, and if so looks for a level exit, forcing the player back to survival if not finding one. This would still leave a save file behind, though. Edited by simplex

Hey guys, this is probably a question I should know the answer too, but my Animal Masks mod is using the functions in woodie.lua to become a monster. But in the BecomeWoodie function, it makes you Woodie, as the function suggests. How would I make it so it makes you a human again? 

 

Thanks, Neo

@Cheerio

In Up and Away, we're adding a new ground type (and plan on adding more). However, this is causing a periodic stutter that I just can't understand. The general performance in the cloud level is quite ok, since in my PC a frame is taking 1-2ms to render, but very regularly, every 3-4 seconds, there's a noticeable stutter for a frame or two. And this only happens if a new ground type is being used.

Originally, I was just adding the tile assets to the mod's asset list, which worked, but had a severe performance penalty. For a while now, I'm adding them both to the mod's asset list* and to the asset table within the return value of worldtiledefs.lua, which gets loaded by the world entity (world.lua) in its asset list. This improved the situation quite a bit, but this is still far from ideal.

I attached the code we're using to add a new ground type (I did refactor it a little bit to remove dependencies, though). Do you have any ideas on what may be causing this, and how to solve it?

* Not adding it there as well was triggering a strange crash under Nightmares standalone (probably because it ran an older revision, I doubt there's more to it than that).

addtile.zip

Edited by simplex

@Cheerio

Sorry for the triple post, but about the periodic stutter, it seems changing the compression helped some, but the issue still remains.

EDIT: I'm attaching our level folder, with the textures both in TEX and PNG. The minimap noise is just a placeholder.

levels.zip

Edited by simplex

@Cheerio

Any news on fix for vanishing custom prefabs in mods?

I have this mod on workshop, now custom animal tracks and custom dirtpiles are vanishing in the middle of the hunt for no reason and without any error message. That makes the mod unplayable. 

  • Developer

@Cheerio

Any news on fix for vanishing custom prefabs in mods?

I have this mod on workshop, now custom animal tracks and custom dirtpiles are vanishing in the middle of the hunt for no reason and without any error message. That makes the mod unplayable. 

No idea but I'll look into it for you.

@Cheerio

Sorry for the triple post, but about the periodic stutter, it seems changing the compression helped some, but the issue still remains.

EDIT: I'm attaching our level folder, with the textures both in TEX and PNG. The minimap noise is just a placeholder.

Sorry, I know you posted this a while ago.  I'll look into this for you.

  • Developer

@Cheerio

Nevermind, I fixed it. We were using DXT5 for the noise textures, but I realized you use DXT1 for those.

I wonder why this was such a big issue, though.

By chance, would you have an example mod with this running for me to try this out in game?

  • Developer

@Cheerio

Any news on fix for vanishing custom prefabs in mods?

I have this mod on workshop, now custom animal tracks and custom dirtpiles are vanishing in the middle of the hunt for no reason and without any error message. That makes the mod unplayable. 

So I tried out your mod.  It's really cool though chasing 18 bird tracks took quite a while :).  I didn't have any problems with.  Do you have any more info as to how to reproduce the problem so I can take a look at what's going on?

So I tried out your mod.  It's really cool though chasing 18 bird tracks took quite a while :-).  I didn't have any problems with.  Do you have any more info as to how to reproduce the problem so I can take a look at what's going on?

If it's the same "vanishing texture" bug that I think it is, it happens very reliably with the fairy in my Link mod.

While you're running about, she will randomly vanish. And she seems to always disappear when night sets in.

  • Developer

If it's the same "vanishing texture" bug that I think it is, it happens very reliably with the fairy in my Link mod.

While you're running about, she will randomly vanish. And she seems to always disappear when night sets in.

Perfect.  I'll give that a try :).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...