Don't Starve

Don't Starve

Puppy Princess Musha
[Mod Development] Coding suggestions, advices, discussion, debate ...
In this thread, I'm gonna throw in my 2 cents as far as coding/development goes, anyone can do the same.
< >
Showing 1-4 of 4 comments
hi,
in "level.lua"
the variables : "exp" (& therefore "max_exp")
are unused, and they are not global but "local"
therefore those two lines could be deleted or commented out
In "level.lua"
I'm not an expert at code execution speed but the repetition of "inst:RemoveTag" seems terribly inefficient or at the very least it makes the code longer & a pain to maintain.
I suggest a single function & a single loop. I have concrete code thoughts about this, but before I write them out. I'd like to know if you're interested & active at all. Otherwise there's no point.

Thanks.
had a lil bit more look & thoughts about level.lua
I believe the code should be able to be shortened by at least 400 lines
which will make it easier to read & maintain should you ever want to change the number of levels positively or negatively

edit: preliminary rewrites, the file falls to about 37 lines with comments ! no tests done though, so might need more work.
Last edited by [DBH].Whismerhill.{SSgt}; 3 Apr, 2016 @ 11:48am
had another look at some other files, I don't want to do a huge summary but there's a lot of code that is completely redundant
while I respect the huge amount of work that this mod is, also nice art & such
I believe this project needs another developper to help out with the coding aspect

a concrete example :
if sleeper.music <=100 then
sleeper.music = sleeper.music + 50
if sleeper.music >=100 then
sleeper.music = sleeper.music *0 + 100
sleeper:AddTag("switlight")
end
elseif sleeper.music >=100 then
sleeper.music = sleeper.music *0 + 100
sleeper:AddTag("switlight")
end

basically this just adds 50 if < 50 else it's 100 & addtag ...
so here one just removed 4 lines of code

also fail to see why multiply by 0 since the result will always be 0 no matter what
< >
Showing 1-4 of 4 comments
Per page: 1530 50