[WIP] (Alpha7) Fireplaces - 0.03a - 07.11.2014

Started by Kubouch, October 21, 2014, 06:41:56 PM

Previous topic - Next topic

Kubouch

So here comes the time I can't resist and dive myself into modding. My goal is to revive and expand this outdated and probably dead mod, Campfire: https://ludeon.com/forums/index.php?topic=3983.0. I sort of managed to cope with xml (I did the Smelter tutorial on Wiki) and now challenging myself with C#. Object programming is good to know and might come handy at some time, anyway :-). At least I know a bit of C++ and understand basic programming principles (variables, cycles, conditions, ...) so I'm not completely lost.

The idea of the mod is to add 2 buildings (Campfire and Fireplace) + 1 support building (Wood pile). You can cook on them but they consume wood. No wood => no fire. The wood is stored in a Wood pile which acts as a Hopper in the original game. Additionally the buildings emit light (when firing) and colonists get a happy thought when nearby. It adds a possibility to cook and see without electricity and also adds some beauty to prevent psychically unstable colonists from getting mad. On the other hand the cooking speed is much lower than of a cooking stove and you need wood to power it constantly.

Now I'm creating only Campfire. Fireplace is just a upgraded Campfire (after research) so I won't bother with it for now. I'd be glad for any help or insight you might have - especially in the [working on it] part.

This is how it looks now.

Here is a detailed list of features:
[done] [working on it] [planned] [not going to be implemented]


  • Basic xml setup:

    • Costs 5 wood to build but requires 1300 work to build - that's the same as Machining table (you know it takes a lot of time to haul the rocks...).
    • Has 100 health, inflammable.
    • You can cook only simple meals. No power needed
    • Currently impassable (maybe change that).
    • Doubled the time needed for cooking (480 work instead of 240).
    • Skill requirement for simple meal (5 - it's harder to cook on fire, I can tell) and more food needed for one meal (12). You gain more experience, though (80 vs 60 default).
    • Possible changes: change passability and altitude layer (you can walk over a campfire irl - might be wierd when burning, though), higher health

  • Emits light: Emits light permanently without using power. The light has more reddish vibe and its lighting radius is 2/3 of a standing lamp (9 vs 12).

  • Toggle to turn on/off light emitting and cooking capability: You can pick a colonist and right-click the Campfire. Two options available: "Start a fire", "Douse the flames" - toggles it light & cooking on/off.
    Another approach is to use bills system. Possible usage of resources.

  • Add a Wood pile: Acts as a Hopper. You can put wood (and other flammable materials) in it. Must be next to Campfire. When Campfire is toggled on, it slowly consumes the wood in a Wood pile. When cooking, it burns away faster. When Campfire is off, no wood is consumed. (optional: different burning length of different materials)

  • Happy thoughts: 2 ways to do it. 1: passive morale boost to a colonist near Campfire. 2: pick a colonist, right-click on Campfire -> "Sit by the fire" => Colonist is in idle state near the Campfire getting a morale boost - no other activities allowed. This is probably too complicated - requires interrupts if colonist is hungry, tired, wounded, etc. But it's more balanced the 2nd way, imho. I.e. when you have a mental break soon, you order your colonist to chill by the fire.

  • Campfire only placeable outdoors: You don't want to have a burning pile inside your room, do you? (On the other hand Fireplace would be placeable only indoors (ignoring chimneys...).)

  • Stop a fire when raining: When it rains, it toggles Campfire off.

  • Add Fireplace: Adds a brick fireplace which is basically an indoors version of Campfire with better stats (higher cooking speed, bigger morale boost, more beauty, ...). Available after research.

  • Art:

    • Texture for Campfire. (Just for now...)
    • Change the color of the fire to the vanilla one.
    • Textures for Fireplace and Wood pile.
    • Textures for Campfire and Fireplace in both "on" and "off" state.

  • A8: Melts snow + provides warmth (Looking forward!)

  • Maybe sounds?

Thanks and Credits:
Cala13er for providing me a dll to add lighting without power.

Changelog:

0.01: Placeholder xml setup: constructable building, doesn't use power, colonists can cook on it. No real graphics and stats.
0.02: Refined stats, light emitting implemented (thanks Cala13er for providing me his dll!)
-- Campfire emits light permanently without using power. The light has more reddish vibe and its lighting radius is 9.
-- Costs 5 wood to build but requires 1300 work to build.
-- You can cook only simple meals. No power needed.
-- Currently impassable (maybe change that).
-- 480 work needed for cooking.
-- Skill requirement for simple meal (5), more food needed for one meal (12), more xp gain (80). (BUG: overrides vanilla recipes, to be fixed soon)
0.02a: Corrected the bug above. Added description of Campfire and made About.xml into something meaningful. Reduced health to 100.
0.03: Added simple graphics for Campfire. Changed About.xml accordingly.
0.03a: Stopped Campfire from rotating and looking silly. I added the same texture for front/back/side.


Cheers,
Kubouch

[attachment deleted by admin: too old]

Evul


Kubouch

Quote from: Evul on October 21, 2014, 09:23:05 PM
This is sort of a project am I right? :)

It is a project but it's in the Help subforum because I need help with it. It's really myself asking for help post than a real project post. It has a released-mod structure to keep things organized, mark my progress and let people look at my code. I'll make it more clear what I want. It's written late at night :-).

Rikiki

