Skip to content

Commit

Permalink
Add awareness expanded mod (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
phobos2077 committed Jul 6, 2024
1 parent 9d3972e commit 7b82919
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
12 changes: 12 additions & 0 deletions root/data/text/english/game/pbs_combat.msg
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@

# skill booster kits
{310}{}{ It has supplies for %d/%d uses.}

# armor awareness
{400}{}{His resistances are: }
{401}{}{Her resistances are: }
{402}{}{Its resistances are: }
{410}{}{%d/%d%% %s, }
{411}{}{%d AC.}
{420}{}{normal}
{421}{}{laser}
{422}{}{fire}
{423}{}{plasma}
{426}{}{explode}
12 changes: 12 additions & 0 deletions root/data/text/russian/game/pbs_combat.msg
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@

# skill booster kits
{310}{}{ ����� ���� ���� �����������(�) ��� %d/%d ���.}

# armor awareness
{400}{}{��� ������: }
{401}{}{Ÿ ������: }
{402}{}{��� ������: }
{410}{}{%d/%d%% %s, }
{411}{}{%d ��.}
{420}{}{����.}
{421}{}{���.}
{422}{}{��.}
{423}{}{����.}
{426}{}{���.}
5 changes: 5 additions & 0 deletions root/mods/ecco/misc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ remember_sneak=1
ensure_npcs_ammo=1


[AWARENESS]
; 1 to enable displaying extra info when examining critters while having awereness perk
display_extra_info=1


[TOWN_REP]
0=47 ; ARROYO
2=48 ; KLAMATH
Expand Down
63 changes: 63 additions & 0 deletions scripts_src/_pbs_main/gl_pbs_awareness_expanded.ssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* - Expands awareness perk effect by printing target's armor stats.
*/

#include "../sfall/command_lite.h"
#include "../sfall/define_lite.h"
#include "../sfall/define_extra.h"
#include "../sfall/sfall.h"

#define SCRIPT_REALNAME "pbs_awareness_expanded"

#include "../_pbs_headers/ecco_log.h"
#include "../_pbs_headers/ecco_ini.h"
#include "../_pbs_headers/ecco_msg.h"

/*
procedure description_hook begin
display_msg("desc "+obj_name(get_sfall_arg));
end
*/

#define critter_is_biped(cr) (proto_data(obj_pid(cr), cr_body_type) == CR_BODY_BIPED)

procedure mstr_dmg_resist(variable obj, variable dmgType) begin
variable
formatStr := mstr_ecco_combat(410),
dmgTypeStr := mstr_ecco_combat(420 + dmgType),
dt := get_critter_stat(obj, STAT_dmg_thresh + dmgType),
dr := get_critter_stat(obj, STAT_dmg_resist + dmgType);

return string_format(formatStr, dt, dr, dmgTypeStr);
end

procedure stdprocedure_end_hook begin
variable proc := get_sfall_arg, obj := get_sfall_arg;
if (proc == description_proc and obj != dude_obj and obj_type(obj) == OBJ_TYPE_CRITTER
and dude_perk(PERK_bonus_awareness) and not is_critter_dead(obj)) then begin
variable
//dmgType := obj_pid get_active_weapon(dude_obj)
ac := get_critter_stat(obj, STAT_ac),
msg := mstr_ecco_combat(400 + get_gender(obj) if critter_is_biped(obj) else 402)
+ mstr_dmg_resist(obj, DMG_normal_dam)
+ mstr_dmg_resist(obj, DMG_laser)
+ mstr_dmg_resist(obj, DMG_fire)
+ mstr_dmg_resist(obj, DMG_plasma)
+ mstr_dmg_resist(obj, DMG_explosion)
+ string_format(mstr_ecco_combat(411), ac);

display_msg(msg);
end
end

#define INI_FILE INI_MISC
#define INI_SECTION "AWARENESS"

procedure start begin
if not game_loaded then return;
if (not get_ini_value_def(INI_FILE, INI_SECTION, "display_extra_info", false)) then return;

register_hook_proc(HOOK_STDPROCEDURE_END, stdprocedure_end_hook);
//register_hook_proc(HOOK_DESCRIPTIONOBJ, description_hook);
end

0 comments on commit 7b82919

Please sign in to comment.