Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
orion3dgames committed Aug 8, 2024
1 parent 5846dc4 commit f9f5ed9
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 67 deletions.
18 changes: 17 additions & 1 deletion src/client/Entities/Entity/EntityMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { Scene } from "@babylonjs/core/scene";
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { Vector3, Vector4 } from "@babylonjs/core/Maths/math";
import { Color3, Vector3, Vector4 } from "@babylonjs/core/Maths/math";
import { Entity } from "../Entity";
import { Skeleton } from "@babylonjs/core/Bones/skeleton";
import { GameController } from "../../Controllers/GameController";
import { EquipmentSchema } from "../../../server/rooms/schema";
import { UserInterface } from "../../Controllers/UserInterface";
import { VatController } from "../../Controllers/VatController";
import { EquippableType } from "../../../shared/types";
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";

export class EntityMesh {
private _entity: Entity;
Expand All @@ -25,6 +26,7 @@ export class EntityMesh {
public playerMesh;
public debugMesh: Mesh;
public selectedMesh: Mesh;
public selectedCone: Mesh;
public fakeShadow: Mesh;
public equipments;

Expand Down Expand Up @@ -89,6 +91,20 @@ export class EntityMesh {
selectedMesh.position = new Vector3(0, 0.05, 0);
this.selectedMesh = selectedMesh;

// add cone of view
/*
const coneMat = new StandardMaterial("coneMat");
coneMat.diffuseColor = Color3.Green();
coneMat.alpha = 0.5;
const tessellation = 12;
const arc = 90 / 360;
const coneMesh = MeshBuilder.CreateDisc("Cone", { tessellation, arc, radius: 3 }, this._scene);
coneMesh.position = new Vector3(0, 0.5, 0);
coneMesh.parent = this._entity;
coneMesh.material = coneMat;
coneMesh.rotation = new Vector3(Math.PI / 2, Math.PI / 1.2, 0);
this.selectedCone = coneMesh;*/

// add cheap shadow
if (this._loadedAssets["DYNAMIC_shadow_01"]) {
let shadowMesh = this._loadedAssets["DYNAMIC_shadow_01"].createInstance("shadow_" + this._entity.sessionId);
Expand Down
12 changes: 7 additions & 5 deletions src/client/Entities/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import State from "../../client/Screens/Screens";
import { Ability, EntityState, ServerMsg } from "../../shared/types";
import { GameScene } from "../Screens/GameScene";
import { PlayerAbility } from "./Player/PlayerAbility";
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";

export class Player extends Entity {
public game;
Expand Down Expand Up @@ -122,9 +123,9 @@ export class Player extends Entity {
// if spawninfo available
if (!target.spawnInfo) return false;

/*
// if targets is aggressive, clicking on with will trigger move & attack
// note: need to find a better way to do this, not linked to hotbar
/*
if (target.spawnInfo.aggressive) {
// send to server
this._game.sendMessage(ServerMsg.PLAYER_HOTBAR_ACTIVATED, {
Expand Down Expand Up @@ -160,18 +161,20 @@ export class Player extends Entity {
sessionId: metadata.sessionId,
});
}
/*

// move to clicked point
if (metadata.type === "environment" && !this.isDead) {
/*
// deselect any entity
this._game.selectedEntity = false;
/*
// removed click to move
// todo: add client prediction.
let destination = pointerInfo._pickInfo.pickedPoint;
let pickedMesh = pointerInfo._pickInfo.pickedMesh;
console.log("[LEFT CLICK]", destination);
const foundPath = this._navMesh.getRegionForPoint(destination);
if (foundPath) {
// remove decal if already exist
Expand All @@ -196,9 +199,8 @@ export class Player extends Entity {
z: destination._z,
});
}
*/
}
*/
}

// update at engine rate 60fps
Expand Down
4 changes: 2 additions & 2 deletions src/server/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class Database {
20,
20,
20,
//"training_ground",
"lh_town",
"training_ground",
//"lh_town",

6.18,
0.1,
Expand Down
11 changes: 8 additions & 3 deletions src/server/data/AbilitiesDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let AbilitiesDB: abilityMap = {
soundDelay: 800,
description: "A unimpressive attack that deals very little damage.",
castSelf: false,
needTarget: true,
castTime: 0,
cooldown: 1000,
repeat: 0,
Expand All @@ -32,10 +33,11 @@ let AbilitiesDB: abilityMap = {
icon: "ICON_ABILITY_slice_attack",
sound: "hit_a",
soundDelay: 500,
description: "A slice attack that deals damage to enemies in around player.",
description: "A slice attack that deals light damage to enemies in around player.",
castSelf: false,
needTarget: false,
castTime: 0,
cooldown: 5000,
cooldown: 2000,
repeat: 0,
repeatInterval: 0,
range: 4,
Expand All @@ -47,7 +49,7 @@ let AbilitiesDB: abilityMap = {
color: "white",
},
casterPropertyAffected: [],
targetPropertyAffected: [{ key: "health", type: CalculationTypes.REMOVE, min: 25, max: 40 }],
targetPropertyAffected: [{ key: "health", type: CalculationTypes.REMOVE, min: 5, max: 10 }],
},

fire_dart: {
Expand All @@ -59,6 +61,7 @@ let AbilitiesDB: abilityMap = {
soundDelay: 100,
description: "Sends a small flaming projectile towards the target.",
castSelf: false,
needTarget: true,
castTime: 1000,
cooldown: 1000,
repeat: 0,
Expand Down Expand Up @@ -91,6 +94,7 @@ let AbilitiesDB: abilityMap = {
soundDelay: 100,
description: "Gradually drains the target's HP over an extended period of time.",
castSelf: false,
needTarget: true,
castTime: 0,
cooldown: 10000,
repeat: 5,
Expand Down Expand Up @@ -119,6 +123,7 @@ let AbilitiesDB: abilityMap = {
soundDelay: 0,
description: "Restores health to the target.",
castSelf: true,
needTarget: true,
castTime: 1000,
cooldown: 1000,
repeat: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/server/data/LocationsDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let LocationsDB = {
{
type: "zone_change",
from: new Vector3(13.82, 0.1, -33.46),
to_map: "lh_dungeon_01",
to_map: "training_ground",
to_vector: new Vector3(0, 0, 0),
},
{
Expand Down
Loading

0 comments on commit f9f5ed9

Please sign in to comment.