package game import ( "fmt" "strings" "thehouseoficarus/internal/net" ) func (g *Game) runEnterSteps(sess *net.Session, roomID int) { room, err := g.World.LoadRoom(roomID) if err != nil || len(room.OnEnter) == 0 { return } for _, step := range room.OnEnter { if step.Condition != nil && !g.checkCondition(sess, step.Condition) { continue } if step.Message != "" { sess.WriteLine(fmt.Sprintf("%s", step.Message)) } } } func (g *Game) BroadcastRespawns() { respawns := g.World.FlushObjRespawns() for _, st := range respawns { def, err := g.ObjectStore.Load(st.DefID) if err != nil || !def.IsGatherable() { continue } cfg := def.Gather if cfg.RespawnBroadcast == "" { continue } name := def.Name if idx := st.Index + 1; len(g.World.FindObjInstances(st.RoomID, st.DefID)) > 1 { name += fmt.Sprintf(" [%d]", idx) } msg := strings.ReplaceAll(cfg.RespawnBroadcast, "{name}", name) if g.Hub != nil { for _, sess := range g.Hub.PlayersInRoom(st.RoomID) { sess.WriteLine(g.colorize(sess, "broadcast", fmt.Sprintf("\n%s", msg))) } } } }