mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the display after switching back in NPC combat control mod
* player's active "sneak" notification box wasn't shown when switching back after the combat. Replaced numbers with defines in item highlighting mod.
This commit is contained in:
@@ -9,13 +9,13 @@ Containers=0
|
||||
; Set to 1 to also highlight lootable corpses
|
||||
Corpses=0
|
||||
|
||||
; Set to 1 to also highlight critters
|
||||
; Set to 1 to also highlight critters, with the same rules as in combat
|
||||
Critters=0
|
||||
|
||||
; Set to 1 to only highlight objects in the player's line-of-sight
|
||||
CheckLOS=1
|
||||
|
||||
; Set the color of outlines for items, corpses and containers, available colors:
|
||||
; Set the color of outlines for items, corpses, and containers; available colors:
|
||||
; 1 - glowing red
|
||||
; 2 - red
|
||||
; 4 - grey
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
|
||||
Item Highlight mod.
|
||||
Item Highlight mod
|
||||
|
||||
Previously was part of sfall itself, now a separate mod.
|
||||
Features:
|
||||
- highlighting items, containers (optional) and lootable corpses (optional) on the ground
|
||||
- highlighting of critters using the same rules as combat mode highlighting (optional)
|
||||
- highlighting critters using the same rules as combat mode highlighting (optional)
|
||||
- configurable hotkey is used to trigger highlight
|
||||
- hotkey can be pressed and hold to continously update highlighted objects based on current position
|
||||
- hotkey can be pressed and held to continuously update highlighted objects based on current position
|
||||
- only objects in direct line-of-sight of player are highlighted (optional)
|
||||
- motion scanner is required to enable highlight (optional)
|
||||
- motion scanner charges are decreased on each use (optional)
|
||||
@@ -55,12 +55,12 @@ end
|
||||
|
||||
procedure GetOutlineColor(variable obj, variable isCritter) begin
|
||||
if isCritter then begin
|
||||
if get_team(obj) == get_team(dude_obj) then return 8;
|
||||
if get_team(obj) == get_team(dude_obj) then return OUTLINE_GREEN_GLOW;
|
||||
if not DudeCanSee(obj) then begin
|
||||
if (DudeCanHear(obj)) then return 32;
|
||||
if (DudeCanHear(obj)) then return OUTLINE_DARK_YELLOW;
|
||||
return 0;
|
||||
end
|
||||
return 1;
|
||||
return OUTLINE_RED_GLOW;
|
||||
end
|
||||
if checkLOS and not DudeCanSee(obj) then
|
||||
return 0;
|
||||
@@ -106,7 +106,7 @@ procedure KeyPressHandler begin
|
||||
|
||||
if scanCode == highlightKey and not(get_game_mode bwand (INTFACELOOT bwor BARTER)) then begin
|
||||
if pressed then begin
|
||||
set_global_script_repeat(10);
|
||||
set_global_script_repeat(REPEAT_FRAMES);
|
||||
if motionScanner then begin
|
||||
scanner := obj_carrying_pid_obj(dude_obj, PID_MOTION_SENSOR);
|
||||
if scanner then begin
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
#include "..\headers\critrpid.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUGMSG(x)
|
||||
#else
|
||||
#define DEBUGMSG(x) debug_msg(x);
|
||||
#endif
|
||||
|
||||
procedure start;
|
||||
procedure AllowControl(variable pid);
|
||||
procedure SetLight(variable critter, variable int, variable dist);
|
||||
@@ -48,25 +54,29 @@ procedure CombatTurn_Handler begin
|
||||
critter := get_sfall_arg,
|
||||
pid, perkID, level;
|
||||
|
||||
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + "/" + critter + ", arg3: " + get_sfall_arg);
|
||||
DEBUGMSG("Combat Turn: " + status + ", by " + obj_name(critter) + "/" + critter + ", arg3: " + get_sfall_arg)
|
||||
|
||||
pid := obj_pid(critter);
|
||||
if (pid == PID_PLAYER and inControl == false) then return;
|
||||
|
||||
if (pid != PID_PLAYER and controlMode != 1 and AllowControl(pid) == false) then begin
|
||||
DEBUGMSG("Skip control.")
|
||||
|
||||
if (npcControl) then begin
|
||||
npcControl := 0;
|
||||
set_dude_obj(real_dude_obj);
|
||||
call SetLight(dude_obj, dudeLightInt, dudeLightDist); // restore dude light
|
||||
//move_to(dude_obj, dude_tile, dude_elevation);
|
||||
intface_redraw;
|
||||
move_to(dude_obj, dude_tile, dude_elevation);
|
||||
|
||||
DEBUGMSG("Set dude after NPC control.")
|
||||
end
|
||||
//display_msg("Skip control.");
|
||||
return;
|
||||
end
|
||||
|
||||
if (status == 1) then begin
|
||||
set_dude_obj(critter);
|
||||
//display_msg("Take control of: " + obj_name(critter));
|
||||
|
||||
DEBUGMSG("Take control of: " + obj_name(critter))
|
||||
|
||||
if (critter != real_dude_obj) then begin
|
||||
if (npcControl == 0) then begin
|
||||
@@ -118,13 +128,11 @@ 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);
|
||||
if (level) then critter_rm_trait(critter, TRAIT_PERK, perkID, level);
|
||||
end
|
||||
|
||||
if (status == 0) then set_dude_obj(0); // w/o redraw interface bar (otherwise it flickers when switching from the player to NPCs)
|
||||
//display_msg("Return control to real dude!");
|
||||
end
|
||||
|
||||
if (status < 0) then begin
|
||||
@@ -175,11 +183,8 @@ procedure SetGlobalVar_Handler begin
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
if (game_loaded and sfall_ver_major >= 4) then begin
|
||||
//variable configSection := "CombatControl";
|
||||
|
||||
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
|
||||
if game_loaded then begin
|
||||
if (sfall_ver_major < 4) then return;
|
||||
|
||||
controlMode := GetConfig("CombatControl", "Mode", 0);
|
||||
if (controlMode >= 3) then begin
|
||||
@@ -206,6 +211,9 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user