Need help..Element: RechargeableBattery

  • wolfy1339
    9th Jun 2013 Member 0 Permalink
    EDIT: I finished my Rechargeable battery. Code:
    Please lock this thread 
  • NF
    9th Jun 2013 Member 0 Permalink

    Boxmein, will help you! he has account you know.

  • wolfy1339
    9th Jun 2013 Member 0 Permalink
  • cyberdragon
    9th Jun 2013 Member 0 Permalink

    WHOA! Lets play spot the errors. Missing semicolons in various places. Needs a { bracket after the first line. Needs a double colon in the first line.

  • wolfy1339
    9th Jun 2013 Member 0 Permalink

    i was following this website from @boxmein:http://boxmein.x10.mx/tptelements/#

    also i was not finished.

  • firefreak11
    9th Jun 2013 Member 0 Permalink

    #include "simulation/Elements.h"

    //#TPT-Directive ElementClass Element_CBTY PT_CBTY 

    Element_CBTY::Element_CBTY()

    {

           Identifier = "DEFAULT_PT_CBTY";

           Name = "CBTY";

           Colour = PIXPACK(0x959615);

           MenuVisible = 1;

           MenuSection = SC_ELEC;

           Enabled = 1;

          

           Advection = 0.0f;

           AirDrag = 0.00f * CFDS;

           AirLoss = 0.00f;

           Loss = 0.00f;

           Collision = 0.0f;

           Gravity = 0.0f;

           Diffusion = 0.00f;

           HotAir = 0.000f      * CFDS;

           Falldown = 0;

          

           Flammable = 0;

           Explosive = 0;

           Meltable = 0;

           Hardness = 20;

          

           Weight = 100;

          

           Temperature = R_TEMP-2.0f  +273.15f;

           HeatConduct = 20;

           Description = "Rechargable battery.";

          

           State = ST_SOLID;

           Properties = TYPE_SOLID;

          

           LowPressure = IPL;

           LowPressureTransition = NT;

           HighPressure = IPH;

           HighPressureTransition = NT;

           LowTemperature = ITL;

           LowTemperatureTransition = NT;

           HighTemperature = ITH;

           HighTemperatureTransition = NT;

          

           Update = &Element_CBTY::update;

          

    }

     

    int Element_CBTY::update(UPDATE_FUNC_ARGS)

     {

           int r, rx, ry;

           for (rx=-1; rx<2; rx++)

                  for (ry=-1; ry<2; ry++)

                         if (BOUNDS_CHECK && (rx || ry))

                         {

                               r = pmap[y+ry][x+rx];

                               if (!r)

                                      continue;

                                        //add your stuff here.

                         }

           return 0;

    }

     

    Element_CBTY::~Element_CBTY() {}

     

     

  • wolfy1339
    9th Jun 2013 Member 0 Permalink

    @firefreak11 (View Post)

     it is the area that in need to add my stuff, where i do not know what to put.

  • firefreak11
    9th Jun 2013 Member 0 Permalink

    @wolfy1339 (View Post)

     Ok. There is a section on the wiki about this, and if you need help with something in specific, like making it do something when touching another element, start a convo with me.

  • wolfy1339
    9th Jun 2013 Member 0 Permalink

    found em.

  • cyberdragon
    9th Jun 2013 Member 0 Permalink

    Don't use that aweful coding tutorial thing. That is way outdated. Use this:

     

    https://powdertoy.co.uk/Wiki/W/Functions.html

Locked by jacob1: lock requested