- bugfix Engine.startThieves call changed to $SM call
- bugfix $SM.remove not deleting state
- bugfix workaround for empty string when creating states
For some reason splitting "state.sub.sub2["sub3"]" will result in
empty strings whereas "state.sub.sub2[\'sub3\']" didn't. Maybe a
javascript regex quirk?
Had to add a loop to remove '' from the split string array.
- modified collectIncome so that only one update event fires for the
whole function, no event if no income was added.
- modified updateBuildButtons so that buttons would show up if the
building had already been built.
changed check to be wood != undefined
Also changed room to display store values of 0 instead of removing
the row. It was distracting to have the values shift up and down
when tightly managing a resource. If you haven't seen a resource
yet, it still doesn't show up.
Refactoring of Outside.js to take better advantage of $SM and simplify
the code.
Includes a small bug fix to Room update handler
Also changed instances of escaped single quote (\') to double (") for
readability and simplicity.
====state changes====
//these were changed for the opposite reason the Room states were. These
seem like states that other locations and events may very well want to
interact with and possibly alter themselves
game.outside.buildings >> game.buildings
game.outside.population >> game.population
game.outside.workders >> game.workers
====functions removed====
Outside.numBuilding // just a $SM.get, no shortcut really needed since
Outside.numBuilding is a pretty long name
Outside.getPopulation // same here
Outside.addBuilding // just an add
Outside.addBuildings // just addM, but wasn't even actually used
====functions refactored====
Outside.killVillagers //moved updates to handler
Outside.updateWorkersView //added local to reduce gets
Outside.increasePopulation //updates moved to handler
Outside.increaseWorker // updates moved to handler
Outside.decreaseWorkder // updates moved to handler
Changed these States into properties of room. They are only ever
accessed by Room and there is no real reason to save them. By not
saving the state each time, it also makes the the player start out in
'a dark room' on every load. Rather fitting I think, and gives the fire
a little bit more purpose if you have to rewarm the builder.
game.room.builder >> game.builder.level
setget is mainly for use in local copies of states, useful for keeping
code cleaner and less redundant while maintaining set/get of states by
the $SM
====functions refactored====
Room.unlockForext //remove update calls
Room.buy //remove update calls
Room.build //remove update calls
Room.cooFire //added locals to reduce gets
Room.adjustTemp //added locals to reduce gets
Room.updateBuilderState //added local to reduce gets
Room.craftUnlocked //Room unlock is always going to be true, don't need
to check parents to avoid errors anymore
Room.buyUnlocked //Room unlock is always going to be true, don't need to
check parents to avoid errors anymore
add $.Dispatch to handle object events
add subscribe calls to files
update SM fireUpdate to use new Dispatch
There are some NaN issues right now, no time to bug hunt right now, it
does kind of function though