Skip to content

Commit 37444c4

Browse files
committed
Add Entity.ServerClass() back
Could be useful to someone
1 parent 1575e3a commit 37444c4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

sendtables/entity.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ import (
1111

1212
// Entity stores a entity in the game (e.g. players etc.) with its properties.
1313
type Entity struct {
14-
id int
15-
props []Property
14+
serverClass *ServerClass
15+
id int
16+
props []Property
1617

1718
onCreateFinished []func()
1819
onDestroy []func()
1920
}
2021

22+
// ServerClass returns the entity's server-class.
23+
func (e *Entity) ServerClass() *ServerClass {
24+
return e.serverClass
25+
}
26+
2127
// ID returns the entity's ID.
2228
func (e *Entity) ID() int {
2329
return e.id

sendtables/sendtables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (sc *ServerClass) newEntity(r *bit.BitReader, entityID int) *Entity {
9090
props[i] = Property{entry: &sc.flattenedProps[i]}
9191
}
9292

93-
entity := &Entity{id: entityID, props: props}
93+
entity := &Entity{serverClass: sc, id: entityID, props: props}
9494

9595
if sc.preprocessedBaseline != nil {
9696
entity.applyBaseline(sc.preprocessedBaseline)

0 commit comments

Comments
 (0)