mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-11-17 20:50:05 +00:00
moved internal/protocol/cnpeer to cnpeer
also started a util package
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package entity
|
||||
|
||||
import "github.com/CPunch/gopenfusion/internal/protocol"
|
||||
import "github.com/CPunch/gopenfusion/cnpeer"
|
||||
|
||||
type EntityKind int
|
||||
|
||||
@@ -20,6 +20,6 @@ type Entity interface {
|
||||
SetPosition(x, y, z int)
|
||||
SetAngle(angle int)
|
||||
|
||||
DisappearFromViewOf(peer *protocol.CNPeer)
|
||||
EnterIntoViewOf(peer *protocol.CNPeer)
|
||||
DisappearFromViewOf(peer *cnpeer.CNPeer)
|
||||
EnterIntoViewOf(peer *cnpeer.CNPeer)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package entity
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/CPunch/gopenfusion/cnpeer"
|
||||
"github.com/CPunch/gopenfusion/internal/protocol"
|
||||
)
|
||||
|
||||
@@ -62,13 +63,13 @@ func (npc *NPC) SetAngle(angle int) {
|
||||
npc.Angle = angle
|
||||
}
|
||||
|
||||
func (npc *NPC) DisappearFromViewOf(peer *protocol.CNPeer) {
|
||||
func (npc *NPC) DisappearFromViewOf(peer *cnpeer.CNPeer) {
|
||||
peer.Send(protocol.P_FE2CL_NPC_EXIT, protocol.SP_FE2CL_NPC_EXIT{
|
||||
INPC_ID: int32(npc.ID),
|
||||
})
|
||||
}
|
||||
|
||||
func (npc *NPC) EnterIntoViewOf(peer *protocol.CNPeer) {
|
||||
func (npc *NPC) EnterIntoViewOf(peer *cnpeer.CNPeer) {
|
||||
peer.Send(protocol.P_FE2CL_NPC_NEW, protocol.SP_FE2CL_NPC_NEW{
|
||||
NPCAppearanceData: npc.GetAppearanceData(),
|
||||
})
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/CPunch/gopenfusion/cnpeer"
|
||||
"github.com/CPunch/gopenfusion/internal/db"
|
||||
"github.com/CPunch/gopenfusion/internal/protocol"
|
||||
)
|
||||
|
||||
type Player struct {
|
||||
db.Player
|
||||
Peer *protocol.CNPeer
|
||||
Peer *cnpeer.CNPeer
|
||||
Chunk ChunkPosition
|
||||
}
|
||||
|
||||
func NewPlayer(peer *protocol.CNPeer, player *db.Player) *Player {
|
||||
func NewPlayer(peer *cnpeer.CNPeer, player *db.Player) *Player {
|
||||
return &Player{
|
||||
Player: *player,
|
||||
Peer: peer,
|
||||
@@ -51,13 +52,13 @@ func (plr *Player) SetAngle(angle int) {
|
||||
plr.Angle = angle
|
||||
}
|
||||
|
||||
func (plr *Player) DisappearFromViewOf(peer *protocol.CNPeer) {
|
||||
func (plr *Player) DisappearFromViewOf(peer *cnpeer.CNPeer) {
|
||||
peer.Send(protocol.P_FE2CL_PC_EXIT, protocol.SP_FE2CL_PC_EXIT{
|
||||
IID: int32(plr.PlayerID),
|
||||
})
|
||||
}
|
||||
|
||||
func (plr *Player) EnterIntoViewOf(peer *protocol.CNPeer) {
|
||||
func (plr *Player) EnterIntoViewOf(peer *cnpeer.CNPeer) {
|
||||
peer.Send(protocol.P_FE2CL_PC_NEW, protocol.SP_FE2CL_PC_NEW{
|
||||
PCAppearanceData: plr.GetAppearanceData(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user