Skip to content

Commit

Permalink
feat: workstation crafting recipes
Browse files Browse the repository at this point in the history
one of FOUR
  • Loading branch information
SheepTester committed Jun 7, 2024
1 parent b0f9f0c commit e2f258b
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 2 deletions.
3 changes: 3 additions & 0 deletions assets/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { player_blue_walk1, player_blue_walk2 } from "./player_blue/walk";
import { player_green_walk1, player_green_walk2 } from "./player_green/walk";
import { player_red_walk1, player_red_walk2 } from "./player_red/walk";
import { player_yellow_walk1, player_yellow_walk2 } from "./player_yellow/walk";
import { workstationHelp } from "./workstation_help";

export const getModels = (engine: GraphicsEngine) =>
({
Expand Down Expand Up @@ -127,6 +128,8 @@ export const getModels = (engine: GraphicsEngine) =>
mushroom_king: GltfModelWrapper.from(engine.gltfMaterial, mushroom_king),
trap: GltfModelWrapper.from(engine.gltfMaterial, trap),

workstationHelp: GltfModelWrapper.from(engine.gltfMaterial, workstationHelp),

rockpile: GltfModelWrapper.from(engine.gltfMaterial, rockpile),
minecart: GltfModelWrapper.from(engine.gltfMaterial, minecart),

Expand Down
Binary file added assets/models/workstation_help/helphelphelp.bin
Binary file not shown.
148 changes: 148 additions & 0 deletions assets/models/workstation_help/helphelphelp.gltf
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v3.6.28",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Cube",
"rotation":[
-0.7169234156608582,
0,
0,
0.6971519589424133
],
"scale":[
0.33267244696617126,
10.851390838623047,
7.379537105560303
]
}
],
"materials":[
{
"doubleSided":true,
"name":"Material",
"pbrMetallicRoughness":{
"baseColorTexture":{
"index":0
},
"metallicFactor":0,
"roughnessFactor":0.5
}
}
],
"meshes":[
{
"name":"Cube",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3,
"material":0
}
]
}
],
"textures":[
{
"sampler":0,
"source":0
}
],
"images":[
{
"mimeType":"image/png",
"name":"workstation_recipes",
"uri":"workstation_recipes.png"
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":24,
"max":[
1,
1,
1
],
"min":[
-1,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":24,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":24,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":36,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":288,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":288,
"byteOffset":288,
"target":34962
},
{
"buffer":0,
"byteLength":192,
"byteOffset":576,
"target":34962
},
{
"buffer":0,
"byteLength":72,
"byteOffset":768,
"target":34963
}
],
"samplers":[
{
"magFilter":9729,
"minFilter":9987
}
],
"buffers":[
{
"byteLength":840,
"uri":"helphelphelp.bin"
}
]
}
5 changes: 5 additions & 0 deletions assets/models/workstation_help/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { parseGltf } from "../../../common/gltf/gltf-parser";
import bin from "./helphelphelp.bin";
import root from "./helphelphelp.gltf";
import png from "./workstation_recipes.png";
export const workstationHelp = parseGltf(root, { "helphelphelp.bin": bin, "workstation_recipes.png": png });
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions server/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,17 @@ export class Game implements ServerHandlers<ClientMessage, ServerMessage> {
]);
FletchingTable.body.quaternion = quarterSquat;
this.#registerEntity(FletchingTable);
const workstation_helpScale = 0.2;
const workstationHelp = new StaticCubeEntity(
this,
[-16, 1, 28],
[0.333 * workstation_helpScale, 7.38 * workstation_helpScale, 10.851 * workstation_helpScale],
[{ modelId: "workstationHelp", scale: workstation_helpScale }],
);
workstationHelp.body.quaternion = new phys.Quaternion().setFromAxisAngle(phys.Vec3.UNIT_Y, Math.PI / 4);
this.#registerEntity(workstationHelp);
this.#registerEntity(
new StaticLightEntity(this, [-15, 3, 26], {
new StaticLightEntity(this, [-9, 9, 22], {
color: [29 / 360, 0.66, 0.94],
falloff: 10,
}),
Expand Down Expand Up @@ -335,7 +344,7 @@ export class Game implements ServerHandlers<ClientMessage, ServerMessage> {
}),
);

let oreSpawner = new Spawner(this, [0, -17.65, -21.5], "iron", "raw_iron", "pickaxe");
let oreSpawner = new Spawner(this, [-0.3, -17.65, -21.5], "iron", "raw_iron", "pickaxe");
this.#registerEntity(oreSpawner);
this.#registerEntity(
new StaticLightEntity(this, [-2, -15, -8], {
Expand Down

0 comments on commit e2f258b

Please sign in to comment.