Make players mobs too !
This commit is contained in:
+3
-2
@@ -8,6 +8,7 @@ import { box_overlaps_block, can_place, placement_target } from "$/common/utils.
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
import { RemoteEntity } from "./entity/remote_entity.ts";
|
||||
import { Player } from "./entity/player.ts";
|
||||
import type { Entity } from "./entity/entity.ts";
|
||||
|
||||
// breaking and using blocks against a server, like minecraft's MultiPlayerGameMode. the client times breaking
|
||||
// and guesses the results so they feel instant, the server decides what really happens
|
||||
@@ -95,8 +96,8 @@ export class MultiPlayerGameMode {
|
||||
container.set_item(index, item.amount > 0 ? item : undefined);
|
||||
}
|
||||
|
||||
// left click on an entity, the server decides whether it's hurt
|
||||
attack(entity: RemoteEntity) {
|
||||
// left click on an entity or another player, the server decides whether it's hurt
|
||||
attack(entity: Entity) {
|
||||
this.client.player.send_position_now();
|
||||
this.client.connection.send({ type: "attack_entity", id: entity.id });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user