All of this seems possible BUT you need some a huge amount of dll coding to achieve this. ;)

Emits light: you must add some code which turns the glower comp on/off.
You may have to use a modified glower comp which does not check power however. It has already been done, look into the help or release forum.

Your mod sounds interresting for early game but it may take a lot of work to add all those floating menu. Go check into miscellaneous for those.
You may want to look at the minami's campfire/grill, I think he already coded a part of what you want.

Good luck! :)

P.S.: - you campfire should not be able to cook "advanced" meals, only simple food.
- You should move your mod into the unfinished section and only post small questions in the help section.

Kubouch

#4
Quote from: Rikiki on October 22, 2014, 03:45:58 AM
All of this seems possible BUT you need some a huge amount of dll coding to achieve this. ;)
I expected this :-D.

Quote
Emits light: you must add some code which turns the glower comp on/off.
You may have to use a modified glower comp which does not check power however. It has already been done, look into the help or release forum.
I think I found the solution for light-emitting here: https://ludeon.com/forums/index.php?topic=3960.msg38868#msg38868. Looks promising.

Quote
Your mod sounds interresting for early game but it may take a lot of work to add all those floating menu. Go check into miscellaneous for those.
You may want to look at the minami's campfire/grill, I think he already coded a part of what you want.
Yeah, I suspect that. It may be a viable option to add a toggle button to a building itself (similar to "Toggle Power") - that should be less painful.

Quote
P.S.: - you campfire should not be able to cook "advanced" meals, only simple food.
Good point.

Quote
- You should move your mod into the unfinished section and only post small questions in the help section.
Yeah, thats better. I made this topic late at night in a rush so there are some imperfections :-). Can I ask a moderator to move the topic? I haven't found the way how to do it myself.

Thanks for a helpful post, Rikiki!

Cala13er

Quickly mixed up a dll that should hopefully work. It's untested, if it doesn't work please let me know. By PM Preferably as I rarely ever go through the mods forum. Works all the time apart from when it's raining. Although I haven't made it turn of in all rainy weathers (It will only turn of in normal rain. Not foggy rain or storm. I will change this when I know the dll works :P

I've added the dll as an attachment.

Here's how to use it.
1. Put in your mods assemblies folder.
2. Go to your bonfires/campfire/fireplace def
3. Change compClass to "<compClass>CompGlowerX</compClass>"
4. Remove all of this, seeing as you're not using power.
      <li>
        <compClass>CompPowerTrader</compClass>
        <startElectricalFires>true</startElectricalFires>
        <soundPowerOn>PowerOnSmall</soundPowerOn>
        <soundPowerOff>PowerOffSmall</soundPowerOff>
        <basePowerConsumption>0</basePowerConsumption>
      </li>
5. And whala! It should work. Test by turning on god mod, then placing your fireplace/bonfire/campfire into game and turning on the rainy weather event. And let me know the results.

[attachment deleted by admin: too old]

Cala13er

Also if you want any extra help, just let us know.

Kubouch

Quote from: Cala13er on October 23, 2014, 05:49:37 AM
Quickly mixed up a dll that should hopefully work.

Thanks Cala13er! That's what I found on the forums. Also you made the dll which puts away fire during rain, right? Could you please share it as well? Also I'm really interested in the source code to look how you did it. Can I have a look at it? It would really help me to understand the language.

Cheers,
Kubouch


Kubouch

Quote from: Rikiki on October 23, 2014, 08:20:35 AM
Use ILSpy to look into it. ;)

Oh, I thought that once it's compiled, it's done. I'll look into that. Thanks!

Kubouch

So I made sort of basic playable version. It has now more sane stats and emits light indefinitely. Still no graphics.

Also I'm looking for someone with high Artistic skill to make some textures for it. I contacted the guys from the original Campfire mod but noone responded so far. I've never done any graphics ever and I'd like it to be nice and fit the Rimwold theme.

Now, the real work begins, I guess. Already had a look at C#, downloading Visual Studio, ready to kick in :-D.

As always, I'm welcome to any feedback you might have.

Cheers,
Kubouch

EDIT: Whoops, there is a bug in there! Apparently I overrode the vanilla recipes so even at the cook stove simple meals consume 12 food units. Needs to be fixed.

[attachment deleted by admin: too old]

Kubouch

All right, it should work fine now. The problem was that I was using the same defName in my recipes as vanilla does. I just marked them "Fireplaces_" to be different.

Also I wrote a description for a Campfire building and some stuff into About.xml. And reduced Campfire health to 100.

It might seem silly to keep track of such small edits but as I'm learning I'd like to preserve the dev process as much as possible. It also might serve other newbies as a reference. And I like things done perfectly :-)).

[attachment deleted by admin: too old]

Cala13er

Oh the weather thing doesn't work. I'll take another go at it in the morning. Could be the weather def names have been changed :P

vagineer1

Its good to see a great mod getting revived. I loved the old one. I hope it goes well.
You see this tank?

This tank is the epitome of "I'm going to destroy you"


This tank can make Chuck norris cry.

All hail the Takemikazuchi.

Kubouch

All right, I just butchered the vanilla graphics and assembled a simple Campfire. It looks quite nice but it needs more love. Download link under this post.

Also I had some fun playing with Visual Studio and got myself little bit more familiar with C#. Hopefully I'll squeeze some time in the near future and transform my knowledge in the mod.

[attachment deleted by admin: too old]