mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Edits to gl_partycontrol and main.h
* it seems no need to "fix" Gecko Skinning perk anymore. * use array to hold perk levels instead of calling has_trait twice.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -37,7 +37,7 @@ procedure SetGlobalVar_Handler;
|
||||
|
||||
variable
|
||||
controlMode,
|
||||
pidList, perksList,
|
||||
pidList, perksList, addedPerkLevels,
|
||||
lightInt, lightDist, npcControl,
|
||||
displayName, displayNameColor, isShowTag,
|
||||
inControl := false,
|
||||
@@ -61,7 +61,7 @@ procedure CombatTurn_Handler begin
|
||||
variable
|
||||
status := get_sfall_arg,
|
||||
critter := get_sfall_arg,
|
||||
pid, perkID, level;
|
||||
pid, i, perkID, level;
|
||||
|
||||
DEBUGMSG("Combat Turn: " + status + ", by " + obj_name(critter) + "/" + critter + ", arg3: " + get_sfall_arg)
|
||||
|
||||
@@ -99,9 +99,14 @@ procedure CombatTurn_Handler begin
|
||||
lightInt := get_object_data(critter, OBJ_DATA_LIGHT_INTENSITY);
|
||||
|
||||
// set perks (only work with 4.1.8+)
|
||||
foreach (perkID in perksList) begin
|
||||
foreach (i: perkID in perksList) begin
|
||||
addedPerkLevels[i] := 0;
|
||||
|
||||
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
|
||||
if (level) then critter_add_trait(critter, TRAIT_PERK, perkID, level);
|
||||
if (level) then begin
|
||||
addedPerkLevels[i] := level;
|
||||
critter_add_trait(critter, TRAIT_PERK, perkID, level);
|
||||
end
|
||||
end
|
||||
// special handling if dude has Jinxed trait/perk
|
||||
if (has_trait(TRAIT_TRAIT, real_dude_obj, TRAIT_jinxed) or has_trait(TRAIT_PERK, real_dude_obj, PERK_jinxed_perk)) then begin
|
||||
@@ -142,8 +147,8 @@ procedure CombatTurn_Handler begin
|
||||
// remove perks before switching control (only work with 4.1.8+)
|
||||
if (dude_obj != real_dude_obj) then begin
|
||||
DEBUGMSG("Remove perks after NPC control.")
|
||||
foreach (perkID in perksList) begin
|
||||
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
|
||||
foreach (i: perkID in perksList) begin
|
||||
level := addedPerkLevels[i]; //has_trait(TRAIT_PERK, real_dude_obj, perkID);
|
||||
if (level) then critter_rm_trait(critter, TRAIT_PERK, perkID, level);
|
||||
end
|
||||
// special handling for Jinxed
|
||||
@@ -227,9 +232,6 @@ procedure start begin
|
||||
displayNameColor := GetConfig("CombatControl", "DisplayNameColor", 0);
|
||||
end
|
||||
|
||||
set_perk_ranks(PERK_gecko_skinning_perk, 1);
|
||||
set_perk_level(PERK_gecko_skinning_perk, 999); // prevent it from appearing in the perk selection window
|
||||
|
||||
pidList := GetConfigListInt("CombatControl", "PIDList");
|
||||
if (len_array(pidList) > 0) then
|
||||
fix_array(pidList);
|
||||
@@ -239,6 +241,8 @@ procedure start begin
|
||||
perksList := GetConfigListInt("CombatControl", "PerksList");
|
||||
fix_array(perksList);
|
||||
|
||||
addedPerkLevels := create_array_list(len_array(perksList));
|
||||
|
||||
register_hook_proc(HOOK_COMBATTURN, CombatTurn_Handler);
|
||||
register_hook_proc(HOOK_GAMEMODECHANGE, GameModeChange_Handler);
|
||||
register_hook_proc(HOOK_INVENTORYMOVE, InventoryMove_Handler);
|
||||
|
||||
+9
-10
@@ -18,45 +18,46 @@ variable translationIni;
|
||||
// Gets the integer value from the specified ini
|
||||
procedure GetIniConfig(variable section, variable key, variable def, variable inifile) begin
|
||||
variable val := get_ini_setting(inifile + "|" + section + "|" + key);
|
||||
if val == -1 then val := def;
|
||||
if (val == -1) then return def;
|
||||
return val;
|
||||
end
|
||||
|
||||
// Gets the string value from the specified ini
|
||||
procedure GetIniConfigStr(variable section, variable key, variable def, variable inifile) begin
|
||||
variable val := get_ini_string(inifile + "|" + section + "|" + key);
|
||||
if val == -1 orElse val == "" then val := def;
|
||||
if (val == -1 orElse val == "") then return def;
|
||||
return val;
|
||||
end
|
||||
|
||||
// Gets the integer value from sfall-mods.ini
|
||||
procedure GetConfig(variable section, variable key, variable def) begin
|
||||
variable val := get_ini_setting(ini + "|" + section + "|" + key);
|
||||
if val == -1 then val := def;
|
||||
if (val == -1) then return def;
|
||||
return val;
|
||||
end
|
||||
|
||||
// Gets the string value from sfall-mods.ini
|
||||
procedure GetConfigStr(variable section, variable key, variable def) begin
|
||||
variable val := get_ini_string(ini + "|" + section + "|" + key);
|
||||
if val == -1 orElse val == "" then val := def;
|
||||
if (val == -1 orElse val == "") then return def;
|
||||
return val;
|
||||
end
|
||||
|
||||
// Gets the value from sfall-mods.ini as a temp array of strings
|
||||
procedure GetConfigList(variable section, variable key) begin
|
||||
variable val := get_ini_string(ini + "|" + section + "|" + key);
|
||||
if val == -1 orElse val == "" then return [];
|
||||
if (val == -1 orElse val == "") then return [];
|
||||
|
||||
return string_split(val, ",");
|
||||
end
|
||||
|
||||
// Gets the value from sfall-mods.ini as a temp array of ints
|
||||
procedure GetConfigListInt(variable section, variable key) begin
|
||||
variable arr, i, item;
|
||||
variable arr, len, i, item;
|
||||
|
||||
arr := GetConfigList(section, key);
|
||||
for (i := 0; i < len_array(arr); i++) begin
|
||||
len = len_array(arr);
|
||||
for (i := 0; i < len; i++) begin
|
||||
arr[i] := atoi(arr[i]);
|
||||
end
|
||||
return arr;
|
||||
@@ -65,9 +66,7 @@ end
|
||||
// Translates given string using Translations.ini
|
||||
procedure Translate(variable id, variable def) begin
|
||||
variable str := get_ini_string(translationIni + "|Sfall|" + id);
|
||||
if (str == 0 orElse (strlen(str) == 0)) then begin
|
||||
str := def;
|
||||
end
|
||||
if (str == 0 orElse strlen(str) == 0) then return def;
|
||||
return str;
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user