mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-11-09 17:10:07 +00:00
movement.go: added support for basic movement packets
you should be able to view other players and jump around together, although while testing locally one of the clients would always trigger the "Some irregularities have been found with your connection to the server, so your game will be closed" speed check for some reason ??? really not sure, might just be my machine chunking uhhh works ? kind of, not tested for more than a few seconds before one of the clients disconnects
This commit is contained in:
@@ -122,7 +122,7 @@ const (
|
||||
)
|
||||
|
||||
func (db *DBHandler) readPlayer(rows *sql.Rows) (*entity.Player, error) {
|
||||
plr := entity.Player{ActiveNanoSlotNum: -1}
|
||||
plr := entity.Player{ActiveNanoSlotNum: 0}
|
||||
|
||||
if err := rows.Scan(
|
||||
&plr.PlayerID, &plr.AccountID, &plr.Slot, &plr.PCStyle.SzFirstName, &plr.PCStyle.SzLastName,
|
||||
|
||||
@@ -28,11 +28,16 @@ func (c *Chunk) RemoveEntity(entity Entity) {
|
||||
|
||||
// send packet to all peers in this chunk and kill each peer if error
|
||||
func (c *Chunk) SendPacket(typeID uint32, pkt ...interface{}) {
|
||||
c.SendPacketExclude(nil, typeID, pkt...)
|
||||
}
|
||||
|
||||
func (c *Chunk) SendPacketExclude(exclude Entity, typeID uint32, pkt ...interface{}) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
for entity := range c.Entities {
|
||||
if entity.GetKind() != ENTITY_KIND_PLAYER {
|
||||
// only send to players, and exclude the player that sent the packet
|
||||
if entity.GetKind() != ENTITY_KIND_PLAYER || entity == exclude {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,6 @@ func (plr *Player) GetAppearanceData() protocol.SPCAppearanceData {
|
||||
PCStyle: plr.PCStyle,
|
||||
IPCState: plr.IPCState,
|
||||
ItemEquip: plr.Equip,
|
||||
Nano: protocol.SNano{}, //plr.Nanos[plr.ActiveNanoSlotNum],
|
||||
Nano: plr.Nanos[plr.ActiveNanoSlotNum],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user