#ifndef GTORCH #define GTORCH #include "script/tdm_light_holders.script" object grabable_torch : tdm_light_holder { float holdTorch; float marked; float stim_number; float mark(); void reactivate(); void receiveTorch(entity e); }; //method called by ai to tell the torch they are going to grab it void grabable_torch::init() { stim_number=$worldspawn.getFloatKey("torch_stim"); if (!stim_number) stim_number=1000; StimAdd(stim_number,512); StimEnable(stim_number,1); holdTorch=1; marked=0; } float grabable_torch::mark() { if (marked || !holdTorch) return 0; marked=1; StimEnable(stim_number,0); return 1; } void grabable_torch::reactivate() { marked=0; StimEnable(stim_number,1); } void grabable_torch::receiveTorch(entity e) { entity f; entity g; vector offset; f=sys.spawn("atdm:prop_torch_gothic_on"); g=sys.spawn("func_static"); g.setModel("models/darkmod/hangers/bracket.lwo"); offset=getAngles(); offset_z=offset_y; offset_x=sys.sin(offset_z)*6; offset_y=-sys.cos(offset_z)*6; offset_z=0; g.setOrigin(getOrigin()+offset); g.setAngles(getAngles()); e.attachToPos(f,"hand_l","torch"); holdTorch=0; sys.wait(0.1); remove(); } #endif