Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

piratekingflcl

[Help]Is there a way to use the additional inspection lines for Beeboxes?

Recommended Posts

I noticed something while playing as a mod character and reading their inspection lines: they had multiple lines for inspecting Beeboxes based on their level of fullness; yet I'd only ever seen the character use a single line.

This got me curious, so I started looking through the regular characters' scripts and I realized that all of them have multiple Beebox lines. The problem is, they only use two lines based on whether or not the Beebox's status is "Ready" or not!

For example, Wilson will only ever say "Bees!" when examining a bee box, yet Wendy will change between "They shall labor so that I can steal." and "Their toils have been fruitful." - this is because her script contains a line for "Ready", while his does not.

I figured out that just by adding a "Ready" line in Wilson's scripts he would also use two different lines, but I still wanted to be able to display those other lines for the different states of the Beebox's honey levels. To that end I started poking around in the Beebox.lua and specifically looked for the inspection variables.

Unfortunately, I don't know enough about modding to create additional inspection states. The only other entity that I can think of with more than two inspection lines is the Beefalo, but looking through that .lua didn't enlighten me as to how to update the Beebox.lua.

And so I turn to the good people of this forum; is there a way to change the Beebox.lua to include the additional states present in the character's scripts (namely: FULLHONEY, NOHONEY, SOMEHONEY)?

Share this post


Link to post
Share on other sites
alainmcd    900

Thank you!

Btw, I thought this was posted in the general section and it felt to me like you were about to edit beebox.lua directly (editing game files is generally a bad idea), which is why I plopped the mod instead of helping you figure it out. Let me know if there's anything in the mod you don't understand so you can still learn from it, if you're interested.

Share this post


Link to post
Share on other sites

I was definitely planning to edit the Beebox.lua directly if I thought I could have done it right, haha. I didn't realize that was such a bad idea! xP

But I really appreciate you making the mod instead of simply helping me. I think it's much more likely to help others if it's made by someone who has more experience than I do, and I can always learn from it afterwards by reading your file. I for sure would have made this on the General forum if I knew that someone would be able to fix it so quickly, just so that more people would see it and download your fix.

Edit: After testing it out some more, I think I figured out a way to improve upon your fix even further. Your version has the lines for NOHONEY, SOMEHONEY, and FULLHONEY, but it's missing the lines for GENERIC.

So you have it written like this:

inst.components.inspectable.getstatus = function(inst)
		if inst.components.harvestable then
			if inst.components.harvestable.produce == inst.components.harvestable.maxproduce then
				return "FULLHONEY"
			elseif inst.components.harvestable.produce > 0 then
				return "SOMEHONEY"
			else
				return "NOHONEY"
			end
		end
	end

 

but by adding something to the line near the beginning and changing the 'elseif' line you get this:

inst.components.inspectable.getstatus = function(inst)
		if inst.components.harvestable and inst.components.harvestable:CanBeHarvested()  then
			if inst.components.harvestable.produce == inst.components.harvestable.maxproduce then
				return "FULLHONEY"
			elseif inst.components.harvestable.produce > 2 then
				return "SOMEHONEY"
			else
				return "NOHONEY"
			end
		end
	end

 

This gives you GENERIC with an empty box, because it can't be harvested, and then NOHONEY, SOMEHONEY, and FULLHONEY at the three stages of fullness.

Of course, some of the NOHONEY lines might be misleading after this, since there's technically some honey, but even still I'm very proud that I was able to finally modify your fix without the game crashing!

(Just for reference, those two line edits took me over an hour to figure out xD)

Share this post


Link to post
Share on other sites
alainmcd    900

Great job!

Yup, I went for the easy fix and ignored the GENERIC line. :D You can make it as fancy as you'd like, for example:

inst.components.inspectable.getstatus = function(inst)
	if inst.components.harvestable then
		if inst.components.harvestable:CanBeHarvested() then
			if inst.components.harvestable.produce == inst.components.harvestable.maxproduce then
				return "FULLHONEY"
			elseif inst.components.childspawner:CountChildrenOutside() > 0 then
				return "GENERIC"
			else
				return "SOMEHONEY"
			end
		else
			return "NOHONEY"
		end
	end
end

In this case, I chose checking if there are bees outside because most of the GENERIC lines reference there being bees around, whereas the SOMEHONEY lines rather mention simply waiting.

Somewhat related, I noticed the SW cast don't have the READY line, which for the rest of the characters is the same as the FULLHONEY line. Since the game defaults to the GENERIC line, this means the SW characters don't have a proper announcement for a harvestable beebox, using only the generic description.

9 hours ago, piratekingflcl said:

I was definitely planning to edit the Beebox.lua directly if I thought I could have done it right, haha. I didn't realize that was such a bad idea! xP

Editing files directly can introduce a number of problems (losing changes after updates, clunkiness when sharing, getting several edits to work together) ending with the big, obvious making a mess of it without having a backup. Oops. DS and DST were built to some degree with modding in mind, so why not make use of that? In this case, the same fix works for DS, RoG, SW and DST. Unzip in the DS and DST mod folders and you're good to go.

Keep modding! And let me know if I can help.

Share this post


Link to post
Share on other sites

Awesome job again! Your version is definitely much better (and fancier!) than mine, haha.

47 minutes ago, alainmcd said:

Somewhat related, I noticed the SW cast don't have the READY line, which for the rest of the characters is the same as the FULLHONEY line. Since the game defaults to the GENERIC line, this means the SW characters don't have a proper announcement for a harvestable beebox, using only the generic description.

I noticed that, and also that Wilson is (well, was) affected by the same thing as well, which strikes me as even more puzzling.

Share this post


Link to post
Share on other sites
alainmcd    900

And to add to the bizarreness, Wilson does have the READY line in DST! I'd imagine Wilson's speech file was used as a template for SW and someone noticed the duped line and just removed it.

Share this post


Link to post
Share on other sites