Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#TPT-Directive ElementHeader Element_VSPK static int update(UPDATE_FUNC_ARGS)
- int Element_VSPK::update(UPDATE_FUNC_ARGS)
- {
- int r, rx, ry, nearp, pavg, ct = parts[i].ctype, sender, receiver;
- Element_FIRE::update(UPDATE_FUNC_SUBCALL_ARGS);
- if (parts[i].life<=0)
- {
- if (ct!=PT_ZRNT)
- {
- parts[i].temp = 5000;
- }
- if (ct<=0 || ct>=PT_NUM || !sim->elements[parts[i].ctype].Enabled)
- sim->kill_part(i);
- sim->part_change_type(i,x,y,ct);
- parts[i].ctype = PT_NONE;
- parts[i].life = 4;
- return 0;
- }
- //Kills VSPK id it has a ctype of itself.
- switch(ct)
- {
- case PT_VSPK:
- sim->kill_part(i);
- return 1;
- }
- for (rx=-2; rx<3; rx++)
- for (ry=-2; ry<3; ry++)
- if (BOUNDS_CHECK && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- receiver = r&0xFF;
- sender = ct;
- pavg = sim->parts_avg(r>>8, i,PT_INSL);
- //receiver is the element VSPK is trying to conduct to
- //sender is the element the VSPK is on
- if (pavg == PT_INSL || pavg == PT_CBNF) continue; //Insulation and CBNF blocks everything past here
- if (!((sim->elements[receiver].Properties&PROP_CONDUCTS)||receiver==PT_INST||receiver==PT_QRTZ)) continue; //Stop non-conducting receivers, allow INST and QRTZ as special cases
- if (parts[r>>8].life==0) {
- parts[r>>8].life = parts[i].life - 1;
- parts[r>>8].ctype = receiver;
- sim->part_change_type(r>>8,x+rx,y+ry,PT_VSPK);
- //return 0;
- if (parts[r>>8].ctype!=PT_ZRNT && parts[r>>8].type!=PT_ZRNT)
- {
- parts[r>>8].temp = 4500;
- parts[i].life = parts[i].life - 300;
- parts[i].temp = 5000;
- if(parts[i].ctype==PT_ZRNT)
- {
- parts[i].temp = 273.15;
- }
- }
- if(parts[i].temp>=4500)
- sim->part_change_type(i,x,y,ct);
- //if(
- }
- }
- return 0;
- }
- //#TPT-Directive ElementHeader Element_VSPK static int graphics(GRAPHICS_FUNC_ARGS)
- int Element_VSPK::graphics(GRAPHICS_FUNC_ARGS)
- {
- *firea = 60;
- *firer = *colr/2;
- *fireg = *colg/2;
- *fireb = *colb/2;
- *pixel_mode |= FIRE_SPARK;
- return 1;
- }
- Element_VSPK::~Element_VSPK() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement