Skip to content
Snippets Groups Projects
Commit 01502f05 authored by Travis Savo's avatar Travis Savo
Browse files

Move body test coverage

parent 3fadbf6c
No related branches found
No related tags found
No related merge requests found
Pipeline #
Loading
Loading
@@ -2,10 +2,10 @@ global.$game = {} if not global.$game
global.$game.common = {} if not global.$game.common
 
global.$game.common.move = (what, to)->
what.location = global.$game.$index.rooms.$nowhere if not what.location
what.location = global.$game.$nowhere if not what.location
if what.location?.contents?
what.location.contents = what.location.contents.remove(what)
place.contents = [] if not place.contents
to.contents = [] if not to.contents
to.contents.push what
what.location = to
 
Loading
Loading
require "base"
require "bodyPart"
require "proportionate"
 
Loading
Loading
@@ -179,6 +180,9 @@ body.stimulate = (stimulus)->
_ = require("underscore")
@tell _(stimulus).chain().map(@contextualizeStimulus).join("").value()
 
body.getTorso = ->
@torso
body.getPart = (name)->
@getTorso().getPart(name)
 
Loading
Loading
@@ -189,6 +193,7 @@ body.getRightHand = ->
@getTorso().parts.rightShoulder?.parts?.arm?.parts?.forearm?.parts?.hand
 
body.getLeftHand = ->
@getTorso().parts.leftShoulder?.parts?.arm?.parts?.forearm?.parts?.hand
 
body.getRightFoot = ->
Loading
Loading
@@ -198,10 +203,10 @@ body.getLeftFoot = ->
@getTorso().parts.leftThigh?.parts?.knee?.parts?.leg?.parts?.foot
 
body.getPrimaryHand = ->
if primaryHand is "right" then @getRightHand() else @getLeftHand()
if @primaryHand is "right" then @getRightHand() else @getLeftHand()
 
body.getSecondaryHand = ->
if primaryHand is "right" then @getLeftHand() else @getRightHand()
if @primaryHand is "right" then @getLeftHand() else @getRightHand()
 
body.getHand = ->
@getPrimaryHand() or @getSecondaryHand()
Loading
Loading
@@ -210,7 +215,8 @@ body.getBothHands = ->
[@getPrimaryHand(), @getSecondaryHand()]
 
body.getFreeHand = ->
if @getPrimaryHand?.isEmpty() then @getPrimaryHand else if @getSecondaryHand()?.isEmpty() then @getSecondaryHand() else undefined
if @getPrimaryHand.isEmpty?() then @getPrimaryHand() else if @getSecondaryHand().isEmpty?() then @getSecondaryHand() else undefined
 
body.isOneHandEmpty = ->
@getPrimaryHand()?.isEmpty() or @getSecondaryHand()?.isEmpty()
Loading
Loading
Loading
Loading
@@ -3,6 +3,7 @@ spies = require('chai-spies')
chai.use spies
chai.should()
require('app-module-path').addPath(__dirname + '/../src')
require "base"
require("body")
 
describe "Human Body", ->
Loading
Loading
@@ -93,3 +94,8 @@ describe "Human Body", ->
body = harnessBody()
#body.findPart("head").should.equal body.torso.parts.head
body.findPart("left eye").should.equal body.torso.parts.head.parts.face.parts.leftEye
it "should be able to hold something in it's hands", ->
body = harnessBody()
body.holdInHands
moveTo:global.$game.common.moveTo
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment