fangflecked-old

old project. ive since repurposed the name
git clone git://moonbender.net/fangflecked-old
Log | Files | Refs | README

items.qc (2033B)


      1 //
      2 //	Items.qc - all the definitions for item spawn functions as well as other functions related to them
      3 //
      4 void() fade_in =
      5 {
      6 	self.alpha += 0.1;
      7 	if(self.alpha >= 1)
      8 	{
      9 		self.alpha = 1;
     10 		return;
     11 	}
     12 	self.nextthink = time + 0.05;
     13 	self.think = fade_in;
     14 	
     15 }
     16 
     17 //TODO:come up with particle
     18 //effect for this
     19 void() item_respawn =
     20 {
     21 	sound(self, 0, "sounds/items/respawn.wav", 0.6, 1.5); //0.4 for a bit lower volume
     22 	self.alpha += 0.1;
     23 	self.nextthink = time + 0.05;
     24 	self.think = fade_in;
     25 //	pointparticles(self.parts, self.origin, '0 0 1', 20);
     26 }
     27 
     28 void() ammo_touch =
     29 {
     30 	if(other.classname == "player" && self)
     31 	{
     32 		if(self.classname == "item_ammo_mg")
     33 		{
     34 			other.ammo_mg += 50;
     35 			if(other.ammo_mg > MAXAMMO_MG)
     36 				other.ammo_mg = MAXAMMO_MG;
     37 		}
     38 //		sound(other, 0, "sounds/items/health.wav", 1, 1);
     39 		self.nextthink = time + 5;
     40 		self.think = item_respawn;
     41 		self.alpha = 0.05;
     42 //		pointparticles(particleeffectnum("items.pickup"), self.origin, '0 0 1', 20);
     43 	}
     44 }
     45 
     46 void() weapon_touch =
     47 {
     48 	if(other.classname == "player" && self)
     49 	{
     50 		if(self.classname == "item_mg" && !(other.items & IT_MG))
     51 		{
     52 			other.ammo_mg += 50;
     53 			other.items = other.items + IT_MG;
     54 
     55 			if(other.ammo_mg > MAXAMMO_MG)
     56 				other.ammo_mg = MAXAMMO_MG;
     57 			
     58 			sound(other, 0, "sounds/items/health.wav", 1, 1);
     59 			self.nextthink = time + 10;
     60 			self.think = item_respawn;
     61 			self.alpha = 0.05;
     62 //			pointparticles(particleeffectnum("items.pickup"), self.origin, '0 0 1', 20);			
     63 		}		
     64 	}
     65 }
     66 
     67 void() item_ammo_mg =
     68 {
     69 	self.solid = SOLID_TRIGGER;
     70 //	setmodel(self, "models/mg_ammo.iqm");
     71 	setsize(self, '-16 -16 -16', '16 16 32');
     72 	self.classname = "item_ammo_mg";
     73 	self.modelflags = MF_ROTATE;
     74 	self.touch = ammo_touch;
     75 //	self.parts = particleeffectnum("items.respawn");
     76 }
     77 
     78 void() item_mg = 
     79 {
     80 	self.solid = SOLID_TRIGGER;
     81 //	setmodel(self, "models/weapons/mg/mg.iqm");
     82 	setsize(self, '-16 -16 -16', '16 16 32');
     83 	self.classname = "item_mg";
     84 	self.modelflags = MF_ROTATE;
     85 	self.touch = weapon_touch;
     86 //	self.parts = particleeffectnum("items.respawn");
     87 }