Skip to content

Commit

Permalink
support beer types
Browse files Browse the repository at this point in the history
  • Loading branch information
nearnshaw committed Dec 29, 2023
1 parent bd6d45f commit 94465c9
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 36 deletions.
78 changes: 57 additions & 21 deletions bin/game.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export enum IngredientType {
SlicedSushi,
Trash,
BeerGlass,
YellowBeer,
RedBeer,
GreenBeer,
}

export enum SpeechBubbleType {
Expand Down Expand Up @@ -103,7 +106,7 @@ export function getTapData(tapBeerType: BeerType) {
*/

export const BeerGlass = engine.defineComponent('BeerGlass', {
beingFilled: Schemas.Boolean,
//beingFilled: Schemas.Boolean,
filled: Schemas.Boolean,
beerType: Schemas.EnumNumber<BeerType>(BeerType, BeerType.NONE),
drinking: Schemas.Boolean
Expand Down
42 changes: 35 additions & 7 deletions src/modules/customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,32 @@ const customerTrashMessages = [
"Garbage, don't care what kind"
]

const customerBeerMessages = [
'I want a cold beer!',
'I heard you do craft beer, gimme!',
'Beer! A nice cold one!',
const customerEmptyBeerMessages = [
'An empty beer glass. So it looks like I was waiting long',
'Just a glass, nothing in it. Feeling existential.',
'Empty glass. All I can afford.',
]

const customerYellowBeerMessages = [
'I want a cold regular beer!',
'I heard you do craft beer, gimme a yellow!',
'Beer! A nice cold normal one!',
]

const customerRedBeerMessages = [
'I want a RED beer!',
'Red beer. Im a bit of a hipster!',
'Beer red like the blood of my enemies! lol',
]


const customerGreenBeerMessages = [
'I like weird stuff, green beer!',
'Green Beer. Dont care about the taste, want a cool pic for insagram',
'Beer! A nice cold green one!',
]


const customerLookingMessage = [
'Im just here to watch',
'I dont want anything. Just here to make you feel uncomfortable.',
Expand Down Expand Up @@ -167,7 +187,16 @@ export function CreateCustomer() {
messages = customerTrashMessages
break
case 5:
messages = customerBeerMessages
messages = customerEmptyBeerMessages
break
case 6:
messages = customerYellowBeerMessages
break
case 7:
messages = customerRedBeerMessages
break
case 8:
messages = customerGreenBeerMessages
break
default:
messages = customerLookingMessage
Expand Down Expand Up @@ -217,7 +246,6 @@ export function CustomerSystem(dt: number) {
RemoveProgressBar(customerData.progressBar)

}

}

if (customerData.receivedDish && customerData.waitingTimer > 0) {
Expand All @@ -227,7 +255,7 @@ export function CustomerSystem(dt: number) {

engine.removeEntityWithChildren(entity)


CreateCustomer()


}
Expand Down
4 changes: 0 additions & 4 deletions src/modules/pickAndDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ export function pickingGlassSystem() {


if (grabbable.beingProcessed) { return }
if (grabbable.type === IngredientType.BeerGlass) {
const glass = BeerGlass.get(entity)
if (glass.beingFilled) { return }
}

pickUpItem(entity)

Expand Down
24 changes: 21 additions & 3 deletions src/modules/tap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Animator, engine, InputAction, inputSystem, PointerEventType, Transform } from '@dcl/sdk/ecs'
import { Scalar } from '@dcl/sdk/math'
import { BeerGlass, BeerType, getTapData, TapBase, TapComponent } from '../definitions'
import { BeerGlass, BeerType, getTapData, GrabableObjectComponent, IngredientType, TapBase, TapComponent } from '../definitions'
import { playSound } from './factory'
import { getPlayerPosition } from './helpers'
import { getParent } from '@dcl/sdk/network'
Expand Down Expand Up @@ -38,8 +38,10 @@ export function tapPumpSystem(dt: number) {
if (glassEntity) {
const glass = BeerGlass.getMutable(glassEntity)
glass.beerType = tap.beerType
glass.beingFilled = false
//glass.beingFilled = false
glass.filled = true
const grabbable = GrabableObjectComponent.getMutable(glassEntity)
grabbable.beingProcessed = false
}
}

Expand All @@ -61,8 +63,24 @@ export function tapPumpSystem(dt: number) {
tap.pouring = true
tap.pouringTime = 0

glass.beingFilled = true
//glass.beingFilled = true
glass.beerType = tap.beerType
const grabbable = GrabableObjectComponent.getMutable(glassEntity)
grabbable.beingProcessed = true
switch (tap.beerType) {
case BeerType.YELLOW:
grabbable.type = IngredientType.YellowBeer
break
case BeerType.RED:
grabbable.type = IngredientType.RedBeer
break
case BeerType.GREEN:
grabbable.type = IngredientType.GreenBeer
break

}

grabbable.type
}
}
}

0 comments on commit 94465c9

Please sign in to comment.