12 Jul 2019 |
Alex | I tried sharing another message which causes Riot to crash | 15:50:31 |
Alex | Anyway it would be like "darkness/" .. entity:get_sprite():get_id() | 15:51:17 |
daniel-molina | ok | 15:51:43 |
Alex | The hardest part might be reorganizing the assets in this way so I'll do that first | 15:52:19 |
Alex | It sounds like you're suffering from the heat quite a bit so there's no pressure to do it today | 15:52:54 |
daniel-molina | haha, I can work | 15:53:23 |
daniel-molina | or maybe share ideas with you | 15:53:40 |
daniel-molina | sometimes I think t is useful to you to share your thinkings, it is ok with me | 15:54:20 |
Alex | Yes | 15:54:28 |
Alex | Feel free to commit anything to a branch | 15:54:39 |
Alex | It will take me a little while to reorganize the assets but I'll do that now | 15:54:48 |
Alex | This will be a bit tricky. It's okay to commit some code that doesn't work. | 15:55:00 |
daniel-molina | I will look for some commands to check if a file exists in lua | 15:55:33 |
Alex | I think Solarus itself might have some helpers | 15:56:22 |
Alex | But also you might be able to try creating a new sprite object with the given ID, and just use a try/catch if it fails | 15:56:49 |
Alex | Maybe we should also think about what functions the darkness menu needs | 15:57:31 |
Alex | Like perhaps darkness:process_entities() performs the looping over all entities, and calls darkness:process_entity(entity) internally. The second function will have the logic which looks for the darkness sprite. | 15:58:21 |
Alex | Oh right, but we have to keep draw functions separate from on_creation functions | 15:59:25 |
Alex | Generally speaking, maybe the first step is just to break up the existing code into separate function so it makes more sense | 15:59:52 |
Alex | Then it will be easier to refactor and add new functions without breaking it | 16:00:09 |
Alex | The spotlights are also a separate thing | 16:01:46 |
Alex | I think we should handle it similar to how we did the interaction bubble. So if an entity has a function like "entity:should_show_spotlight()` then show the spotlight | 16:02:26 |
llamazing | @Alex I don't understand why you said earlier that you need a game:on_map_loaded() event? Wouldn't that just be the same as map:on_started() ? | 16:02:08 |
Alex | In the case of a torch entity, the should_show_spotlight() function would be true if torch.is_lit is true | 16:02:59 |
daniel-molina | another function would be needed to get the radius | 16:03:58 |
Alex | Maybe it could be called get_spotlight_size() instead. If it doesn't exist on the entity, the entity is skipped. If it does exist it should return the size, or nil / false to not draw the spotlight | 16:05:04 |
Alex | I'll take notes on the issue | 16:05:50 |
daniel-molina | and what about the sprite:get_id(), do you have an idea of how to define it? Alex | 16:07:33 |
Alex | In reply to @daniel-molina:matrix.org and what about the sprite:get_id(), do you have an idea of how to define it? Alex Oh shit. I had no idea this wasn't in the engine. | 16:08:18 |
Alex | Oh, I just have the wrong name | 16:08:35 |