Commit Graph

99 Commits

Author SHA1 Message Date
Michael Townsend a96e9c55c2 Update world.js 2013-10-29 15:54:25 -04:00
Michael 363119717e Added cancel button to the save dialog. 2013-10-17 17:48:48 -04:00
Michael Townsend 701baf86d7 Merge pull request #58 from Vermilingua/importexport
Routine to migrate/backup saves
2013-10-17 06:08:36 -07:00
Vermilingua dc706c21fe added importing and exporting saves with base64 2013-10-17 22:46:33 +11:00
Michael 1ffe8f8aeb A bit of cleanup. 2013-10-16 17:45:41 -04:00
Michael Townsend a895a35939 Merge pull request #57 from Vermilingua/prestige
Prestige System
2013-10-16 14:31:33 -07:00
Vermilingua 83bf266a29 prestige system now absolutely complete 2013-10-16 21:43:40 +11:00
Vermilingua f952b4def1 completed save/load 2013-10-16 21:43:14 +11:00
Vermilingua 1be4d5edc5 started backup/loading mechanic 2013-10-16 21:43:12 +11:00
Vermilingua acc04d0780 set down framework, storage/map gen/etc. 2013-10-16 21:41:47 +11:00
Michael Townsend 63a6d98ffe Merge pull request #55 from Vermilingua/forest
Forest now fits the scene
2013-10-15 07:40:32 -07:00
Vermilingua 36b9cf2142 made the forest suit more 2013-10-15 20:09:28 +11:00
Michael 95faa0ba75 Merge branch 'master' of https://github.com/Continuities/adarkroom.git 2013-10-13 18:53:19 -04:00
Michael 22e480a80b Ignore Eclipse settings. 2013-10-13 18:52:43 -04:00
Michael Townsend 25cae71067 Merge pull request #54 from Vermilingua/warnings
Made the warnings look nicer, and added the as-of-yet mostly unused logo
2013-10-12 10:20:58 -07:00
Vermilingua f6e95850da added safari/opera and got better logos 2013-10-12 13:40:47 +11:00
Vermilingua a89bf8ee8b nicened the warnings 2013-10-12 13:30:30 +11:00
Michael 5ebbefac91 Modified comment text 1,3 2013-10-11 17:24:41 -04:00
Michael 084bf15811 Little bug in keynav code. 2013-10-11 16:24:37 -04:00
Michael dde477aade Some general code cleanup. 2013-10-10 20:53:53 -04:00
Michael Townsend fbdc84dcf1 Merge pull request #52 from Bleyddyn/master
Arrow Keys and stores update fix
2013-10-10 17:12:30 -07:00
Andrew Salamon 5f5ff3701e Fixed a problem where the stores view wasn't updating. 2013-10-09 15:32:05 -07:00
Andrew Salamon 5d482f856e Added support for switching from room to outside to path using the arrow keys. 2013-10-09 15:31:43 -07:00
Michael Townsend 30e7a06a44 Merge pull request #50 from LucidCrux/state_manager_2
State manager 2
2013-08-18 19:08:53 -07:00
LucidCrux bb84eafca6 re-enable jQuery from google 2013-07-27 18:12:00 -06:00
LucidCrux f704a2137f turned off debug 2013-07-27 17:22:25 -06:00
LucidCrux 6561e88f9f lots of bugfixes
- 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.
2013-07-27 17:21:30 -06:00
LucidCrux 36011b5b15 set version to 1.3, add code to update State from 1.2 to 1.3 2013-07-27 12:49:03 -06:00
LucidCrux a8c6790d84 bugfix set ship,world location to true on init 2013-07-27 12:25:15 -06:00
LucidCrux 99800f1abd refactor Outside to use $SM + Room bugfix, \' to "
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
2013-07-26 19:21:12 -06:00
LucidCrux f4d2e8deae change to property Room.fire, Room.temperature, Room.buttons
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.
2013-07-25 21:05:43 -06:00
LucidCrux 99d57efdc1 bug fix Outside.init > set features.location.outside to true 2013-07-25 20:33:04 -06:00
LucidCrux 2e3f8abd3f add $SM.setget, refactor Room to better use $SM
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
2013-07-25 20:31:30 -06:00
LucidCrux f4520bce91 speed up and bug fix 2013-07-25 02:00:41 -06:00
LucidCrux 766d3879c7 Merge remote-tracking branch 'origin/master' into state_manager_2
Conflicts:
	script/events.js
