Skip to content

Commit

Permalink
Enforced default position for mobs
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Jan 5, 2025
1 parent 48cd54d commit 3b97afb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/act.wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ void do_stat_character(struct char_data * ch, struct char_data * k)
strlcat(buf, "\r\n", sizeof(buf));

strlcat(buf, "Default position: ", sizeof(buf));
sprinttype((k->mob_specials.default_pos), position_types, buf2, sizeof(buf2));
sprinttype(GET_DEFAULT_POS(k), position_types, buf2, sizeof(buf2));
strlcat(buf, buf2, sizeof(buf));

snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), ", Idle Timer: [%d], Emote Timer: [%d]\r\n", k->char_specials.timer, k->char_specials.last_social_action);
Expand Down Expand Up @@ -1962,7 +1962,7 @@ void do_stat_mobile(struct char_data * ch, struct char_data * k)


strlcat(buf, "Default position: ", sizeof(buf));
sprinttype((k->mob_specials.default_pos), position_types, buf2, sizeof(buf2));
sprinttype(GET_DEFAULT_POS(k), position_types, buf2, sizeof(buf2));
strlcat(buf, buf2, sizeof(buf));
strlcat(buf, " Mob Spec-Proc: ", sizeof(buf));
if (mob_index[GET_MOB_RNUM(k)].func || mob_index[GET_MOB_RNUM(k)].sfunc)
Expand Down
1 change: 1 addition & 0 deletions src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4277,6 +4277,7 @@ struct char_data *read_mobile(int nr, int type)
mob->player.time.logon = time(0);
mob->player.tradition = mob->player.aspect = 0;
mob->char_specials.saved.left_handed = (!number(0, 9) ? 1 : 0);
GET_POS(mob) = (GET_DEFAULT_POS(mob) > 0 ? GET_DEFAULT_POS(mob) : POS_STANDING);

mob_index[i].number++;

Expand Down
16 changes: 6 additions & 10 deletions src/medit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ void medit_parse(struct descriptor_data *d, const char *arg)
GET_MAX_PHYSICAL(MOB) = number * 100;
GET_PHYSICAL(MOB) = number * 100;
if (GET_MAX_PHYSICAL(MOB) <= 0) {
send_to_char("^RAt 0 max phys, this mob will never be treatable and will always be mortally wounded.^n\r\n", CH);
GET_DEFAULT_POS(MOB) = MIN(GET_DEFAULT_POS(MOB), POS_MORTALLYW);
}
medit_disp_menu(d);
Expand All @@ -1425,6 +1426,7 @@ void medit_parse(struct descriptor_data *d, const char *arg)
GET_MAX_MENTAL(MOB) = number * 100;
GET_MENTAL(MOB) = number * 100;
if (GET_MAX_MENTAL(MOB) <= 0) {
send_to_char("^RAt 0 max ment, this mob will never be conscious and will always be stunned.^n\r\n", CH);
GET_DEFAULT_POS(MOB) = MIN(GET_DEFAULT_POS(MOB), POS_STUNNED);
}
medit_disp_menu(d);
Expand Down Expand Up @@ -1787,12 +1789,6 @@ void medit_parse(struct descriptor_data *d, const char *arg)
medit_disp_pos_menu(d);
} else {
GET_DEFAULT_POS(MOB) = GET_POS(MOB) = number;
if (GET_DEFAULT_POS(MOB) <= POS_MORTALLYW) {
GET_MAX_PHYSICAL(MOB) = GET_PHYSICAL(MOB) = 0;
GET_MAX_MENTAL(MOB) = GET_MENTAL(MOB) = 0;
} else if (GET_DEFAULT_POS(MOB) <= POS_STUNNED) {
GET_MAX_MENTAL(MOB) = GET_MENTAL(MOB) = 0;
}
medit_disp_menu(d);
}
break;
Expand Down Expand Up @@ -1881,12 +1877,12 @@ void write_mobs_to_disk(vnum_t zone_num)
pc_race_types_for_wholist[(int)mob->player.race],
genders[(int)mob->player.pronouns]);

if (mob->char_specials.position != POS_STANDING)
if (GET_POS(mob) != POS_STANDING)
fprintf(fp, "Position:\t%s\n",
position_types[(int)mob->char_specials.position]);
if (mob->mob_specials.default_pos)
position_types[(int)GET_POS(mob)]);
if (GET_DEFAULT_POS(mob))
fprintf(fp, "DefaultPos:\t%s\n",
position_types[(int)mob->mob_specials.default_pos]);
position_types[(int)GET_DEFAULT_POS(mob)]);

if (mob->mob_specials.attack_type != TYPE_HIT)
fprintf(fp, "AttackType:\t%s\n",
Expand Down

0 comments on commit 3b97afb

Please sign in to comment.