mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added missing return values for HOOK_INVENWIELD.
Updated NPC armor appearance mod.
This commit is contained in:
@@ -22,7 +22,9 @@ variable
|
||||
modIni := "npcarmor.ini",
|
||||
defaultFids,
|
||||
armorPidMap, // maps armor PID to it's "type" - leather armor, metal, power armor, etc.
|
||||
npcMap;
|
||||
npcMap,
|
||||
altWeapon,
|
||||
unWieldWeapon;
|
||||
|
||||
procedure check_armor_change(variable critter, variable item, variable isWorn) begin
|
||||
variable npc, armorType, fid;
|
||||
@@ -55,6 +57,8 @@ procedure check_weapon_change(variable critter, variable item, variable isWield)
|
||||
end
|
||||
return 0;
|
||||
end
|
||||
end else begin
|
||||
unWieldWeapon := obj_pid(item);
|
||||
end
|
||||
end
|
||||
return -1;
|
||||
@@ -65,15 +69,20 @@ procedure search_alt_weapon(variable critter) begin
|
||||
obj := inven_ptr(critter, 0);
|
||||
while (obj) do begin
|
||||
if (obj_item_subtype(obj) == item_type_weapon) then begin
|
||||
res := check_weapon_change(critter, obj, 1);
|
||||
if (res == -1) then begin
|
||||
wield_obj_critter(critter, obj);
|
||||
break;
|
||||
if (unWieldWeapon == 0 or unWieldWeapon != obj_pid(obj)) then begin
|
||||
res := check_weapon_change(critter, obj, 1);
|
||||
if (res == -1) then begin
|
||||
altWeapon := obj;
|
||||
wield_obj_critter(critter, obj);
|
||||
altWeapon := 0;
|
||||
break;
|
||||
end
|
||||
end
|
||||
end
|
||||
i++;
|
||||
obj := inven_ptr(critter, i);
|
||||
end
|
||||
unWieldWeapon := 0;
|
||||
end
|
||||
|
||||
// for NPCs when they change armor/weapon themselves
|
||||
@@ -89,9 +98,11 @@ procedure invenwield_handler begin
|
||||
if (fid != -1) then begin
|
||||
art_change_fid_num(critter, fid);
|
||||
end
|
||||
return;
|
||||
end
|
||||
|
||||
if (critter and item and slot == INVEN_TYPE_RIGHT_HAND) then begin
|
||||
if (altWeapon == item) then return;
|
||||
canWield := check_weapon_change(critter, item, isWorn);
|
||||
set_sfall_return(canWield);
|
||||
if (canWield != -1) then begin
|
||||
|
||||
Reference in New Issue
Block a user