2013-07-24 21:01:59 -06:00
LucidCrux 2018ca3ae8 create and configure callback handlers for state updates
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
2013-07-24 18:33:06 -06:00
LucidCrux dee7cbb9b3 refactor Engine.js for use with $SM
====functions removed====
//I just removed these because most were simpler or at least equal as
	direct $SM get/set/add calls, I realize the store ones are kind of
	subjective since calls were about equal, but oh well. If someone
	really 	feels we need the shortcut/named functions for manipulating
	stores specifically, it shouldn't be crazy to reimplement in $SM 
Engine.setStore >> $SM.set
Engine.setStores >> $SM.setM
Engine.addStore >> $SM.add
Engine.addStores >> $SM.addM
Engine.getStore >> $SM.get(requestZero = true)
Engine.storeAvailable >> $SM.get;
Engine.removeIncome >> $SM.remove //updates moved to handler


====functions moved====
//Any moved function I felt was more directly related to States or
	didn't belong where it was
Engine.addPerk > $SM.addPerk //kept function for now because of notify
	call inside, 'deep' state
Engine.hasPerk > $SM.hasPerk //kept function because of 'deep' state
	name
Engine.setIncome > $SM.setIncome //kept because it has internal logic
**Engine.getIncome > $SM.getIncome //**easily removable with
	Outside.updateVillageIncome refactor
Engine.openPath > Path.openPath //Since I'm refactoring anyways
Engine.addStolen > $SM.addStolen //internal logic
Engine.startThieves > $SM.startThieves //not sure $SM is a better place,
	but Engine should be nice and clean by the end of this, handling
	only engine mechanics
Engine.num > $SM.num //after Outside refacter, this is basically just a
	fancy $SM.get
Engine.upgradeState > $SM.updateOldState


====functions refactored====
$SM.addPerk; //updates moved to event handler, no check/create new perk
$SM.hasPerk; //don't need to check exist and ==true
$SM.collectIncome //removed changed check, update calls now handled by
	'stateUpdate' event listening
$SM.addStolen //fix to set stolen items in case a partial steal happens
$SM.startThieves //updates in handler
$SM.updateOldState //use $SM calls, add placeholder for updating to post
$SM state when more finalized 


====functions affected (by removed)====
Engine.init (Engine.getStore, Engine.storeAvailable)
Engine.collectIncome (Engine.addStores)
Engine.num (Engine.getStore)
Engine.travelTo (Engine.storeAvailable)

Room.init (Engine.getStore)
Room.unlockForest (Engine.setStore)
Room.lightFire (Engine.setStore, Engine.getStore, Engine.storeAvailable)
Room.stokeFire (Engine.setStore, Engine.getStore, Engine.storeAvailable)
Room.coolFire (Engine.setStore)
Room.buy (Engine.setStores, Engine.addStore, Engine.getStore)
Room.build (Engine.setStores, Engine.getStore)
Room.craftUnlocked (Engine.getStore, Engine.storeAvailable)
Room.buyUnlocked (Engine.storeAvailable)
Room.updateButton (Engine.storeAvailable)

Outside.gatherWood (Engine.addStores)
Outside.checkTraps (Engine.addStores, Engine.getStore)
Outside.updateVillage (Engine.getStore)

Path.embark (Engine.addStore)
Path.getCapacity (Engine.getStore)
Path.updateOutfitting (Engine.getStore)
Path.createOutfittingRow (Engine.getStore)
Path.increaseSupply (Engine.getStore)

World.goHome (Engine.addStore)
World.updateSupplies (Engine.getStore)
World.checkDanger (Engine.getStore)
World.getMaxHealth (Engine.getStore)
World.getMaxWater (Engine.getStore)

Ship.reinforceHull (Engine.addStore, Engine.getStore)
Ship.upgradeEngine (Engine.addStore, Engine.getStore)

Events.loadScene (Engine.addStores)
Events.updateButtons (Engine.getStore)
Events.buttonClick (Engine.getStore)

