# grate slash controller # 2009-11-14 gbk symbols message damaged int required_damage=50 # restrict damage to saber and explosives only? int restrict_damage=1 # operate all grates as one? int link_grates=0 surface grate0 linkid=0 mask=0x448 surface grate1 linkid=1 mask=0x448 surface grate2 linkid=2 mask=0x448 surface grate3 linkid=3 mask=0x448 surface grate4 linkid=4 mask=0x448 surface grate5 linkid=5 mask=0x448 surface grate6 linkid=6 mask=0x448 surface grate7 linkid=7 mask=0x448 int damage_amount0=0 local int damage_amount1=0 local int damage_amount2=0 local int damage_amount3=0 local int damage_amount4=0 local int damage_amount5=0 local int damage_amount6=0 local int damage_amount7=0 local surface this_side local surface other_side local int type local int i local int z local end code damaged: // only respond to saber and explosive damage if that option is set if(restrict_damage > 0) { type = getParam(1); if(type != 4 && type != 16) stop; } // which surface linkid was hit i = getSenderID(); // get the reference to the surface that was hit this_side = getSenderRef(); // add this damage to this surface's damage counter damage_amount0[i] = damage_amount0[i] + getParam(0); // don't do anything until we have enough damage if(damage_amount0[i] < required_damage) stop; if(link_grates) { for(z=0;z<=7;z=z+1) { this_side = grate0[z]; call slash_grate; } } else { call slash_grate; } stop; slash_grate: // get the reference to the other side of the adjoin other_side = getSurfaceAdjoin(this_side); // set the texture cels and make the surfaces passable setWallCel(this_side, 1); setWallCel(other_side, 1); setAdjoinFlags(this_side, 0x2); setAdjoinFlags(other_side, 0x2); stop; end