RP and RepeatPan's mods

That’s sadly one of my weak points. I aim to please, which means that I would rather not do something than do it poorly. The only reason I would do a sloppy job is because I didn’t realise earlier that it would be that difficult/impossible and I tried about every way I could imagine.

As for the move part… I might have a solution. So:

18:49: Idea which I am not too fond of. Basically, it’s a copy of PlaceableItemProxyComponent, where the line that adds the placed_item component to entity has been removed.

19:13: A simple copy of the PlaceableItemProxyComponent proved to be non-working. I’m quite desperate at this point; I don’t want to re-invent the wheel.

19:33: And back we are after a very short intermezzo where @SteveAdamo threatened me… I hope the function head in his bed makes clear that there is no messing around with the family.

19:45: Well, this seems to work. By adding a new field to stonehearth:placeable_item_proxy I’ve managed to create “unmovable” objects. This is likely something that will be in RP 2703 and newer, but since I don’t want people to use dev versions unless they really have to, I’ll keep it in as a version-limited hack (just like click_and_gone that I need to update too at some point…)

Next step: Growth effects. Oh, and growing trees should probably be not be sprouted, as that “resets” their model. I’ll have to check for a solution for that, too.

19:53: And there we go, growing effects implemented. I had a glorious choice between a bunch of sound effects and the fire pit. Guess which critter is burning in its final stage now. Kind of. fursplosion looks like it isn’t implemented yet, sadly.

19:58: I’ve defined a table which defines which components are copied over from each stage; so far this is stonehearth:resource_node and unit_info. This means that description and name can be changed with each growth stage, too. Perhaps I should move those into a sub-key of the growth stage, but then again…

Harvesting shoots is disabled for these trees; let’s see if I can bring them back.

20:03: Hm. The model change to depleted is right in the middle of RenewableResourceNodeComponent:spawn_resource… I can’t really prevent that. If I carried over stonehearth:renewable_resource_spawned from rp_click_and_gone to RP I might…

I’m afraid I’ll have to do just that. So let’s move on to r2703 and carry over the new hooks; then re-write rp_cag and after that we’re back to trees.

20:30: Added the resource events in RP and updated rp_click_and_gone to use them. Officially less hackish now.

I’ve changed the order too, so we don’t need timers for now.

Next thing: Moving the unmovable part into RP, too.

20:45: Moved the unmovable part to RP and fixed where I accidentally a whole location.

I think at this stage I’m pretty much done. One last thing to do is to add the possibility to call functions when growth happens - that seems like a reasonable thing to do.

20:59: _radiant.call does not like entities. At least not if they are passed “plain”, i.e. not boxed in a table. So I guess the on_start command that we fire will have to expect to be used like an event rather than a normal command/call, sadly.

21:08: rp_diy_trees:enable_shooting might be a slightly confusing name. I love it.

21:14: That should do the trick. Now I just have to close the 11 SciTE windows I had opened. Start fresh before I overwrite changes…

21:15: ["ntit"] = "(Entity 5976 Little Tree)"; I would like to solve: “Untitled”! buzzer

21:18: I really think that Radiant’s json parser is seriously broken. It concats strings ([ "Hello", "World" ] to one element, Hello""World) and { foobar : "bar" } does not throw an exception but rather yields { ooba = "bar" } as lua object… Errr…

21:22: Who had the idea to call a command “enable_command” which takes two parameters: the command name and whether it’s enabled or not. Really! I would expect enable_command("foo") to enable foo, not to disable it (because nil evaluates to false).

Right, so the saplings are yielding no sprouts until they reach a certain height (by using the “on_start” call in the json). Next I have to disable the “depleted” thing. I’m not really satisfied with calling the event just on the component; I think it should be on the entity too. Subscribing to a component’s event doesn’t sound very modular. Yeah, let’s change that.

21:32: In other news, I’m not a big fan of this system as a whole. Subscribing to every entity created just to subscribe to a few (or even one) events seems like a very unnecessary process. I might deal some magic with RP to have these entities fire on a special manager too. That would be nice. But we’ll do that after the next update. Perhaps I’m missing something.
I also completely forgot why I wanted to move that event. Uhhh… Ah right, setting the model wasn’t it.

21:37: Alright, done. The model now properly stays the same it was before, nice.

Right. Let’s see if I can nicely identify trees. I guess searching the entity uri for ‘oak_tree’ will do the trick for now. Renaming a few things to make this work.

21:49: dumdidum.

21:54: Being unable to disable commands before they are created is a pain. It would be much cleaner if they stored command changes (i.e. calls to enable_command) in a table for commands that have not been added yet. Then, when the command is added, it simply inherits that state (to work for default-disabled commands too).

22:01: commands:disable_command("chop_tree", true) - see? SEE? Just what I’ve talked about. I’ve typed up to “true” before realising what I was doing.

22:11: Added automagical chop detection. That means that trees can turn on/of whether they can be lumbered or not during growth. For example, you could have a tree that isn’t choppable (sapling), then is (tree), then turns into a flower and thirteen moons later becomes Yggsdrasil and satisfies all your wood needs for… like ever.

I’m quite satisfied with the current version and while it is far from done, I think it’s a neat tech demo. Refactoring stuff to make it easier to use.

22:25: Alright, here we go. Took me a day and it isn’t as pretty as I would like it to but I think it’s quite an achievement given the tools we have to work with.

To use it, RP r2701 is the base; however the WIP r2703 rp.smod is required because of the new events that I’m using. The mod itself is available here. So if you’re curious, have the latest WIP video here (including @SteveAdamo beloved pouff).

The mod currently only contains a sapling for oak trees, but copying and adapting it should be really easy. I’m curious what @Miturion can do with it - in theory, it could be used for all growing things - wheat, flowers, you name it. However, it’s currently a bit hard coded to chopping.

If you have any questions, requests or something let me know. Known issues:

  • The size cannot be changed once the sapling has been spawned. That’s an issue Radiant has to fix (!summon whoever-is-responsible). If we could, we could simply adapt the size in each growth stage or introduce new growth stages this way - would be really amazing.
  • It’s kind of hard-coded for trees right now; that is it will check the stonehearth:resource_node for a durability > 0 and then enable the ‘chop’ command. I might change this in the future to allow/change this behaviour. In theory, you can use whatever you want using the on_start callback in every growth stage. I’m not sure what to do here, because it really screams for an observer instead of this built-in functionality. Plus there would be on_start, but hm.
  • The icon is too cute and might cause allergic reactions, I know. Sorry!
  • duration currently uses gameloop ticks (5/second) instead of a calendar entry. This would be another excellent use of timers, as the usual code for this kind of thing is a copy-paste and does not allow minutes. I might add something like timers to RP; we’ll see.

So right, that’s it. That was about how I develop mods, including all the nasty side-effects that occur. The final product usually looks so much easier but it’s all a matter of getting used to it. RP’s API actually proves to be quite useful for certain things. Now it’s time for Rick and Morty.

3 Likes

well, your efforts are most appreciated… and not just on the awesome mod, but in capturing your work log … probably fairly therapeutic for you I imagine? :smile:

1 Like

It’s more of a help than anything else. For example, I’ve needed to look up the functions of render_info a few times. Since they have no documentation yet, I’ve used the (previously dumped and here posted) values to get a rough idea of what it is. It’s also a nice way of keeping track of what I have already done and what needs to be done. On top of that it’s a review already; if I write something and notice that this makes absolutely no sense (which, when I was “in the zone” writing the code might have been), I can go back and change it.

I doubt that there’s too much interest in how I code (as these steps were extremely rough in any way too). I could imagine doing videos/livestreams of creating mods at a later point, however. You’d have to endure no sound or my horrible music collection, however.

as long as there’s a webcam involved, count @Geoffers747 in…

but don’t worry about code deep dives, there are plenty of is who enjoy and learn from them…

1 Like

How about @Geoffers747 providing the webcam? He could comment what I do. That could be pretty interesting, especially if he had to make things up.

3 Likes

So you code, and I commentate … this wouldn’t end well. For anyone.

5 Likes

We can’t know until we’ve tried!

that’s what I said! just before filing for that restraining order… again

1 Like

@RepeatPan i would watch :smile:
I’m quite interested in coding in general, even more if i can mod StoneHearth with it.

I can’t say I’d know too much of what was going on, but if @Geoffers747 was live on webcam struggling to commentate, I would definitely be in attendance. :slight_smile:

5 Likes

See, @Geoffers747, it’s a common request.

For real though, I can hardly comment what I am doing and code at the same time. Most of the time I talk to myself, make inside jokes (or inside inside jokes, i.e. jokes that only I know), references to stuff that comes into my mind (… just take a look at any comment I made in the source of anything) or simply answer “yes” when asked something. Not sure if I could be that much of an entertainer when it comes to coding, we would have to try.