Events.Global (Engine.addStores, Engine.removeIncome)
Events.Room (Engine.addStore, Engine.addStores, Engine.getStore,
Engine.storeAvailable)
2013-07-24 17:41:36 -06:00
Michael Townsend 03867cae60 Merge pull request #47 from Yeow-Meng/master
IE<8 Fixes:
2013-07-23 21:09:24 -07:00
Steve Hayes 253f946dbd IE<8 Fixes: Removed trailing commas in string literals and renamed variable char to chara 2013-07-23 23:54:06 -04:00
LucidCrux db4a346d21 create StateManager, change all State calls to managed calls
Introduced state_manager.js almost all State gets/sets are now run
through the manager (alias $SM). For now it was a simple, mostly
straightforward replacement of calls. This means that there are
redundancies and a lot of now unneeded code for things the SM will
handle. However, since I had trouble with making those changes as well
as introducing the manager all at once my first attempt, I am taking the
wiser approach and making "one change" at a time like I should have
instead of being too sure of myself.

At this point, it seems to work, but there may be bugs I didn't catch.
There was also no attempt made to update old saves to work with this. In
theory, it shouldn't be too hard. (included is a list of all state
changes)

TODO:
Save Update.
Refactor: a lot, many many redundancies now.
Refactor: "location centric" to "global centric".
Relocate all calls to different update functions to event listeners
where possible.

======================================================

The changes to State are as follows:

.room (exists) > features.location.room
.room > game.room
.room.builder > game.room.builder
.room.temperature > game.room.temperature
.room.fire > game.room.fire
.room.buttons > game.room.buttons

.outside (exists) > features.location.outside
.outside > game.outside
.outside.population > game.outside.population
.outside.buildings > game.outside.buildings
.outside.workers > game.outside.workers
.outside.seenForest > game.outside.seenForest

.world (exists) > features.location.world
.world > game.world
.world.map > game.world.map
.world.mask > game.world.mask
.starved > character.starved
.dehydrated > character.dehydrated

.ship (exists) > featuers.location.spaceShip
.ship > game.spaceShip
.ship.hull > game.spaceShip.hull
.ship.thrusters > game.spaceShip.thrusters
.ship.seenWarning > game.spaceShip.seenWarning
.ship.seenShip > game.spaceShip.seenShip

.punches > character.punches
.perks > character.perks

.thieves > game.thieves
.stolen > game.stolen
.cityCleared > game.cityCleared

.stores > stores
.income > income
2013-07-23 01:24:47 -06:00
Michael Townsend 1b1088db4f Merge pull request #44 from Zarkonnen/medicine
Fixed issue #42 by fixing wrong city exploration setpiece data.
2013-07-17 06:23:09 -07:00
Zarkonnen 7bf744e386 Fixed issue #42 by fixing wrong city exploration setpiece data. 2013-07-17 09:56:31 +02:00
Michael Townsend 252b731666 Merge pull request #39 from toofarapart/improved_item_dropping
events.js: Item dropping improvements
2013-07-15 08:43:47 -07:00
Michael Townsend d296ea4db9 Merge pull request #38 from Zarkonnen/laser_rifle_fix
Laser rifles are now listed as weapons, fixing issue #37.
2013-07-15 08:40:29 -07:00
Matt Rasmus e80fc4d286 events.js: Item dropping improvements
Item drop menu no longer disappears after clicking to drop something.
2013-07-13 17:00:57 -07:00
Zarkonnen 25f1fff6a1 Laser rifles are now listed as weapons, fixing issue #37. 2013-07-13 21:42:15 +02:00
Michael Townsend 77cac86076 Merge pull request #32 from toofarapart/all_villagers_killed_bug
All villagers killed bug
2013-07-10 19:51:36 -07:00
Matt Rasmus 22b850f1c0 outside.js: Fix incorrect display of workers.
Fixed an issue where the workers view would break temporarily if all the villagers were killed.
2013-07-10 17:56:15 -07:00
Michael Townsend 93f8e52e1f Merge pull request #30 from Zarkonnen/medicine
Medicine
2013-07-10 12:07:05 -07:00
Zarkonnen 3515cbf75f Removed mentions of "you". 2013-07-10 20:50:42 +02:00