Skip to content

Commit

Permalink
preventing clicking enemies triggers auto attack from player
Browse files Browse the repository at this point in the history
  • Loading branch information
orion3dgames committed Apr 11, 2024
1 parent ff4c28f commit 5bc8f3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
25 changes: 11 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "T5C Dev Server",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["-r", "ts-node/register/transpile-only", "--prof"],

"args": ["src/server/index.ts"],

"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
{
"name": "T5C Dev Server",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-node-dev",
"runtimeArgs": ["--respawn", "--prof", "--transpile-only", "src/server/index.ts"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
}
4 changes: 2 additions & 2 deletions src/client/Entities/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ export class Entity extends TransformNode {

public remove() {
// delete any ui linked to entity
this.characterLabel.dispose();
this.characterChatLabel.dispose();
//this.characterLabel.dispose();
//this.characterChatLabel.dispose();
if (this.interactableButtons) {
this.interactableButtons.dispose();
}
Expand Down
11 changes: 5 additions & 6 deletions src/client/Entities/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ export class Player extends Entity {
// if spawninfo available
if (!target.spawnInfo) return false;

// if targets is aggresive
// note: need to find a better wayt to do this, not linked to hotbar
// 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 All @@ -146,7 +147,7 @@ export class Player extends Entity {
digit: 1,
});
return false;
}
}*/

// if interactable target
if (!target.spawnInfo.interactable) return false;
Expand All @@ -167,14 +168,13 @@ export class Player extends Entity {
}
}

/*
// pick up item
if (metadata.type === "item") {
this._game.sendMessage(ServerMsg.PLAYER_PICKUP, {
sessionId: metadata.sessionId,
});
}
/*
// move to clicked point
if (metadata.type === "environment" && !this.isDead) {
// deselect any entity
Expand Down Expand Up @@ -323,7 +323,6 @@ export class Player extends Entity {
// look for closest npc
// todo: maybe this is a silly way?
this.findCloseToInteractableEntity();
//console.log("closest entity is ", this.closestEntity.name, this.closestEntityDistance);

// if close enough, show interactable button
if (this.closestEntityDistance < 5 && this.closestEntity.interactableButtons) {
Expand Down
8 changes: 4 additions & 4 deletions src/server/data/LocationsDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let LocationsDB = {
key: "lh_town",
mesh: "lh_town",
sun: true,
sunIntensity: 1,
sunIntensity: 0.2,
spawnPoint: {
x: 0,
y: 0,
Expand Down Expand Up @@ -45,9 +45,9 @@ let LocationsDB = {
aggressive: false,
canAttack: true,
points: [new Vector3(5.38, 0.01, -1.3), new Vector3(15.53, 0.01, -8.95), new Vector3(-4.72, 0.01, -2.28)],
amount: 100,
amount: 10,
race: "male_mage",
material: 0,
material: 1,
name: "Thief",
baseHealth: 20,
baseSpeed: Speed.VERY_SLOW,
Expand Down Expand Up @@ -81,7 +81,7 @@ let LocationsDB = {
new Vector3(-8.8, 0.01, -22.39),
new Vector3(-8.51, 0.01, -14.93),
],
amount: 50,
amount: 100,
race: "male_rogue",
material: 2,
name: "Bandit",
Expand Down

0 comments on commit 5bc8f3d

Please sign in to comment.