I’m willing to give it a try, but likely after the update hit. Upgrading RP is going to be a nuisance and reverse-engineering everything (if that should be necessary) is going to be quite boring too; not mentioning that I might need to dip in (unrelated) C to get it working.

Also, we would need an idea what to do.

Well, I’m going to assume from this that you have a mic, the software, and it’s all working (lets face it, it’s almost undoubtedly working if it’s yours). However, you might not need it. When Tom wants to livestream but not get too distracted and get plenty of work done, he avoids it by not having his mic on. What you could instead then do, is take a leaf out of his book. Simply, have Notepad open or something similar, and in it have written what you want to do. Expand on how you’re going to do each bit as much as you like, however I recommend keeping each concise and just as an overview. This means that viewers can tune in at any time and just see on your screen what you’re planning. And, if you simply ticked off, or made green etc. each step you completed, people could also know your progress. It’s then also easy for you to summarise and see what progress you made, as well as log it.

Lets face it, coding isn’t the most entertaining thing in the world (to most). But that isn’t to say it isn’t quite interesting, so as long as you can keep an interest for people, ignore trying to entertain them.

However, if you could actually talk whilst coding, I think it would be ideal, as it could be really interesting, to get a running insight as to what you’re doing, because you of course couldn’t type it up as you went because that would take forever. And if you can persuade @Geoffers747 to commentate for you, ignore all of what I said.

1 Like

You are right this time, however you should never, ever assume that simply because somebody can program or understands computer science he has any idea about IT. I’ve seen too many professors struggle with PowerPoint and projectors at university to believe that there’s any kind of correlation…

I think that could actually work out. I’m not somebody who keeps this kind of list usually. I just have a general idea of what there is to do and then do that - if something else pops up (like the world loading bug today, or RP’s refactoring/changing).

I would need to think about the setup however, since a “normal” coding involves lots of switches between Stonehearth, SciTE, the explorer and from time to time my browser. Either I would stream my whole monitor, which I’m not sure would be much of a help in 720p, or I’m trying to figure something out using hotkeys/get myself some OBS-fu skills.

The question after the what still remains, however. We could probably figure that one out in advance.

2 Likes

i would tune in… but it would likely be a NSFW stream… at least, i know -I- swear when i code…

4 Likes

Well, I don’t swear but I think my stream would likely be PEGI 12…

I guess we can try it at some point; I could try to do a test stream tomorrow (in… 6-12 hours?) where I complete rp_diy_trees with the few missing features. Even if it’s not “live”, I guess it can be archived and I could get some feedback for the “real” one.

1 Like

So apparently a lot happened here in the last few days while I was on a brief holiday. As for everything you’ve done it seems interesting, I just skimmed it so far. The issue with mixins overriding I’m pretty sure I’ve mentioned before, it was encountered due to attempts at new sub-races. Do you have any idea what main action bar does? I thought it somehow filled the startmenu but that turned out wrong, it seems like useless code to me which is quite odd.

I’ve stumbled across the action bar too, but as far as I can tell it has no real use. Maybe it’s an outdated version of the start menu, maybe it’s a work in progress.

Either way, it inspired me to do the JSON based approach that RP uses to change/fill the start menu.

1 Like

It’s a pity in my opinion as I figured out how to insert things into the boxmenu thing and it’s really easy. So easy in fact that your add to startmenu code would become about 5 lines if it actually used it. The only hint is in the tip popup code there is code to call a show_main_actionbar event that isn’t used anywhere and is commented out.

My startmenu code would only become smaller if the whole thing really used Ember or some other templating thoroughly, otherwise I would still need to mess around with the DOM - and of course, parse it too. There are certain things that cannot be avoided, such as the click handler handling.

Edit (8:12): Preparing everything for the test stream. As said before, I’ll likely do the following:

  • Quick demonstration of my setup and explanation why all folders are red and green, why I have a bats infestation and some coding pearls.
  • Implement different growth sizes for stages, even if we can’t see them because the engine bugs around
  • Think of a way to handle the resource_node thing so it would allow different resources/actions, perhaps even different actions per chop? Brainstorming about the possibilities and final implementation.
  • Implementing timers into RP and using them instead of duration.

I’ll start in ten minutes or so and the stream should be recorded b Twitch; I’ll link that afterwards too.

@RepeatPan. What do you want me to do with the models? The seem to stay in place now. Although I could do some variation in models.