finish setup data insertion, add world insertion

This commit is contained in:
lbenedar
2026-04-22 18:18:43 +03:00
parent 21abe68858
commit f46ff8333e
66 changed files with 2257 additions and 676 deletions

View File

@@ -16,22 +16,26 @@ type User struct {
// UsersFlags any `json:"flags,omitempty"`
}
func (u *User) ToDB(dest *db.User) bool {
func (u *User) ToDB(dest **db.User) bool {
if dest == nil {
return false
}
dest.Name = u.Name
dest.Role = u.Role
dest.ID = u.ID
dest.Avatar = u.Avatar
dest.Character = u.Character
dest.Color = u.Color
dest.Pronouns = u.Pronouns
user := &db.User{
Name: u.Name,
Role: u.Role,
ID: u.ID,
Avatar: u.Avatar,
Character: u.Character,
Color: u.Color,
Pronouns: u.Pronouns,
}
u.UsersStats.ToDB(&dest.Stats)
u.UsersStats.ToDB(&user.Stats)
HotbarToDB(&dest.Hotbar, u.Hotbar)
HotbarToDB(&user.Hotbar, u.Hotbar)
*dest = user
return true
}