[Code] A Thread On Lambdas And Other Epsilons


simplex

Recommended Posts

If I've learned a it of coding with C, is it easy to go towards lua ?

They're very different languages, but if you know one language, learning another one is not that hard.

What's your experience with C?

Link to comment
Share on other sites

They're very different languages, but if you know one language, learning another one is not that hard.

What's your experience with C?

(Woops,silly me, irregular verbs...)

I know the basics, and ATM I'm learning how work the windows.

Link to comment
Share on other sites

sorry for "offtopic" but was amused with your save_safeguard.lua :-)

even after mod deletion its still works with save.

good to have such material to learn something new :-)

Well, hopefully we'll get an alternative provided by the game itself soon. The way save_safeguard.lua works may be clever, but I wouldn't recommend it, I just used it because we had no real alternative and saves breaking hard when loaded without U&A enabled was a big problem.

Link to comment
Share on other sites

@simplex

If you find the time, I'm pretty stumped with something.

 

I added support for Too Many Items. I made it so that our items would show up in the list. I thought, if somebody is using Too Many Items, the game balance is shattered to pieces anyways, so adding support for it wouldn't hurt anything.

 

Too Many Items is definitely not written with other mod items in mind, at least as far as I can tell.

 

I've gotten the items to show up in the list, but I'm experiencing two bugs that I can't make sense of.

 

The first is that when I close the Too Many Items screen, it gives me an error. Basically, it's trying to Remove() something but it says it can't.

 

The second is a crash when I go to the last two pages of Too Many Items. It seems like it's loading unindexed items (even though the list of items already works, and is indexed).

Link to comment
Share on other sites

@simplex

If you find the time, I'm pretty stumped with something.

 

I added support for Too Many Items. I made it so that our items would show up in the list. I thought, if somebody is using Too Many Items, the game balance is shattered to pieces anyways, so adding support for it wouldn't hurt anything.

 

Too Many Items is definitely not written with other mod items in mind, at least as far as I can tell.

 

I've gotten the items to show up in the list, but I'm experiencing two bugs that I can't make sense of.

 

The first is that when I close the Too Many Items screen, it gives me an error. Basically, it's trying to Remove() something but it says it can't.

 

The second is a crash when I go to the last two pages of Too Many Items. It seems like it's loading unindexed items (even though the list of items already works, and is indexed).

I've never even used TMI, but I'll take a look. Is your TMI compatibility code in a dedicated commit?

Link to comment
Share on other sites

I've never even used TMI, but I'll take a look. Is your TMI compatibility code in a dedicated commit?

 

It's in the latest commit in stable. There's a couple of other tiny changes in there, but all of the TMI stuff is in main.lua. It's pretty small, too.

Link to comment
Share on other sites

It's in the latest commit in stable. There's a couple of other tiny changes in there, but all of the TMI stuff is in main.lua. It's pretty small, too.

Well, there are a couple things off with the TMI compatibility code. Firstly,

	local inventory = self.inventory	local i = 0	for k,v in pairs(newitems) do		table.insert(inventory, v)		local item = SpawnPrefab(v)		if item ~= nil then			if item.components and item.components.inventoryitem then				self.inventory[i] = item
you're setting i to 0 and working your way up from there, overwriting the entities already in self.inventory (and without calling inst:Remove() on them); you should start from #self.inventory + 1. Secondly, if item does not have the inventoryitem component, then you're not removing it. Finally (and most importantly) you're adding both the spawned entity to self.inventory and the prefab name (in the previous table.insert call), which is very likely the cause of the issues (strings are not supposed to be in self.inventory).

But overall I don't like that you're (1) hardcoding the list of U&A entities and (2) relying in the internal logic of TMI. I'd just require "itemlist" and then include the names of all U&A prefabs in _G.ITEMLIST.

Link to comment
Share on other sites

Well, there are a couple things off with the TMI compatibility code. Firstly,

	local inventory = self.inventory	local i = 0	for k,v in pairs(newitems) do		table.insert(inventory, v)		local item = SpawnPrefab(v)		if item ~= nil then			if item.components and item.components.inventoryitem then				self.inventory[i] = item
you're setting i to 0 and working your way up from there, overwriting the entities already in self.inventory (and without calling inst:Remove() on them); you should start from #self.inventory + 1. Secondly, if item does not have the inventoryitem component, then you're not removing it. Finally (and most importantly) you're adding both the spawned entity to self.inventory and the prefab name (in the previous table.insert call), which is very likely the cause of the issues (strings are not supposed to be in self.inventory).

