diff --git a/internal/hooks/NewRound_AutoHeal.go b/internal/hooks/NewRound_AutoHeal.go index fd8d69a0..d5722026 100644 --- a/internal/hooks/NewRound_AutoHeal.go +++ b/internal/hooks/NewRound_AutoHeal.go @@ -3,6 +3,7 @@ package hooks import ( "fmt" + "github.com/GoMudEngine/GoMud/internal/configs" "github.com/GoMudEngine/GoMud/internal/events" "github.com/GoMudEngine/GoMud/internal/rooms" "github.com/GoMudEngine/GoMud/internal/users" @@ -22,6 +23,8 @@ func AutoHeal(e events.Event) events.ListenerReturn { return events.Continue } + deathRecoveryRoomId := int(configs.GetSpecialRoomsConfig().DeathRecoveryRoom) + onlineIds := users.GetOnlineUserIds() for _, userId := range onlineIds { user := users.GetByUserId(userId) @@ -31,24 +34,26 @@ func AutoHeal(e events.Event) events.ListenerReturn { continue } + if user.Character.RoomId == deathRecoveryRoomId { + continue + } + healthStart := user.Character.Health if user.Character.Health < 1 { - if user.Character.RoomId != 75 { - if user.Character.Health <= -10 { + if user.Character.Health <= -10 { - user.Command(`suicide`) // suicide drops all money/items and transports to land of the dead. + user.Command(`suicide`) // suicide drops all money/items and transports to land of the dead. - } else { - user.Character.Health-- - user.SendText(`you are bleeding out!`) - if room := rooms.LoadRoom(user.Character.RoomId); room != nil { - room.SendText(fmt.Sprintf(`%s is bleeding out! Somebody needs to provide aid!`, user.Character.Name), user.UserId) - } + } else { + user.Character.Health-- + user.SendText(`you are bleeding out!`) + if room := rooms.LoadRoom(user.Character.RoomId); room != nil { + room.SendText(fmt.Sprintf(`%s is bleeding out! Somebody needs to provide aid!`, user.Character.Name), user.UserId) } - } + } else { if user.Character.Health > 0 { diff --git a/internal/rooms/roommanager.go b/internal/rooms/roommanager.go index ab799c10..786b75c2 100644 --- a/internal/rooms/roommanager.go +++ b/internal/rooms/roommanager.go @@ -267,6 +267,15 @@ func MoveToRoom(userId int, toRoomId int, isSpawn ...bool) error { cfg := configs.GetSpecialRoomsConfig() + // If they are being moved to the death recovery room + // Put them in their own instance of it. + deathRecoveryRoomId := int(cfg.DeathRecoveryRoom) + if toRoomId == deathRecoveryRoomId { + if newRooms, err := CreateEphemeralRoomIds(deathRecoveryRoomId); err == nil { + toRoomId = newRooms[deathRecoveryRoomId] + } + } + if toRoomId == StartRoomIdAlias { // If "StartRoom" is set for MiscData on the char, use that.