From 3bb97c2a37d46137fcda516ad2ce2378b346a58c Mon Sep 17 00:00:00 2001 From: avirox Date: Tue, 24 Jan 2006 20:05:48 +0000 Subject: [PATCH] - Fixed item_backpack - Fixed metal amount displayed in engineer's "special" - Added death function to extractor - Tweaked .alpha value of buildings - Added impulse to tell player his current position (vector) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@891 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- TeamNexuiz/game/gamec/GameC.dsp | 4 ++ TeamNexuiz/game/gamec/cl_impulse.c | 5 +++ TeamNexuiz/game/gamec/class.c | 3 ++ TeamNexuiz/game/gamec/engineer.c | 30 ++++++++++++-- TeamNexuiz/game/gamec/tf_constants.c | 14 ++++--- TeamNexuiz/game/gamec/tfdefs.c | 1 + TeamNexuiz/game/gamec/tfextractor.c | 18 +++++++++ TeamNexuiz/game/gamec/tfitems.c | 18 +++++++-- TeamNexuiz/game/gamec/tfmenus.c | 60 ++++++++++++++++++++++++++-- TeamNexuiz/game/gamec/tfq3fitems.c | 3 +- 10 files changed, 140 insertions(+), 16 deletions(-) diff --git a/TeamNexuiz/game/gamec/GameC.dsp b/TeamNexuiz/game/gamec/GameC.dsp index 63f4aca8f..6b05253fb 100644 --- a/TeamNexuiz/game/gamec/GameC.dsp +++ b/TeamNexuiz/game/gamec/GameC.dsp @@ -352,6 +352,10 @@ SOURCE=.\tf_w_railgun.c # End Source File # Begin Source File +SOURCE=.\tfextractor.c +# End Source File +# Begin Source File + SOURCE=.\tfsentry.c # End Source File # Begin Source File diff --git a/TeamNexuiz/game/gamec/cl_impulse.c b/TeamNexuiz/game/gamec/cl_impulse.c index 955fd2306..9ef3c1274 100644 --- a/TeamNexuiz/game/gamec/cl_impulse.c +++ b/TeamNexuiz/game/gamec/cl_impulse.c @@ -219,6 +219,11 @@ void ImpulseCommands (void) { ClassGrenade(WR_GRENADE2); } + if (self.impulse == TELL_POSITION_IMPULSE) + { + sprint(self,vtos(self.origin)); + sprint(self, "\n"); + } // model/class test if(self.impulse == 57) diff --git a/TeamNexuiz/game/gamec/class.c b/TeamNexuiz/game/gamec/class.c index 970350f6b..3aca6c736 100644 --- a/TeamNexuiz/game/gamec/class.c +++ b/TeamNexuiz/game/gamec/class.c @@ -492,6 +492,7 @@ void (float classnum) SetMaxAmmoFor = self.maxammo_nails = 200; self.maxammo_cells = 40; self.maxammo_rockets = 40; + self.maxammo_metal = 0; self.no_grenades_1 = 4; self.clip_rockets = CLIP_MAX_ROCKETS; self.clip_pistol = CLIP_MAX_PISTOL; @@ -526,5 +527,7 @@ void (float classnum) SetMaxAmmoFor = else if (classnum == CLASS_ENGINEER) { self.maxammo_cells = 200; self.ammo_cells = 100; + self.ammo_metal = 0; + self.maxammo_metal = 200; } }; diff --git a/TeamNexuiz/game/gamec/engineer.c b/TeamNexuiz/game/gamec/engineer.c index d1516d3ea..97a9d7ad2 100644 --- a/TeamNexuiz/game/gamec/engineer.c +++ b/TeamNexuiz/game/gamec/engineer.c @@ -11,6 +11,7 @@ void () Tesla_Idle; void () Tesla_Touch; // metal extractor void () Extractor_Idle; +void () Extractor_Die; void (entity enty) Engineer_UseExtractor; void() SUB_NULL = {}; @@ -27,7 +28,16 @@ void () Sentry_Die; void EngineerSpecial() { - self.current_menu = MENU_ENGINEER_BUILD; + if (self.current_menu == MENU_ENGINEER_BUILD) + { + ResetMenu (); + } + else + { + ResetMenu (); + self.current_menu = MENU_ENGINEER_BUILD; + } + // sprint(self, "Not done yet\n"); // this is gonna contain build menu eventually }; @@ -248,6 +258,20 @@ void(float objtobuild) TeamFortress_Build = dremove(newmis); return; } + //check if it's near another allied extractor unit + local entity isnearextractor; + isnearextractor = findradius (newmis.origin, BUILDING_EXTRACTOR_CHECKRADIUS); + while (isnearextractor) + { + if (isnearextractor.classname == "building_extractor" && isnearextractor.team_no == self.team_no) + { + sprint (self, "You cannot build so close to another extractor.\n"); + dremove(newmis); + return; + } + isnearextractor = isnearextractor.chain; + } + tmp1 = '-16 -16 0'; tmp2 = '16 16 48'; newmis.mdl = "models/engineer/metal_extractor/power.md3"; @@ -284,7 +308,7 @@ void(float objtobuild) TeamFortress_Build = newmis.velocity = '0 0 8'; newmis.movetype = 6; newmis.solid = 2; - newmis.alpha = .5; // slightly invisible + newmis.alpha = .1; // slightly invisible self.effects = self.effects | EF_ADDITIVE; setmodel(newmis, newmis.mdl); setsize(newmis, tmp1, tmp2); @@ -582,7 +606,7 @@ void() TeamFortress_FinishedBuilding = oldself.netname = "extractor"; oldself.takedamage = 2; oldself.solid = 2; -// oldself.th_die = Extractor_Die; + oldself.th_die = Extractor_Die; // oldself.th_pain = Extractor_Pain; self.ammo_cells = (self.ammo_cells - BUILDING_EXTRACTOR_NEEDCELLS); oldself.health = 200; diff --git a/TeamNexuiz/game/gamec/tf_constants.c b/TeamNexuiz/game/gamec/tf_constants.c index d0428b78a..397cbda3a 100644 --- a/TeamNexuiz/game/gamec/tf_constants.c +++ b/TeamNexuiz/game/gamec/tf_constants.c @@ -3,8 +3,9 @@ /***************** Impulse Defs **********************/ /////////////////////////////////////////////////////// /*****************************************************/ -float DROP_FLAG_IMPULSE = 203; float RELOAD_IMPULSE = 70; +float TELL_POSITION_IMPULSE = 205; +float DROP_FLAG_IMPULSE = 203; float FEIGN_IMPULSE = 204; @@ -28,9 +29,10 @@ float MENU_ENGINEER_BUILD = 15; float MENU_EXTRACTOR = 26; float MENU_NEED_TN = 90; -/****************** Build Costs ********************/ -///////////////////////////////////////////////////// -/***************************************************/ +/****************** Buildings ********************/ +/////////////////////////////////////////////////// +/*************************************************/ +//costs float BUILDING_EXTRACTOR_NEEDCELLS = 200; float BUILDING_DISPENSER_NEEDCELLS = 100; float BUILDING_SENTRY_NEEDCELLS = 50; @@ -39,8 +41,10 @@ float BUILDING_TESLA_NEEDCELLS = 100; float BUILDING_TESLA_NEEDMETAL = 175; float BUILDING_TELEPAD_NEEDCELLS = 100; float BUILDING_TELEPAD_NEEDMETAL = 75; - +//stats float BUILDING_EXTRACTOR_MAXMETAL = 150; +//misc +float BUILDING_EXTRACTOR_CHECKRADIUS = 1200; /***************** misc constants **********************/ ///////////////////////////////////////////////////////// diff --git a/TeamNexuiz/game/gamec/tfdefs.c b/TeamNexuiz/game/gamec/tfdefs.c index 41aecfcc5..833b3e1e9 100644 --- a/TeamNexuiz/game/gamec/tfdefs.c +++ b/TeamNexuiz/game/gamec/tfdefs.c @@ -133,6 +133,7 @@ float CLIP_MAX_PIPEGRENADES = 6; .float maxammo_nails; .float maxammo_cells; .float maxammo_rockets; +.float maxammo_metal; // maximum amoutn of metal that can be carried .float last_impulse; .float real_frags; .float items_allowed; diff --git a/TeamNexuiz/game/gamec/tfextractor.c b/TeamNexuiz/game/gamec/tfextractor.c index aed1a9be1..2eaf32a6f 100644 --- a/TeamNexuiz/game/gamec/tfextractor.c +++ b/TeamNexuiz/game/gamec/tfextractor.c @@ -26,6 +26,24 @@ void () Extractor_Idle = self.nextthink = time + 4; }; +void () Extractor_Die = +{ + if (self.real_owner.has_extractor < 2) + sprint (self.real_owner, "Your extractor was destoyed.\n"); + else + sprint (self.real_owner, "One of your extractors was destoyed.\n"); + self.real_owner.has_extractor = self.real_owner.has_extractor - 1; +/* ThrowGib ("progs/tgib1.mdl", -70); // use other explosion method? + ThrowGib ("progs/tgib2.mdl", -70); + ThrowGib ("progs/tgib3.mdl", -70);*/ + WriteByte (2, 23); + WriteByte (2, 3); + WriteCoord (2, self.origin_x); + WriteCoord (2, self.origin_y); + WriteCoord (2, self.origin_z); + BecomeExplosion (); +}; + void (entity gun) Engineer_UseExtractor = { local entity dist_checker; diff --git a/TeamNexuiz/game/gamec/tfitems.c b/TeamNexuiz/game/gamec/tfitems.c index 8c10083f0..2170842c5 100644 --- a/TeamNexuiz/game/gamec/tfitems.c +++ b/TeamNexuiz/game/gamec/tfitems.c @@ -104,6 +104,7 @@ void () item_backpack = self.armorvalue = stof(self.armor); if ((!self.delay) && (!self.wait)) self.wait = 10; // next time item can be used + self.give = "converted"; ConvertToBackPack(); // finish conversion using q3f conversion func }; @@ -113,18 +114,27 @@ void () item_ctf_flag = { if (!self.allowteams) { - bprint("Fixme!! Object located at ",vtos(self.origin)," has now allowteams property set!\n"); + bprint("Fixme!! Object located at ",vtos(self.origin)," has no allowteams property set!\n"); return; } - if (!self.delay) + if ((!self.delay) && (!self.wait)) + { + self.wait = 45; // next time item can be used self.delay = 45; + } + if (!self.carried_message) + self.carried_message = "You have the flag! Go capture it in your base!\n"; if (self.allowteams == "red") + { + self.mdl = "models/flags/b_flag.md3"; self.groupname = "redflag"; + } else if (self.allowteams == "blue") + { self.groupname = "blueflag"; + self.mdl = "models/flags/r_flag.md3"; + } - if (!self.carried_message) - self.carried_message = "You have the flag! Go capture it in your base!\n"; func_goalitem (); }; diff --git a/TeamNexuiz/game/gamec/tfmenus.c b/TeamNexuiz/game/gamec/tfmenus.c index f475f66d8..70e95353f 100644 --- a/TeamNexuiz/game/gamec/tfmenus.c +++ b/TeamNexuiz/game/gamec/tfmenus.c @@ -12,6 +12,7 @@ void (float inp) Menu_EngineerFix_Tesla_Input; void () Menu_Need_TeamNexuiz; void () Menu_Engineer; void () Menu_EngineerFix_Extractor; +void (float inp) Menu_EngineerFix_Extractor_Input; // Resets the menu void() ResetMenu = @@ -87,10 +88,14 @@ void(float menu_no) DisplayMenu = // Menu input (user can press 0 - 9) void(float inp) Menu_Input = { - if ((self.current_menu == 18)) + if (self.current_menu == 18) { Menu_EngineerFix_Tesla_Input (inp); } + if (self.current_menu == MENU_EXTRACTOR) + { + Menu_EngineerFix_Extractor_Input (inp); + } }; // Tesla Menu @@ -434,9 +439,54 @@ void () Menu_EngineerFix_Extractor = hp = ftos(self.building.health); obj_metal = ftos(self.building.ammo_metal); - CenterPrint (self, "^7[^6Metal Extractor^7]\n^1Level: ^3",level,"\n^1Health: ^3",hp,"\n^1Metal: ^3",obj_metal,"\n"); + CenterPrint (self, "^7[^6Metal Extractor^7]\n^1Level: ^3",level,"\n^1Health: ^3",hp,"\n^1Metal: ^3",obj_metal,"\n\n[^11^7] Extract Metal\n[^12^7] Repair Extractor\n[^13^7] Nothing\n"); }; +void (float inp) Menu_EngineerFix_Extractor_Input = +{ + if (inp == 1) + { + if (self.building.ammo_metal > 0) + { + local float tmp_flt; + tmp_flt = self.maxammo_metal - self.ammo_metal; + if (tmp_flt == 0) + sprint(self, "You have reached your carrying capacity for metal\n"); + else + { + if (tmp_flt > self.building.ammo_metal) + { + self.ammo_metal = self.ammo_metal + self.building.ammo_metal; + self.building.ammo_metal = 0; + } + else + { + if ((self.ammo_metal + self.building.ammo_metal) > self.maxammo_metal) + { + self.building.ammo_metal = self.building.ammo_metal - (self.maxammo_metal - self.ammo_metal); + self.ammo_metal = self.maxammo_metal; + } + else + { + self.ammo_metal = self.ammo_metal + self.building.ammo_metal; + self.building.ammo_metal = 0; + } + } + } + } + else + { + sprint(self, "There is no metal to extract from this unit\n"); + } + } + + if ((inp >= 1) && (inp <= 9)) + { + ResetMenu (); + self.impulse = 0; + W_SetCurrentAmmo(); + } +}; // Engineer build menu void () Menu_Engineer = { @@ -508,5 +558,9 @@ void () Menu_Engineer = if (self.ammo_cells >= BUILDING_EXTRACTOR_NEEDCELLS) line5 = " Build Extractor \n"; - centerprint_multi_9 (self, "^7Engineer Build Menu\n ^3Metal: [",ftos(self.ammo_metal),"]\n^3Cells: [",ftos(self.ammo_cells),"]\n\n", line1, line2, line3, line4, line5, "... Nothing \n\n"); + local string strn; + local string metalcnt; + metalcnt = ftos(self.ammo_metal); + strn = strcat("^7Engineer Build Menu\n ^3Metal: [",metalcnt,"]\n^3Cells: [",ftos(self.ammo_cells),"]\n\n", line1, strcat(line2, line3, line4), strcat(line5, "... Nothing \n\n")); + CenterPrint(self, strn); }; diff --git a/TeamNexuiz/game/gamec/tfq3fitems.c b/TeamNexuiz/game/gamec/tfq3fitems.c index e5fdd2379..444c56959 100644 --- a/TeamNexuiz/game/gamec/tfq3fitems.c +++ b/TeamNexuiz/game/gamec/tfq3fitems.c @@ -103,7 +103,8 @@ void (float tno) ConvertToFlag = // self.impulse = 9; self.items = 133701; - self.mdl = self.model; + if (self.model) + self.mdl = self.model; // self.mdl = "models/flag.md3"; -- 2.39.2