fix errors on insertion to game, fix db creation of game

This commit is contained in:
lbenedar
2026-04-23 19:03:56 +03:00
parent f46ff8333e
commit 07025afefc
36 changed files with 1820 additions and 693 deletions

View File

@@ -18,24 +18,28 @@ type Actor struct {
// ActorsEffects []any `json:"effects"`
}
func (a *Actor) ToDB(dest *db.Actor) bool {
func (a *Actor) ToDB(dest **db.Actor) bool {
if dest == nil {
return false
}
dest.Img = a.Img
dest.Name = a.Name
dest.Type = a.Type
dest.Folder = a.Folder
dest.Sort = a.Sort
dest.ID = a.ID
actor := &db.Actor{
Img: a.Img,
Name: a.Name,
Type: a.Type,
Folder: a.Folder,
Sort: a.Sort,
ID: a.ID,
}
a.PrototypeToken.ToDB(&dest.PrototypeToken)
a.Stats.ToDB(&dest.Stats)
a.PrototypeToken.ToDB(&actor.PrototypeToken)
a.Stats.ToDB(&actor.Stats)
OwnershipToDB(&dest.Ownership, a.Ownership)
OwnershipToDB(&actor.Ownership, a.Ownership)
CopySliceToDB(&dest.Items, a.Items)
CopySliceToDB(&actor.Items, a.Items)
*dest = actor
return true
}