#include <math.h>
#include <string.h>
#include "mech.h"
#include "muxevent.h"
#include "mech.events.h"
#include "mech.tech.h"
#include "failures.h"
#include "p.mech.utils.h"
#include "p.mech.tech.h"
#include "p.mech.consistency.h"
#include "p.mech.tech.do.h"
#include "p.bsuit.h"
Include dependency graph for mech.tech.commands.c:
Go to the source code of this file.
Defines | |
#define | my_parsepart(loc, part) |
#define | my_parsepart2(loc, part, brand) |
#define | my_parsegun(loc, part, brand) |
#define | ClanMod(num) MAX(1, (((num) / ((MechSpecials(mech) & CLAN_TECH) ? 2 : 1)))) |
#define | CHECK(t, fun) |
#define | CHECKL(t, fun) |
#define | CHECK2(t, t2, fun) |
#define | DAT(t) if (SomeoneRepairing_s(mech, loc, part, t)) return 1 |
#define | tech_gun_is_ok(a, b, c) !PartIsNonfunctional(a,b,c) |
#define | CHECK_S(nloc) |
#define | CHECK(tloc, nloc) case tloc: CHECK_S(nloc) |
#define | CHECK(tloc, nloc) case tloc:if (SectIsDestroyed(mech,nloc))return 1;break; |
Functions | |
static void | tech_check_locpart (MUXEVENT *e) |
static void | tech_check_loc (MUXEVENT *e) |
int | SomeoneRepairing_s (MECH *mech, int loc, int part, int t) |
int | SomeoneRepairing (MECH *mech, int loc, int part) |
int | SomeoneFixingA (MECH *mech, int loc) |
int | SomeoneFixingI (MECH *mech, int loc) |
int | SomeoneFixing (MECH *mech, int loc) |
int | SomeoneAttaching (MECH *mech, int loc) |
int | SomeoneReplacingSuit (MECH *mech, int loc) |
int | SomeoneResealing (MECH *mech, int loc) |
int | SomeoneScrappingLoc (MECH *mech, int loc) |
int | SomeoneScrappingPart (MECH *mech, int loc, int part) |
int | CanScrapLoc (MECH *mech, int loc) |
int | CanScrapPart (MECH *mech, int loc, int part) |
char * | silly_get_uptime_to_string (int) |
int | ValidGunPos (MECH *mech, int loc, int pos) |
void | tech_checkstatus (dbref player, void *data, char *buffer) |
TECHCOMMANDH (tech_removegun) | |
TECHCOMMANDH (tech_removepart) | |
int | Invalid_Scrap_Path (MECH *mech, int loc) |
TECHCOMMANDH (tech_removesection) | |
TECHCOMMANDH (tech_replacegun) | |
TECHCOMMANDH (tech_repairgun) | |
TECHCOMMANDH (tech_fixenhcrit) | |
TECHCOMMANDH (tech_replacepart) | |
TECHCOMMANDH (tech_repairpart) | |
TECHCOMMANDH (tech_toggletype) | |
TECHCOMMANDH (tech_reload) | |
TECHCOMMANDH (tech_unload) | |
TECHCOMMANDH (tech_fixarmor) | |
TECHCOMMANDH (tech_fixinternal) | |
int | Invalid_Repair_Path (MECH *mech, int loc) |
int | unit_is_fixable (MECH *mech) |
TECHCOMMANDH (tech_reattach) | |
TECHCOMMANDH (tech_replacesuit) | |
TECHCOMMANDH (tech_reseal) | |
TECHCOMMANDH (tech_magic) | |
Variables | |
static int | tmp_flag = 0 |
static int | tmp_loc |
static int | tmp_part |
#define CHECK | ( | tloc, | |||
nloc | ) | case tloc:if (SectIsDestroyed(mech,nloc))return 1;break; |
Definition at line 679 of file mech.tech.commands.c.
#define CHECK | ( | tloc, | |||
nloc | ) | case tloc: CHECK_S(nloc) |
Definition at line 679 of file mech.tech.commands.c.
#define CHECK | ( | t, | |||
fun | ) |
Value:
tmp_flag=0;tmp_loc=loc;tmp_part = part; \ muxevent_gothru_type_data(t, (void *) mech, fun); \ return tmp_flag
Definition at line 679 of file mech.tech.commands.c.
Referenced by Invalid_Repair_Path(), Invalid_Scrap_Path(), make_damage_table(), and SomeoneRepairing_s().
#define CHECK2 | ( | t, | |||
t2, | |||||
fun | ) |
Value:
tmp_flag=0;tmp_loc=loc;tmp_part = part; \ muxevent_gothru_type_data(t, (void *) mech, fun); \ muxevent_gothru_type_data(t2, (void *) mech, fun); \ return tmp_flag
Definition at line 76 of file mech.tech.commands.c.
#define CHECK_S | ( | nloc | ) |
Value:
if (!SectIsDestroyed(mech,nloc)) return 1; \ if (Invalid_Scrap_Path(mech,nloc)) return 1
Definition at line 290 of file mech.tech.commands.c.
Referenced by Invalid_Scrap_Path().
#define CHECKL | ( | t, | |||
fun | ) |
Value:
Definition at line 71 of file mech.tech.commands.c.
Referenced by SomeoneAttaching(), SomeoneFixingA(), SomeoneFixingI(), SomeoneReplacingSuit(), SomeoneResealing(), and SomeoneScrappingLoc().
#define ClanMod | ( | num | ) | MAX(1, (((num) / ((MechSpecials(mech) & CLAN_TECH) ? 2 : 1)))) |
#define DAT | ( | t | ) | if (SomeoneRepairing_s(mech, loc, part, t)) return 1 |
Definition at line 88 of file mech.tech.commands.c.
Referenced by SomeoneRepairing(), and SomeoneScrappingPart().
#define my_parsegun | ( | loc, | |||
part, | |||||
brand | ) |
Value:
switch (tech_parsegun(mech, buffer, loc, part, brand)) \ { case -1: notify(player, "Invalid gun #!");return; \ case -2: notify(player, "Invalid object to replace with!");return; \ case -3: notify(player, "Invalid object type - not matching with original.");return; \ case -4: notify(player, "Invalid gun location - subscript out of range.");return; }
Definition at line 33 of file mech.tech.commands.c.
Referenced by TECHCOMMANDH().
#define my_parsepart | ( | loc, | |||
part | ) |
Value:
switch (tech_parsepart(mech, buffer, loc, part,NULL)) \ { case -1: notify(player, "Invalid section!");return; \ case -2: notify(player, "Invalid part!");return; }
Definition at line 23 of file mech.tech.commands.c.
Referenced by TECHCOMMANDH().
#define my_parsepart2 | ( | loc, | |||
part, | |||||
brand | ) |
Value:
switch (tech_parsepart(mech, buffer, loc, part,brand)) \ { case -1: notify(player, "Invalid section!");return; \ case -2: notify(player, "Invalid part!");return; }
Definition at line 28 of file mech.tech.commands.c.
Referenced by TECHCOMMANDH().
Definition at line 174 of file mech.tech.commands.c.
int CanScrapLoc | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 158 of file mech.tech.commands.c.
References EVENT_REPAIR_RELO, EVENT_REPAIR_REPL, muxevent_gothru_type_data(), SomeoneFixing(), tech_check_loc(), tmp_flag, and tmp_loc.
Referenced by TECHCOMMANDH().
00159 { 00160 tmp_flag = 0; 00161 tmp_loc = loc % 8; 00162 muxevent_gothru_type_data(EVENT_REPAIR_REPL, (void *) mech, 00163 tech_check_loc); 00164 muxevent_gothru_type_data(EVENT_REPAIR_RELO, (void *) mech, 00165 tech_check_loc); 00166 return !tmp_flag && !SomeoneFixing(mech, loc); 00167 }
int CanScrapPart | ( | MECH * | mech, | |
int | loc, | |||
int | part | |||
) |
Definition at line 169 of file mech.tech.commands.c.
References SomeoneRepairing().
Referenced by TECHCOMMANDH().
00170 { 00171 return !(SomeoneRepairing(mech, loc, part)); 00172 }
int Invalid_Repair_Path | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 682 of file mech.tech.commands.c.
References CHECK, CLASS_MECH, CTORSO, HEAD, LARM, LLEG, LTORSO, MechType, RARM, RLEG, and RTORSO.
Referenced by TECHCOMMANDH().
00683 { 00684 if(MechType(mech) != CLASS_MECH) 00685 return 0; 00686 switch (loc) { 00687 CHECK(HEAD, CTORSO); 00688 CHECK(LTORSO, CTORSO); 00689 CHECK(RTORSO, CTORSO); 00690 CHECK(LARM, LTORSO); 00691 CHECK(RARM, RTORSO); 00692 CHECK(LLEG, CTORSO); 00693 CHECK(RLEG, CTORSO); 00694 } 00695 return 0; 00696 }
int Invalid_Scrap_Path | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 297 of file mech.tech.commands.c.
References CHECK, CHECK_S, CLASS_MECH, CTORSO, HEAD, LARM, LTORSO, MechType, RARM, and RTORSO.
Referenced by check_for_scrappage(), and TECHCOMMANDH().
00298 { 00299 if(loc < 0) 00300 return 0; 00301 if(MechType(mech) != CLASS_MECH) 00302 return 0; 00303 switch (loc) { 00304 CHECK(CTORSO, HEAD); 00305 CHECK_S(LTORSO); 00306 CHECK_S(RTORSO); 00307 break; 00308 CHECK(LTORSO, LARM); 00309 break; 00310 CHECK(RTORSO, RARM); 00311 break; 00312 } 00313 return 0; 00314 }
char* silly_get_uptime_to_string | ( | int | ) |
Definition at line 54 of file btechstats.c.
00055 { 00056 static char buf[MBUF_SIZE]; 00057 char *c; 00058 00059 c = get_uptime_to_string(i); 00060 strcpy(buf, c); 00061 free_sbuf(c); 00062 return buf; 00063 }
int SomeoneAttaching | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 120 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_REAT, and tech_check_loc().
Referenced by is_under_repair(), and TECHCOMMANDH().
00121 { 00122 CHECKL(EVENT_REPAIR_REAT, tech_check_loc); 00123 }
int SomeoneFixing | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 114 of file mech.tech.commands.c.
References SomeoneFixingA(), and SomeoneFixingI().
Referenced by CanScrapLoc(), is_under_repair(), and TECHCOMMANDH().
00115 { 00116 return SomeoneFixingA(mech, loc) || SomeoneFixingI(mech, loc); 00117 }
int SomeoneFixingA | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 104 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_FIX, and tech_check_loc().
Referenced by SomeoneFixing(), and TECHCOMMANDH().
00105 { 00106 CHECKL(EVENT_REPAIR_FIX, tech_check_loc); 00107 }
int SomeoneFixingI | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 109 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_FIXI, and tech_check_loc().
Referenced by SomeoneFixing(), and TECHCOMMANDH().
00110 { 00111 CHECKL(EVENT_REPAIR_FIXI, tech_check_loc); 00112 }
int SomeoneRepairing | ( | MECH * | mech, | |
int | loc, | |||
int | part | |||
) |
Definition at line 91 of file mech.tech.commands.c.
References DAT, EVENT_REPAIR_MOB, EVENT_REPAIR_RELO, EVENT_REPAIR_REPAG, EVENT_REPAIR_REPAP, EVENT_REPAIR_REPENHCRIT, EVENT_REPAIR_REPL, and EVENT_REPAIR_REPLG.
Referenced by CanScrapPart(), check_for_scrappage(), is_under_repair(), and TECHCOMMANDH().
00092 { 00093 DAT(EVENT_REPAIR_RELO); 00094 DAT(EVENT_REPAIR_REPL); 00095 DAT(EVENT_REPAIR_REPLG); 00096 DAT(EVENT_REPAIR_REPAP); 00097 DAT(EVENT_REPAIR_REPAG); 00098 DAT(EVENT_REPAIR_MOB); 00099 DAT(EVENT_REPAIR_REPENHCRIT); 00100 return 0; 00101 }
int SomeoneRepairing_s | ( | MECH * | mech, | |
int | loc, | |||
int | part, | |||
int | t | |||
) |
Definition at line 83 of file mech.tech.commands.c.
References CHECK, and tech_check_locpart().
00084 { 00085 CHECK(t, tech_check_locpart); 00086 }
int SomeoneReplacingSuit | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 125 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_REPSUIT, and tech_check_loc().
Referenced by is_under_repair(), and TECHCOMMANDH().
00126 { 00127 CHECKL(EVENT_REPAIR_REPSUIT, tech_check_loc); 00128 }
int SomeoneResealing | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 136 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_RESE, and tech_check_loc().
Referenced by is_under_repair(), and TECHCOMMANDH().
00137 { 00138 CHECKL(EVENT_REPAIR_RESE, tech_check_loc); 00139 }
int SomeoneScrappingLoc | ( | MECH * | mech, | |
int | loc | |||
) |
Definition at line 141 of file mech.tech.commands.c.
References CHECKL, EVENT_REPAIR_SCRL, and tech_check_loc().
Referenced by check_for_scrappage(), is_under_repair(), and TECHCOMMANDH().
00142 { 00143 CHECKL(EVENT_REPAIR_SCRL, tech_check_loc); 00144 }
int SomeoneScrappingPart | ( | MECH * | mech, | |
int | loc, | |||
int | part | |||
) |
Definition at line 146 of file mech.tech.commands.c.
References DAT, EVENT_REPAIR_SCRG, EVENT_REPAIR_SCRP, and EVENT_REPAIR_UMOB.
Referenced by check_for_scrappage(), is_under_repair(), and TECHCOMMANDH().
00147 { 00148 DAT(EVENT_REPAIR_SCRP); 00149 DAT(EVENT_REPAIR_SCRG); 00150 DAT(EVENT_REPAIR_UMOB); 00151 return 0; 00152 }
static void tech_check_loc | ( | MUXEVENT * | e | ) | [static] |
Definition at line 57 of file mech.tech.commands.c.
References my_event_type::data2, loc, tmp_flag, and tmp_loc.
Referenced by CanScrapLoc(), SomeoneAttaching(), SomeoneFixingA(), SomeoneFixingI(), SomeoneReplacingSuit(), SomeoneResealing(), and SomeoneScrappingLoc().
00058 { 00059 int loc; 00060 00061 loc = (((int) e->data2) % 16); 00062 if(loc == tmp_loc) 00063 tmp_flag++; 00064 }
static void tech_check_locpart | ( | MUXEVENT * | e | ) | [static] |
Definition at line 47 of file mech.tech.commands.c.
References my_event_type::data2, loc, tmp_flag, tmp_loc, tmp_part, and UNPACK_LOCPOS.
Referenced by SomeoneRepairing_s().
00048 { 00049 int loc, pos; 00050 int l = (int) e->data2; 00051 00052 UNPACK_LOCPOS(l, loc, pos); 00053 if(loc == tmp_loc && pos == tmp_part) 00054 tmp_flag++; 00055 }
void tech_checkstatus | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 195 of file mech.tech.commands.c.
References DOCHECK, figure_latest_tech_event(), game_lag_time(), notify_printf(), and silly_get_uptime_to_string().
00196 { 00197 MECH *mech = (MECH *) data; 00198 int i = figure_latest_tech_event(mech); 00199 char *ms; 00200 00201 DOCHECK(!i, "The mech's ready to rock!"); 00202 ms = silly_get_uptime_to_string(game_lag_time(i)); 00203 notify_printf(player, "The 'mech has approximately %s until done.", ms); 00204 }
TECHCOMMANDH | ( | tech_magic | ) |
Definition at line 799 of file mech.tech.commands.c.
References do_magic(), mech_int_check(), notify, TECHCOMMANDB, and TECHCOMMANDC.
00800 { 00801 TECHCOMMANDB; 00802 00803 TECHCOMMANDC; 00804 notify(player, "Doing the magic.."); 00805 do_magic(mech); 00806 mech_int_check(mech, 1); 00807 notify(player, "Done!"); 00808 }
TECHCOMMANDH | ( | tech_reseal | ) |
Definition at line 782 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOC, EVENT_REPAIR_RESE, Invalid_Repair_Path(), loc, muxevent_tickmech_reseal(), my_parsepart, RESEAL_DIFFICULTY, reseal_econ(), reseal_fail(), reseal_succ(), RESEAL_TIME, SectIsDestroyed, SectIsFlooded, SomeoneResealing(), TECHCOMMANDB, and TECHCOMMANDC.
00783 { 00784 TECHCOMMANDB; 00785 00786 TECHCOMMANDC; 00787 my_parsepart(&loc, NULL); 00788 DOCHECK(SectIsDestroyed(mech, loc), "That section is destroyed!"); 00789 DOCHECK(!SectIsFlooded(mech, loc), "That has not been flooded!"); 00790 DOCHECK(Invalid_Repair_Path(mech, loc), 00791 "You need to reattach adjacent locations first!"); 00792 DOCHECK(SomeoneResealing(mech, loc), 00793 "Someone's sealing that section already!"); 00794 DOTECH_LOC(RESEAL_DIFFICULTY, reseal_fail, reseal_succ, reseal_econ, 00795 RESEAL_TIME, mech, loc, muxevent_tickmech_reseal, 00796 EVENT_REPAIR_RESE, "You start resealing the section."); 00797 }
TECHCOMMANDH | ( | tech_replacesuit | ) |
Definition at line 741 of file mech.tech.commands.c.
References CLASS_BSUIT, CountBSuitMembers(), DOCHECK, DOTECH_LOC, EVENT_REPAIR_REPSUIT, GetLCaseBSuitName(), loc, MechMaxSuits, MechType, muxevent_tickmech_replacesuit(), my_parsepart, REPLACESUIT_DIFFICULTY, replacesuit_econ(), replacesuit_fail(), replacesuit_succ(), REPLACESUIT_TIME, SectIsDestroyed, SomeoneReplacingSuit(), TECHCOMMANDB, TECHCOMMANDC, and tprintf().
00742 { 00743 int wSuits = 0; 00744 00745 TECHCOMMANDB; 00746 00747 TECHCOMMANDC; 00748 my_parsepart(&loc, NULL); 00749 DOCHECK(MechType(mech) != CLASS_BSUIT, 00750 "You can only use 'replacesuit' on a battlesuit unit!"); 00751 00752 wSuits = CountBSuitMembers(mech); 00753 00754 DOCHECK(MechMaxSuits(mech) <= wSuits, 00755 tprintf 00756 ("This %s is already full! This %s only consists of %d suits!", 00757 GetLCaseBSuitName(mech), GetLCaseBSuitName(mech), 00758 MechMaxSuits(mech))); 00759 DOCHECK((loc >= MechMaxSuits(mech)) || 00760 (loc < 0), 00761 tprintf("Invalid suit! This %s only consists of %d suits!", 00762 GetLCaseBSuitName(mech), MechMaxSuits(mech))); 00763 00764 DOCHECK(!SectIsDestroyed(mech, loc), "That suit isn't destroyed!"); 00765 00766 DOCHECK(SomeoneReplacingSuit(mech, loc), 00767 "Someone's already rebuilding that suit!"); 00768 DOCHECK(wSuits <= 0, 00769 "You are unable to replace the suits here! None of the buggers are still alive!"); 00770 DOTECH_LOC(REPLACESUIT_DIFFICULTY, replacesuit_fail, replacesuit_succ, 00771 replacesuit_econ, REPLACESUIT_TIME, mech, loc, 00772 muxevent_tickmech_replacesuit, EVENT_REPAIR_REPSUIT, 00773 "You start replacing the missing suit."); 00774 }
TECHCOMMANDH | ( | tech_reattach | ) |
Definition at line 720 of file mech.tech.commands.c.
References CLASS_BSUIT, DOCHECK, DOTECH_LOC, EVENT_REPAIR_REAT, Invalid_Repair_Path(), loc, MechType, muxevent_tickmech_reattach(), my_parsepart, REATTACH_DIFFICULTY, reattach_econ(), reattach_fail(), reattach_succ(), REATTACH_TIME, SectIsDestroyed, SomeoneAttaching(), TECHCOMMANDB, TECHCOMMANDC, and unit_is_fixable().
00721 { 00722 TECHCOMMANDB; 00723 00724 TECHCOMMANDC; 00725 my_parsepart(&loc, NULL); 00726 DOCHECK(MechType(mech) == CLASS_BSUIT, 00727 "You can't reattach a Battlesuit! Use 'replacesuit'!"); 00728 DOCHECK(!SectIsDestroyed(mech, loc), "That section isn't destroyed!"); 00729 DOCHECK(Invalid_Repair_Path(mech, loc), 00730 "You need to reattach adjacent locations first!"); 00731 DOCHECK(SomeoneAttaching(mech, loc), 00732 "Someone's attaching that section already!"); 00733 DOCHECK(!unit_is_fixable(mech), 00734 "You see nothing to reattach it to (read:unit is cored)."); 00735 DOTECH_LOC(REATTACH_DIFFICULTY, reattach_fail, reattach_succ, 00736 reattach_econ, REATTACH_TIME, mech, loc, 00737 muxevent_tickmech_reattach, EVENT_REPAIR_REAT, 00738 "You start replacing the section.."); 00739 }
TECHCOMMANDH | ( | tech_fixinternal | ) |
Definition at line 652 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOC_VAL_S, EVENT_REPAIR_FIX, EVENT_REPAIR_FIXI, FIXINTERNAL_DIFFICULTY, fixinternal_econ(), fixinternal_fail(), fixinternal_succ(), FIXINTERNAL_TIME, GetSectInt, GetSectOInt, loc, muxevent_tickmech_repairinternal(), my_parsepart, SectIsDestroyed, SectIsFlooded, SomeoneFixing(), SomeoneScrappingLoc(), STARTIREPAIR, TECHCOMMANDB, and TECHCOMMANDC.
00653 { 00654 TECHCOMMANDB int ochange; 00655 00656 TECHCOMMANDC; 00657 my_parsepart(&loc, NULL); 00658 from = GetSectInt(mech, loc); 00659 to = GetSectOInt(mech, loc); 00660 DOCHECK(from == to, "The location doesn't need internals' repair!"); 00661 change = to - from; 00662 DOCHECK(SectIsDestroyed(mech, loc), 00663 "That part's blown off! Use reattach first!"); 00664 DOCHECK(SectIsFlooded(mech, loc), 00665 "That location has been flooded! Use reseal first!"); 00666 DOCHECK(SomeoneFixing(mech, loc), 00667 "Someone's repairing that section already!"); 00668 DOCHECK(SomeoneScrappingLoc(mech, loc), 00669 "Someone's scrapping that section - no repairs are possible!"); 00670 ochange = change; 00671 DOTECH_LOC_VAL_S(FIXINTERNAL_DIFFICULTY, fixinternal_fail, 00672 fixinternal_succ, fixinternal_econ, &change, 00673 FIXINTERNAL_TIME * ochange, loc, EVENT_REPAIR_FIX, mech, 00674 "You start fixing the internals.."); 00675 STARTIREPAIR(FIXINTERNAL_TIME * change, mech, (change * 16 + loc), 00676 muxevent_tickmech_repairinternal, EVENT_REPAIR_FIXI, change); 00677 }
TECHCOMMANDH | ( | tech_fixarmor | ) |
Definition at line 614 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOC_VAL_S, EVENT_REPAIR_FIX, FIXARMOR_DIFFICULTY, fixarmor_econ(), fixarmor_fail(), fixarmor_succ(), FIXARMOR_TIME, GetSectArmor, GetSectInt, GetSectOArmor, GetSectOInt, GetSectORArmor, GetSectRArmor, loc, MIN, muxevent_tickmech_repairarmor(), SectIsDestroyed, SectIsFlooded, SomeoneFixingA(), SomeoneFixingI(), SomeoneScrappingLoc(), STARTIREPAIR, tech_parsepart_advanced(), TECHCOMMANDB, and TECHCOMMANDD.
00615 { 00616 int ochange; 00617 00618 TECHCOMMANDB; 00619 00620 TECHCOMMANDD; 00621 DOCHECK(tech_parsepart_advanced(mech, buffer, &loc, NULL, NULL, 1) < 0, 00622 "Invalid section!"); 00623 if(loc >= 8) { 00624 from = GetSectRArmor(mech, loc % 8); 00625 to = GetSectORArmor(mech, loc % 8); 00626 } else { 00627 from = GetSectArmor(mech, loc); 00628 to = GetSectOArmor(mech, loc); 00629 } 00630 DOCHECK(SectIsDestroyed(mech, loc % 8), 00631 "That part's blown off! Use reattach first!"); 00632 DOCHECK(SectIsFlooded(mech, loc % 8), 00633 "That location has been flooded! Use reseal first!"); 00634 DOCHECK(SomeoneFixingA(mech, loc) || 00635 SomeoneFixingI(mech, loc % 8), 00636 "Someone's repairing that section already!"); 00637 DOCHECK(GetSectInt(mech, loc % 8) != GetSectOInt(mech, loc % 8), 00638 "The internals need to be fixed first!"); 00639 DOCHECK(SomeoneScrappingLoc(mech, loc), 00640 "Someone's scrapping that section - no repairs are possible!"); 00641 from = MIN(to, from); 00642 DOCHECK(from == to, "The location doesn't need armor repair!"); 00643 change = to - from; 00644 ochange = change; 00645 DOTECH_LOC_VAL_S(FIXARMOR_DIFFICULTY, fixarmor_fail, fixarmor_succ, 00646 fixarmor_econ, &change, FIXARMOR_TIME * ochange, loc, 00647 EVENT_REPAIR_FIX, mech, "You start fixing the armor.."); 00648 STARTIREPAIR(FIXARMOR_TIME * change, mech, (change * 16 + loc), 00649 muxevent_tickmech_repairarmor, EVENT_REPAIR_FIX, change); 00650 }
TECHCOMMANDH | ( | tech_unload | ) |
Definition at line 581 of file mech.tech.commands.c.
References DOCHECK, EVENT_REPAIR_RELO, full, FullAmmo(), GetPartData, GetPartType, IsAmmo, loc, muxevent_tickmech_reload(), my_parsepart, PACK_LOCPOS_E, PartIsDisabled, PartIsNonfunctional, RELOAD_TIME, REMOVES_DIFFICULTY, SectIsDestroyed, SectIsFlooded, SomeoneRepairing(), SomeoneScrappingLoc(), START, STARTREPAIR, tech_roll(), TECHCOMMANDB, and TECHCOMMANDD.
00582 { 00583 TECHCOMMANDB; 00584 00585 TECHCOMMANDD; 00586 my_parsepart(&loc, &part); 00587 DOCHECK(!IsAmmo((t = GetPartType(mech, loc, part))), "That's no ammo!"); 00588 DOCHECK(PartIsNonfunctional(mech, loc, part), 00589 "The ammo compartment is destroyed ; repair/replacepart it first."); 00590 DOCHECK(PartIsDisabled(mech, loc, part), 00591 "The ammo compartment is disabled ; repair/replacepart it first."); 00592 DOCHECK(!(now = 00593 GetPartData(mech, loc, part)), 00594 "That particular ammo compartment is empty already."); 00595 DOCHECK(SomeoneRepairing(mech, loc, part), 00596 "Someone's playing with that part already!"); 00597 DOCHECK(SectIsDestroyed(mech, loc), 00598 "That part's blown off! Use reattach first!"); 00599 DOCHECK(SectIsFlooded(mech, loc), 00600 "That location has been flooded! Use reseal first!"); 00601 DOCHECK(SomeoneScrappingLoc(mech, loc), 00602 "Someone's scrapping that section - no repairs are possible!"); 00603 if((full = FullAmmo(mech, loc, part)) == now) 00604 change = 2; 00605 else 00606 change = 1; 00607 if(tech_roll(player, mech, REMOVES_DIFFICULTY) < 0) 00608 mod = 3; 00609 START("You start unloading the ammo compartment.."); 00610 STARTREPAIR(RELOAD_TIME, mech, PACK_LOCPOS_E(loc, part, change), 00611 muxevent_tickmech_reload, EVENT_REPAIR_RELO); 00612 }
TECHCOMMANDH | ( | tech_reload | ) |
Definition at line 541 of file mech.tech.commands.c.
References AMMO_MODES, DOCHECK, DOTECH_LOCPOS_VAL, EVENT_REPAIR_RELO, full, FullAmmo(), GetPartAmmoMode, GetPartData, GetPartType, IsAmmo, loc, muxevent_tickmech_reload(), my_parsepart2, PACK_LOCPOS_E, PartIsDisabled, PartIsNonfunctional, RELOAD_DIFFICULTY, reload_econ(), reload_fail(), reload_succ(), RELOAD_TIME, SectIsDestroyed, SectIsFlooded, SetPartData, SomeoneRepairing(), SomeoneScrappingLoc(), TECHCOMMANDB, TECHCOMMANDD, and valid_ammo_mode().
00542 { 00543 int atype; 00544 00545 TECHCOMMANDB; 00546 TECHCOMMANDD; 00547 my_parsepart2(&loc, &part, &atype); 00548 DOCHECK(!IsAmmo((t = GetPartType(mech, loc, part))), "That's no ammo!"); 00549 DOCHECK(PartIsNonfunctional(mech, loc, part), 00550 "The ammo compartment is destroyed ; repair/replacepart it first."); 00551 DOCHECK(PartIsDisabled(mech, loc, part), 00552 "The ammo compartment is disabled ; repair/replacepart it first."); 00553 DOCHECK((now = GetPartData(mech, loc, part)) == (full = 00554 FullAmmo(mech, loc, 00555 part)), 00556 "That particular ammo compartment doesn't need reloading."); 00557 DOCHECK(SomeoneRepairing(mech, loc, part), 00558 "Someone's playing with that part already!"); 00559 DOCHECK(SectIsDestroyed(mech, loc), 00560 "That part's blown off! Use reattach first!"); 00561 DOCHECK(SectIsFlooded(mech, loc), 00562 "That location has been flooded! Use reseal first!"); 00563 DOCHECK(SomeoneScrappingLoc(mech, loc), 00564 "Someone's scrapping that section - no repairs are possible!"); 00565 if(atype) { 00566 DOCHECK((t = 00567 (valid_ammo_mode(mech, loc, part, atype))) < 0, 00568 "That is invalid ammo type for this weapon!"); 00569 SetPartData(mech, loc, part, 0); 00570 GetPartAmmoMode(mech, loc, part) &= ~(AMMO_MODES); 00571 GetPartAmmoMode(mech, loc, part) |= t; 00572 } 00573 change = 0; 00574 DOTECH_LOCPOS_VAL(RELOAD_DIFFICULTY, reload_fail, reload_succ, 00575 reload_econ, &change, RELOAD_TIME, mech, 00576 PACK_LOCPOS_E(loc, part, change), 00577 muxevent_tickmech_reload, EVENT_REPAIR_RELO, 00578 "You start reloading the ammo compartment.."); 00579 }
TECHCOMMANDH | ( | tech_toggletype | ) |
Definition at line 517 of file mech.tech.commands.c.
References AMMO_MODES, DOCHECK, FullAmmo(), GetPartAmmoMode, GetPartType, In_Character, IsAmmo, loc, mech_notify(), MECHALL, my_parsepart2, PartIsDisabled, PartIsNonfunctional, SetPartData, TECHCOMMANDB, valid_ammo_mode(), and Wizard.
00518 { 00519 int atype; 00520 00521 TECHCOMMANDB; 00522 00523 DOCHECK((!Wizard(player)) && In_Character(mech->mynum), 00524 "This command only works in simpods!"); 00525 my_parsepart2(&loc, &part, &atype); 00526 DOCHECK(!IsAmmo((t = GetPartType(mech, loc, part))), "That's no ammo!"); 00527 DOCHECK(PartIsNonfunctional(mech, loc, part) || 00528 PartIsDisabled(mech, loc, part), 00529 "The ammo compartment is nonfunctional!"); 00530 DOCHECK(!atype, 00531 "You need to give a type to toggle to (use - for normal)"); 00532 DOCHECK((t = 00533 (valid_ammo_mode(mech, loc, part, atype))) < 0, 00534 "That is invalid ammo type for this weapon!"); 00535 GetPartAmmoMode(mech, loc, part) &= ~(AMMO_MODES); 00536 GetPartAmmoMode(mech, loc, part) |= t; 00537 SetPartData(mech, loc, part, FullAmmo(mech, loc, part)); 00538 mech_notify(mech, MECHALL, "Ammo toggled."); 00539 }
TECHCOMMANDH | ( | tech_repairpart | ) |
Definition at line 486 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOCPOS, EMPTY, EVENT_REPAIR_REPAP, GetPartType, IsCrap, IsWeapon, loc, muxevent_tickmech_repairpart(), my_parsepart, PACK_LOCPOS, PartIsDestroyed, PartIsDisabled, PartTempNuke, PARTTYPE_DIFFICULTY, REPAIR_DIFFICULTY, repair_econ(), repairp_fail(), repairp_succ(), REPAIRPART_TIME, SectIsDestroyed, SectIsFlooded, SomeoneRepairing(), SomeoneScrappingLoc(), TECHCOMMANDB, and TECHCOMMANDC.
00487 { 00488 TECHCOMMANDB; 00489 00490 TECHCOMMANDC; 00491 my_parsepart(&loc, &part); 00492 DOCHECK((t = 00493 GetPartType(mech, loc, part)) == EMPTY, 00494 "That location is empty!"); 00495 DOCHECK(PartIsDestroyed(mech, loc, part), "That part is gone for good!"); 00496 DOCHECK(PartIsDisabled(mech, loc, part), 00497 "That part can't be repaired yet!"); 00498 DOCHECK(!PartTempNuke(mech, loc, part), "That part isn't hurtin'!"); 00499 DOCHECK(IsCrap(GetPartType(mech, loc, part)), "That part isn't hurtin'!"); 00500 DOCHECK(IsWeapon(t), "That's a weapon! Use repairgun instead."); 00501 DOCHECK(SectIsDestroyed(mech, loc), 00502 "That part's blown off! Use reattach first!"); 00503 DOCHECK(SectIsFlooded(mech, loc), 00504 "That location has been flooded! Use reseal first!"); 00505 DOCHECK(SomeoneRepairing(mech, loc, part), 00506 "Someone's repairing that part already!"); 00507 DOCHECK(SomeoneScrappingLoc(mech, loc), 00508 "Someone's scrapping that section - no repairs are possible!"); 00509 DOTECH_LOCPOS(REPAIR_DIFFICULTY + PARTTYPE_DIFFICULTY(GetPartType(mech, 00510 loc, 00511 part)), 00512 repairp_fail, repairp_succ, repair_econ, REPAIRPART_TIME, 00513 mech, PACK_LOCPOS(loc, part), muxevent_tickmech_repairpart, 00514 EVENT_REPAIR_REPAP, "You start repairing the part..", 0); 00515 }
TECHCOMMANDH | ( | tech_replacepart | ) |
Definition at line 457 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOCPOS, EMPTY, EVENT_REPAIR_REPL, GetPartType, IsCrap, IsWeapon, loc, muxevent_tickmech_repairpart(), my_parsepart, PACK_LOCPOS, PartIsNonfunctional, PARTTYPE_DIFFICULTY, REPLACE_DIFFICULTY, replace_econ(), replacep_fail(), replacep_succ(), REPLACEPART_TIME, SectIsDestroyed, SectIsFlooded, SomeoneRepairing(), SomeoneScrappingLoc(), TECHCOMMANDB, and TECHCOMMANDC.
00458 { 00459 TECHCOMMANDB; 00460 00461 TECHCOMMANDC; 00462 my_parsepart(&loc, &part); 00463 DOCHECK((t = 00464 GetPartType(mech, loc, part)) == EMPTY, 00465 "That location is empty!"); 00466 DOCHECK(!PartIsNonfunctional(mech, loc, part), 00467 "That part looks ok to me.."); 00468 DOCHECK(IsCrap(GetPartType(mech, loc, part)), "That part isn't hurtin'!"); 00469 DOCHECK(IsWeapon(t), "That's a weapon! Use replacegun instead."); 00470 DOCHECK(SectIsDestroyed(mech, loc), 00471 "That part's blown off! Use reattach first!"); 00472 DOCHECK(SectIsFlooded(mech, loc), 00473 "That location has been flooded! Use reseal first!"); 00474 DOCHECK(SomeoneRepairing(mech, loc, part), 00475 "Someone's repairing that part already!"); 00476 DOCHECK(SomeoneScrappingLoc(mech, loc), 00477 "Someone's scrapping that section - no repairs are possible!"); 00478 DOTECH_LOCPOS(REPLACE_DIFFICULTY + 00479 PARTTYPE_DIFFICULTY(GetPartType(mech, loc, part)), 00480 replacep_fail, replacep_succ, replace_econ, 00481 REPLACEPART_TIME, mech, PACK_LOCPOS(loc, part), 00482 muxevent_tickmech_repairpart, EVENT_REPAIR_REPL, 00483 "You start replacing the part..", 0); 00484 }
TECHCOMMANDH | ( | tech_fixenhcrit | ) |
Definition at line 419 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOCPOS, ENHCRIT_DIFFICULTY, EVENT_REPAIR_REPENHCRIT, GetPartType, IsWeapon, loc, muxevent_tickmech_repairenhcrit(), my_parsegun, notify, PACK_LOCPOS, PartIsDamaged, PartIsDisabled, repairenhcrit_econ(), repairenhcrit_fail(), repairenhcrit_succ(), REPAIRENHCRIT_TIME, SectIsDestroyed, SectIsFlooded, SomeoneRepairing(), SomeoneScrappingLoc(), SomeoneScrappingPart(), TECHCOMMANDB, and TECHCOMMANDC.
00420 { 00421 int extra_hard = 0; 00422 00423 TECHCOMMANDB; 00424 TECHCOMMANDC; 00425 /* Find the gun for us */ 00426 my_parsegun(&loc, &part, NULL); 00427 DOCHECK(SectIsDestroyed(mech, loc), 00428 "That part's blown off! Use reattach first!"); 00429 DOCHECK(SectIsFlooded(mech, loc), 00430 "That location has been flooded! Use reseal first!"); 00431 DOCHECK(SomeoneRepairing(mech, loc, part), 00432 "Someone's repairing that part already!"); 00433 DOCHECK(!IsWeapon(GetPartType(mech, loc, part)), "That's no gun!"); 00434 DOCHECK(SomeoneScrappingPart(mech, loc, part), 00435 "Someone's scrapping it already!"); 00436 DOCHECK(SomeoneScrappingLoc(mech, loc), 00437 "Someone's scrapping that section - no repairs are possible!"); 00438 DOCHECK(PartIsDisabled(mech, loc, part), "That gun can't be fixed yet!"); 00439 00440 if(!PartIsDamaged(mech, loc, part)) { 00441 notify(player, "That gun isn't damaged!"); 00442 return; 00443 } 00444 00445 DOTECH_LOCPOS(ENHCRIT_DIFFICULTY, 00446 repairenhcrit_fail, 00447 repairenhcrit_succ, 00448 repairenhcrit_econ, 00449 REPAIRENHCRIT_TIME, 00450 mech, 00451 PACK_LOCPOS(loc, part), 00452 muxevent_tickmech_repairenhcrit, 00453 EVENT_REPAIR_REPENHCRIT, 00454 "You start repairing the weapon...", 1); 00455 }
TECHCOMMANDH | ( | tech_repairgun | ) |
Definition at line 374 of file mech.tech.commands.c.
References DOCHECK, DOTECH_LOCPOS, EVENT_REPAIR_REPAP, GetPartType, GetWeaponCrits(), IsWeapon, loc, muxevent_tickmech_repairgun(), my_parsegun, notify, PACK_LOCPOS, PartIsDestroyed, PartIsDisabled, PartTempNuke, REPAIR_DIFFICULTY, repair_econ(), repairg_fail(), repairg_succ(), REPAIRGUN_TIME, SectIsDestroyed, SectIsFlooded, SomeoneRepairing(), SomeoneScrappingLoc(), SomeoneScrappingPart(), TECHCOMMANDB, TECHCOMMANDC, ValidGunPos(), Weapon2I, and WEAPTYPE_DIFFICULTY.
00375 { 00376 int extra_hard = 0; 00377 00378 TECHCOMMANDB; 00379 TECHCOMMANDC; 00380 /* Find the gun for us */ 00381 my_parsegun(&loc, &part, NULL); 00382 DOCHECK(SectIsDestroyed(mech, loc), 00383 "That part's blown off! Use reattach first!"); 00384 DOCHECK(SectIsFlooded(mech, loc), 00385 "That location has been flooded! Use reseal first!"); 00386 DOCHECK(SomeoneRepairing(mech, loc, part), 00387 "Someone's repairing that part already!"); 00388 DOCHECK(!IsWeapon(GetPartType(mech, loc, part)), "That's no gun!"); 00389 DOCHECK(!ValidGunPos(mech, loc, part), 00390 "You can't repair middle of a gun!"); 00391 DOCHECK(SomeoneScrappingPart(mech, loc, part), 00392 "Someone's scrapping it already!"); 00393 DOCHECK(SomeoneScrappingLoc(mech, loc), 00394 "Someone's scrapping that section - no repairs are possible!"); 00395 DOCHECK(PartIsDisabled(mech, loc, part), "That gun can't be fixed yet!"); 00396 00397 if(PartIsDestroyed(mech, loc, part)) { 00398 if(GetWeaponCrits(mech, Weapon2I(GetPartType(mech, loc, 00399 part))) < 5 || 00400 PartIsDestroyed(mech, loc, part + 1)) { 00401 notify(player, "That gun is gone for good!"); 00402 return; 00403 } 00404 extra_hard = 1; 00405 } else if(!PartTempNuke(mech, loc, part)) { 00406 notify(player, "That gun isn't hurtin'!"); 00407 return; 00408 } 00409 00410 DOTECH_LOCPOS(REPAIR_DIFFICULTY + WEAPTYPE_DIFFICULTY(GetPartType(mech, 00411 loc, 00412 part)) + 00413 extra_hard, repairg_fail, repairg_succ, repair_econ, 00414 REPAIRGUN_TIME, mech, PACK_LOCPOS(loc, part), 00415 muxevent_tickmech_repairgun, EVENT_REPAIR_REPAP, 00416 "You start repairing the weapon..", 1); 00417 }
TECHCOMMANDH | ( | tech_replacegun | ) |
Definition at line 338 of file mech.tech.commands.c.
References ClanMod, DOCHECK, DOTECH_LOCPOS, EVENT_REPAIR_REPLG, GetPartBrand, GetPartType, GetWeaponCrits(), IsWeapon, loc, muxevent_tickmech_replacegun(), my_parsegun, PACK_LOCPOS_E, PartIsNonfunctional, REPLACE_DIFFICULTY, replace_econ(), replaceg_fail(), replaceg_succ(), REPLACEGUN_TIME, SectIsDestroyed, SectIsFlooded, SetPartBrand, SomeoneRepairing(), SomeoneScrappingLoc(), TECHCOMMANDB, TECHCOMMANDC, ValidGunPos(), Weapon2I, and WEAPTYPE_DIFFICULTY.
00339 { 00340 int brand = 0, ob = 0; 00341 00342 TECHCOMMANDB; 00343 TECHCOMMANDC; 00344 my_parsegun(&loc, &part, &brand); 00345 DOCHECK(SectIsDestroyed(mech, loc), 00346 "That part's blown off! Use reattach first!"); 00347 DOCHECK(SectIsFlooded(mech, loc), 00348 "That location has been flooded! Use reseal first!"); 00349 DOCHECK(SomeoneRepairing(mech, loc, part), 00350 "Someone's repairing that part already!"); 00351 DOCHECK(!IsWeapon(GetPartType(mech, loc, part)), "That's no gun!"); 00352 DOCHECK(!ValidGunPos(mech, loc, part), 00353 "You can't replace middle of a gun!"); 00354 DOCHECK(!PartIsNonfunctional(mech, loc, part), "That gun isn't hurtin'!"); 00355 DOCHECK(SomeoneScrappingLoc(mech, loc), 00356 "Someone's scrapping that section - no repairs are possible!"); 00357 if(brand) { 00358 ob = GetPartBrand(mech, loc, part); 00359 SetPartBrand(mech, loc, part, brand); 00360 } 00361 DOTECH_LOCPOS(REPLACE_DIFFICULTY + 00362 WEAPTYPE_DIFFICULTY(GetPartType(mech, loc, part)), 00363 replaceg_fail, replaceg_succ, replace_econ, 00364 REPLACEGUN_TIME * 00365 ClanMod(GetWeaponCrits 00366 (mech, Weapon2I(GetPartType(mech, loc, part)))), 00367 mech, PACK_LOCPOS_E(loc, part, brand), 00368 muxevent_tickmech_replacegun, EVENT_REPAIR_REPLG, 00369 "You start replacing the gun..", 1); 00370 if(brand) 00371 SetPartBrand(mech, loc, part, ob); 00372 }
TECHCOMMANDH | ( | tech_removesection | ) |
Definition at line 319 of file mech.tech.commands.c.
References CanScrapLoc(), DOCHECK, EVENT_REPAIR_SCRL, Invalid_Scrap_Path(), loc, muxevent_tickmech_removesection(), my_parsepart, PACK_LOCPOS_E, REMOVES_DIFFICULTY, REMOVES_TIME, SectIsDestroyed, SomeoneScrappingLoc(), START, STARTREPAIR, tech_roll(), TECHCOMMANDB, and TECHCOMMANDC.
00320 { 00321 TECHCOMMANDB; 00322 TECHCOMMANDC; 00323 my_parsepart(&loc, NULL); 00324 DOCHECK(SectIsDestroyed(mech, loc), "That section's gone already!"); 00325 DOCHECK(Invalid_Scrap_Path(mech, loc), 00326 "You need to remove the outer sections first!"); 00327 DOCHECK(SomeoneScrappingLoc(mech, loc), 00328 "Someone's scrapping it already!"); 00329 DOCHECK(!CanScrapLoc(mech, loc), "Someone's tinkering with it already!"); 00330 /* Ok.. Everything's valid (we hope). */ 00331 if(tech_roll(player, mech, REMOVES_DIFFICULTY) < 0) 00332 mod = 3; 00333 START("You start removing the section.."); 00334 STARTREPAIR(REMOVES_TIME, mech, PACK_LOCPOS_E(loc, 0, mod), 00335 muxevent_tickmech_removesection, EVENT_REPAIR_SCRL); 00336 }
TECHCOMMANDH | ( | tech_removepart | ) |
Definition at line 249 of file mech.tech.commands.c.
References CanScrapPart(), DOCHECK, EMPTY, ENDO_STEEL, EVENT_REPAIR_SCRP, FAKEREPAIR, FERRO_FIBROUS, GetPartType, HVY_FERRO_FIBROUS, IsCrap, IsWeapon, loc, LT_FERRO_FIBROUS, muxevent_tickmech_removepart(), my_parsepart, PACK_LOCPOS_E, PartIsDestroyed, REMOVEP_DIFFICULTY, REMOVEP_TIME, SectIsDestroyed, SomeoneScrappingLoc(), SomeoneScrappingPart(), Special, START, STARTREPAIR, STEALTH_ARMOR, tech_roll(), TECHCOMMANDB, and TECHCOMMANDC.
00250 { 00251 TECHCOMMANDB; 00252 TECHCOMMANDC; 00253 my_parsepart(&loc, &part); 00254 DOCHECK((t = 00255 GetPartType(mech, loc, part)) == EMPTY, 00256 "That location is empty!"); 00257 DOCHECK(SectIsDestroyed(mech, loc), 00258 "That part's blown off! You can assume the part's gone too!"); 00259 DOCHECK(IsWeapon(t), "That's a gun - use removegun instead!"); 00260 DOCHECK(PartIsDestroyed(mech, loc, part), "That part's gone already!"); 00261 DOCHECK(IsCrap(GetPartType(mech, loc, part)), 00262 "That type isn't scrappable!"); 00263 DOCHECK(t == Special(ENDO_STEEL) || 00264 t == Special(FERRO_FIBROUS) || t == Special(STEALTH_ARMOR) || 00265 t == Special(HVY_FERRO_FIBROUS) || t == Special(LT_FERRO_FIBROUS), 00266 "That type of item can't be removed!"); 00267 DOCHECK(SomeoneScrappingPart(mech, loc, part), 00268 "Someone's scrapping it already!"); 00269 DOCHECK(SomeoneScrappingLoc(mech, loc), 00270 "Someone's scrapping that section - no additional removals are possible!"); 00271 DOCHECK(!CanScrapPart(mech, loc, part), 00272 "Someone's tinkering with it already!"); 00273 /* Ok.. Everything's valid (we hope). */ 00274 START("You start removing the part.."); 00275 if(tech_roll(player, mech, REMOVEP_DIFFICULTY) < 0) { 00276 START 00277 ("Ack! Your attempt is far from perfect, you try to recover the part.."); 00278 if(tech_roll(player, mech, REMOVEP_DIFFICULTY) < 0) { 00279 START("No good. Consider the part gone."); 00280 mod = 3; 00281 FAKEREPAIR(REMOVEP_TIME, EVENT_REPAIR_SCRP, mech, 00282 PACK_LOCPOS_E(loc, part, mod)); 00283 return; 00284 } 00285 } 00286 STARTREPAIR(REMOVEP_TIME, mech, PACK_LOCPOS_E(loc, part, mod), 00287 muxevent_tickmech_removepart, EVENT_REPAIR_SCRP); 00288 }
TECHCOMMANDH | ( | tech_removegun | ) |
Definition at line 206 of file mech.tech.commands.c.
References CanScrapPart(), ClanMod, DOCHECK, EVENT_REPAIR_SCRG, FAKEREPAIR, GetPartType, GetWeaponCrits(), IsWeapon, loc, muxevent_tickmech_removegun(), my_parsegun, PACK_LOCPOS_E, PartIsDestroyed, REMOVEG_DIFFICULTY, REMOVEG_TIME, SectIsDestroyed, SomeoneScrappingLoc(), SomeoneScrappingPart(), START, STARTREPAIR, tech_weapon_roll(), TECHCOMMANDB, TECHCOMMANDC, ValidGunPos(), and Weapon2I.
00207 { 00208 TECHCOMMANDB; 00209 TECHCOMMANDC; 00210 my_parsegun(&loc, &part, NULL); 00211 DOCHECK(SectIsDestroyed(mech, loc), 00212 "That part's blown off! You can assume the gun's gone too!"); 00213 DOCHECK(!IsWeapon(GetPartType(mech, loc, part)), "That's no gun!"); 00214 DOCHECK(PartIsDestroyed(mech, loc, part), "That gun's gone already!"); 00215 DOCHECK(!ValidGunPos(mech, loc, part), 00216 "You can't remove middle of a gun!"); 00217 DOCHECK(SomeoneScrappingPart(mech, loc, part), 00218 "Someone's scrapping it already!"); 00219 DOCHECK(!CanScrapPart(mech, loc, part), 00220 "Someone's tinkering with it already!"); 00221 DOCHECK(SomeoneScrappingLoc(mech, loc), 00222 "Someone's scrapping that section - no additional removals are possible!"); 00223 /* Ok.. Everything's valid (we hope). */ 00224 if(tech_weapon_roll(player, mech, REMOVEG_DIFFICULTY) < 0) { 00225 START 00226 ("Ack! Your attempt is far from perfect, you try to recover the gun.."); 00227 if(tech_weapon_roll(player, mech, REMOVEG_DIFFICULTY) < 0) { 00228 START("No good. Consider the part gone."); 00229 FAKEREPAIR(REMOVEG_TIME * ClanMod(GetWeaponCrits(mech, 00230 Weapon2I 00231 (GetPartType 00232 (mech, loc, 00233 part)))), 00234 EVENT_REPAIR_SCRG, mech, PACK_LOCPOS_E(loc, part, 00235 mod)); 00236 mod = 3; 00237 return; 00238 } 00239 } 00240 START("You start removing the gun.."); 00241 STARTREPAIR(REMOVEG_TIME * ClanMod(GetWeaponCrits(mech, 00242 Weapon2I(GetPartType 00243 (mech, loc, 00244 part)))), 00245 mech, PACK_LOCPOS_E(loc, part, mod), 00246 muxevent_tickmech_removegun, EVENT_REPAIR_SCRG); 00247 }
int unit_is_fixable | ( | MECH * | mech | ) |
Definition at line 698 of file mech.tech.commands.c.
References CLASS_MECH, CLASS_VEH_GROUND, CLASS_VTOL, CTORSO, GetSectOInt, MechType, NUM_SECTIONS, ROTOR, SectIsDestroyed, and TURRET.
Referenced by damages_func(), fun_btnumrepjobs(), fun_btunitfixable(), mech_embark(), show_mechs_damage(), tech_fix(), and TECHCOMMANDH().
00699 { 00700 int i; 00701 00702 for(i = 0; i < NUM_SECTIONS; i++) { 00703 if(!GetSectOInt(mech, i)) 00704 continue; 00705 if(!SectIsDestroyed(mech, i)) 00706 continue; 00707 if(MechType(mech) == CLASS_MECH) 00708 if(i == CTORSO) 00709 return 0; 00710 if(MechType(mech) == CLASS_VTOL) 00711 if(i != ROTOR) 00712 return 0; 00713 if(MechType(mech) == CLASS_VEH_GROUND) 00714 if(i != TURRET) 00715 return 0; 00716 } 00717 return 1; 00718 };
int ValidGunPos | ( | MECH * | mech, | |
int | loc, | |||
int | pos | |||
) |
Definition at line 178 of file mech.tech.commands.c.
References FindWeapons_Advanced(), and MAX_WEAPS_SECTION.
Referenced by TECHCOMMANDH().
00179 { 00180 unsigned char weaparray_f[MAX_WEAPS_SECTION]; 00181 unsigned char weapdata_f[MAX_WEAPS_SECTION]; 00182 int critical_f[MAX_WEAPS_SECTION]; 00183 int i, num_weaps_f; 00184 00185 if((num_weaps_f = 00186 FindWeapons_Advanced(mech, loc, weaparray_f, weapdata_f, 00187 critical_f, 1)) < 0) 00188 return 0; 00189 for(i = 0; i < num_weaps_f; i++) 00190 if(critical_f[i] == pos) 00191 return 1; 00192 return 0; 00193 }
int tmp_flag = 0 [static] |
Definition at line 43 of file mech.tech.commands.c.
Referenced by CanScrapLoc(), tech_check_loc(), and tech_check_locpart().
int tmp_loc [static] |
Definition at line 44 of file mech.tech.commands.c.
Referenced by CanScrapLoc(), tech_check_loc(), and tech_check_locpart().
int tmp_part [static] |