diff --git a/message_server/ibp_ms.go b/message_server/ibp_ms.go index 6e1e02b..1a85856 100644 --- a/message_server/ibp_ms.go +++ b/message_server/ibp_ms.go @@ -2,6 +2,7 @@ package message_server import ( "fmt" + "log/slog" "time" "google.golang.org/protobuf/proto" @@ -96,7 +97,8 @@ func (ms *IbpMs) collectIBPButtonState(stationUid string, uidsMap *memory.IBPUid uid := stationUid + "_" + uidsMap.IbpButtonIds[data.Common.Id].Uid entry, ok := entity.GetEntityByUid(ms.vs.World, uid) if !ok { - return nil, fmt.Errorf("ibp按钮实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + slog.Warn("ibp按钮实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + continue } if entry.HasComponent(component.ButtonTag) { states = append(states, getIBPButtonState(data.Common.Id, entry)) @@ -125,7 +127,8 @@ func (ms *IbpMs) collectIBPAlarmState(stationUid string, uidsMap *memory.IBPUidS uid := stationUid + "_" + uidsMap.IbpAlarmIds[data.Common.Id].Uid entry, ok := entity.GetEntityByUid(ms.vs.World, uid) if !ok { - return nil, fmt.Errorf("ibp报警器实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + slog.Warn("ibp报警器实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + continue } if entry.HasComponent(component.AlarmTag) { states = append(states, &state.AlarmState{Id: data.Common.Id, Active: component.BitStateType.Get(entry).Val}) @@ -141,7 +144,8 @@ func (ms *IbpMs) collectIBPLightState(stationUid string, uidsMap *memory.IBPUidS uid := stationUid + "_" + uidsMap.IbpLightIds[data.Common.Id].Uid entry, ok := entity.GetEntityByUid(ms.vs.World, uid) if !ok { - return nil, fmt.Errorf("ibp指示灯实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + slog.Warn("ibp指示灯实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + continue } if entry.HasComponent(component.LightTag) { states = append(states, &state.LightState{Id: data.Common.Id, Active: component.BitStateType.Get(entry).Val}) @@ -157,7 +161,8 @@ func (ms *IbpMs) collectIBPKeyState(stationUid string, uidsMap *memory.IBPUidStr uid := stationUid + "_" + uidsMap.IbpKeyIds[data.Common.Id].Uid entry, ok := entity.GetEntityByUid(ms.vs.World, uid) if !ok { - return nil, fmt.Errorf("ibp钥匙实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + slog.Warn("ibp钥匙实体不存在: World id=%d, uid=%s", ms.vs.World.Id(), uid) + continue } if entry.HasComponent(component.KeyTag) { states = append(states, &state.KeyState{Id: data.Common.Id, Gear: component.GearStateType.Get(entry).Val})