diff --git a/client/src/components/construct.jsx b/client/src/components/construct.jsx index c1d8710e..9c669810 100644 --- a/client/src/components/construct.jsx +++ b/client/src/components/construct.jsx @@ -8,20 +8,6 @@ const idleAnimation = require('./anims/idle'); const invert = require('./anims/invert'); const sourceCast = require('./anims/source.cast'); - -const genAvatar = name => { - let hash = 0; - if (name.length === 0) return hash; - // Probs don't need to hash using the whole string - for (let i = 0; i < name.length; i += 1) { - const chr = name.charCodeAt(i); - hash = ((hash << 5) - hash) + chr; - hash = hash % 10000; - } - return `${hash}`; -}; - - const addState = connect( function receiveState(state) { const { avatarAnimation } = state; @@ -38,33 +24,32 @@ class ConstructAvatar extends Component { this.animId = 0; this.source = false; this.animations = []; - this.avatar = genAvatar(props.name); } render() { return (
); } componentDidMount() { - this.idle = idleAnimation(this.props.id); + this.idle = idleAnimation(this.props.construct.id); this.animations.push(this.idle); } componentWillReceiveProps(nextProps) { if (nextProps.avatarAnimation.id === -1) this.animId = 0; // The current set of resolutions ended reset to 0 - if (nextProps.avatarAnimation.id !== this.animId && nextProps.avatarAnimation.animTargetId === this.props.id) { + if (nextProps.avatarAnimation.id !== this.animId && nextProps.avatarAnimation.animTargetId === this.props.construct.id) { this.animId = nextProps.avatarAnimation.id; const selectAnim = () => { switch (nextProps.avatarAnimation.type) { - case 'banish': return banish(this.props.id); - case 'invert': return invert(this.props.id); - case 'sourceCast': return sourceCast(this.props.id, nextProps.avatarAnimation.params); + case 'banish': return banish(this.props.construct.id); + case 'invert': return invert(this.props.construct.id); + case 'sourceCast': return sourceCast(this.props.construct.id, nextProps.avatarAnimation.params); default: return null; } }; diff --git a/client/src/components/game.construct.jsx b/client/src/components/game.construct.jsx index dfb91861..c59bb108 100644 --- a/client/src/components/game.construct.jsx +++ b/client/src/components/game.construct.jsx @@ -103,7 +103,7 @@ function GameConstruct(props) {