diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index ee0c3cc..56f13e8 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -927,6 +927,12 @@ event({object_crystal_activate, ObjectID}) -> event({object_event_trigger, BlockID, EventID}) -> send_1205(EventID, BlockID, 0); +event({object_goggle_target_activate, ObjectID}) -> + {ok, User} = egs_user_model:read(get(gid)), + {BlockID, EventID} = psu_instance:std_event(User#egs_user_model.instancepid, (User#egs_user_model.area)#psu_area.zoneid, ObjectID), + send_1205(EventID, BlockID, 0), + send_1213(ObjectID, 8); + event({object_key_console_enable, ObjectID}) -> {ok, User} = egs_user_model:read(get(gid)), {BlockID, [EventID|_]} = psu_instance:std_event(User#egs_user_model.instancepid, (User#egs_user_model.area)#psu_area.zoneid, ObjectID), diff --git a/src/psu/psu_instance.erl b/src/psu/psu_instance.erl index 77c49f2..f33f798 100644 --- a/src/psu/psu_instance.erl +++ b/src/psu/psu_instance.erl @@ -93,6 +93,11 @@ object_init([{floor_button, TrigEventID}|Tail], ZoneID, BlockID, ObjectID, Targe object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=floor_button, args={BlockID, TrigEventID}}), object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1); +object_init([{goggle_target, TrigEventID}|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex) -> + io:format("~p~n", [ObjectID]), + object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=goggle_target, args={BlockID, TrigEventID}}), + object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1); + %% @doc key: {InstancePid, ZoneID, ObjectID} object_init([{key, _KeySet, TrigEventID, _ReqEventID}|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex) -> object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=key, args={BlockID, [TrigEventID]}}), @@ -124,7 +129,6 @@ object_init([{warp, DestX, DestY, DestZ, DestDir}|Tail], ZoneID, BlockID, Object object_init([Object|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex) when Object =:= boss_gate; Object =:= shoot_button; - Object =:= goggle_target; Object =:= trap; Object =:= sensor -> object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1); @@ -142,7 +146,8 @@ object_init([Object|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, Objec Object =:= colored_minimap_section; Object =:= fog; Object =:= pp_cube; - Object =:= healing_pad -> + Object =:= healing_pad; + Object =:= unknown_object_28 -> object_init(Tail, ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex + 1); %% @doc Ignore everything else for now: objects with an ObjectID but without a TargetID. diff --git a/src/psu/psu_parser.erl b/src/psu/psu_parser.erl index b7baea7..3260d27 100644 --- a/src/psu/psu_parser.erl +++ b/src/psu/psu_parser.erl @@ -290,8 +290,9 @@ parse_object_args(49, _Params, _Data) -> parse_object_args(50, _Params, _Data) -> healing_pad; -parse_object_args(51, _Params, _Data) -> - goggle_target; +parse_object_args(51, _Params, Data) -> + << _Unknown:224, TrigEvent:16/little, _Rest/bits >> = Data, + {goggle_target, TrigEvent}; parse_object_args(53, _Params, _Data) -> label; diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index bbefea6..00a02a8 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -897,8 +897,7 @@ parse(Size, 16#0f0a, Channel, Data) -> ?ASSERT_EQ(VarO, 16#ffffffff), ?ASSERT_EQ(VarV, 1), ?ASSERT_EQ(VarW, 0), - ?ASSERT(), - ignore; %% @todo object_goggle_target_activate + {object_goggle_target_activate, ObjectID}; [56, 25] -> ?ASSERT_EQ(VarN, 16#ffffffff), ?ASSERT_EQ(VarO, 16#ffffffff),