But overall I don't like that you're (1) hardcoding the list of U&A entities and (2) relying in the internal logic of TMI. I'd just require "itemlist" and then include the names of all U&A prefabs in _G.ITEMLIST.

 

 

Well, the hardcoding of the list was supposed to be temporary, I was going to do a require once I got it working completely.

 

The things you pointed out make sense. Thanks for pointing me in the right direction, I'll take care of that later in the morning. It's nearly 5 (AM) here, so I need to get some rest.

Link to comment
Share on other sites

Well, the hardcoding of the list was supposed to be temporary, I was going to do a require once I got it working completely.

 

The things you pointed out make sense. Thanks for pointing me in the right direction, I'll take care of that later in the morning. It's nearly 5 (AM) here, so I need to get some rest.

I'll take care of it, don't worry.

Link to comment
Share on other sites

@debugman18

I implemented TMI support, and also made the N Tools invincibility button work correctly when the we (or the game) change the player invincibility, such as when being drawn to a whirlwind.

I moved the mod compatibility code to modcompat.lua, which is require'd in code/worldgen_main.lua (so that it always runs).

Link to comment
Share on other sites

If you don't mind waiting, I can get around to it when I get home. Should be no more than a couple of hours.

Don't worry, I just pushed a fix. I was just avoiding the case where we'd both be working on the fix at the same time.

Link to comment
Share on other sites

Hey @simplex and @debugman18, I have a small question for you... Is there a way to access a prefab file (especially tea.lua in 'code/prefabs') from another mod ? Because I want to add a function to my EEv2 mod, that adds all your teas to the EMC values system, and I don't want to add it manually... Each time you update U&A, I must add items and values to the mod support table, and I want to automate it... I want teas to be the first thing to automate...

 

So my question is simple: Is there a way to load "mods/UpAndAway/code/prefabs/tea.lua" file from inside of "mods/EE/EMCmodvals.lua" ?

 

EDIT: For now, it must remain like this... : https://www.dropbox.com/s/l2ibpljrqqzjr5g/UAteas.png

 

Ok, I just found that out, never mind, ignore that post...

Link to comment
Share on other sites

@debugman18

What is that beardedlady component? I'll disable it for now in dst_dev, since it's not MP compatible and I'm not sure what it's all about.

 

It is the component to add beards to characters. I was looking at Heavenfall's old beard-as-item code when looking at adding beards and never did create my own version.

 

Link to comment
Share on other sites

It is the component to add beards to characters. I was looking at Heavenfall's old beard-as-item code when looking at adding beards and never did create my own version.

Ok, does any of the mod code have a hard dependency on it? (i.e., does the alchemy code you put that component in for assume characters have the bearded component, or does it handle the negatory gracefully)?

Link to comment
Share on other sites

Ok, does any of the mod code have a hard dependency on it? (i.e., does the alchemy code you put that component in for assume characters have the bearded component, or does it handle the negatory gracefully)?

 

I think only if you drink that particular potion it would give you an issue. Just adding an if statement would solve any issues, though.

 

Link to comment
Share on other sites

@debugman18

Just thought I'd let you know I finished writing the automated singleplayer -> multiplayer prefab converter (I used Metalua). This was certainly one of the most complex things I've written and it took more than an order of magnitude of time over what I'd have taken doing the conversion manually, but I'll take writing one complex piece of code over many braindead code alterations any day :razz:. I'm just testing it some more before applying it to all the prefabs.

How's everything else?

Link to comment
Share on other sites

@debugman18

Just thought I'd let you know I finished writing the automated singleplayer -> multiplayer prefab converter (I used Metalua). This was certainly one of the most complex things I've written and it took more than an order of magnitude of time over what I'd have taken doing the conversion manually, but I'll take writing one complex piece of code over many braindead code alterations any day :razz:. I'm just testing it some more before applying it to all the prefabs.

How's everything else?

 

Well, tomorrow I'm going to work on the design document. Today I'm checking out the new Destiny DLC (which I've been waiting for) and after I get the design plan written out properly and reviewed by you all, I'll implement all of the changes. It should be pretty straight forward stuff, so I'm not too concerned about it.

 

I do want to do it as well as I can though, to avoid the constant reiteration that was going on before (although some reiteration is necessary due to feedback, getting some feedback early while explaining design choices is ideal.)

 

Speaking of which, @MilleniumCount, you're taking a game design course, correct? Are you familar with the format of a GDD?

Link to comment
Share on other sites

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.