Skip to content

Commit 17ad6ed

Browse files
author
rifleman17
committed
Исправления мелких ошибок в скриптах
1 parent 1a262f6 commit 17ad6ed

17 files changed

Lines changed: 116 additions & 44 deletions

Gui/GlobalMap.fogui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
"IsVerticalScroll": false,
601601
"IsHorizontalScroll": false,
602602
"Expanded": false,
603-
"Selected": true,
603+
"Selected": false,
604604
"Active": true,
605605
"Name": "GMOverlay",
606606
"Position": "0, 0",
@@ -1116,7 +1116,7 @@
11161116
"IsVerticalScroll": false,
11171117
"IsHorizontalScroll": false,
11181118
"Expanded": false,
1119-
"Selected": false,
1119+
"Selected": true,
11201120
"Active": true,
11211121
"Name": "TimePanel",
11221122
"Position": "640, 4",
@@ -1762,7 +1762,7 @@
17621762
"IsDisabled": false,
17631763
"PressedImage": "art/intrface/smallbutton_on.png",
17641764
"PressedImageLayout": "None",
1765-
"HoverImage": "art/intrface/smallbutton_on.png",
1765+
"HoverImage": "",
17661766
"HoverImageLayout": "None",
17671767
"DisabledImage": "",
17681768
"DisabledImageLayout": "None",

Items/Custom/exit_grid.foitem

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ IsShootThru = True
55
IsLightThru = True
66
Type = Grid
77
IsStatic = True
8+
IsTrigger = True
89
IsScenery = True
910
DisableEgg = True
1011
MultihexGeneration = AnyUnique

Scripts/Behemoth.fos

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,12 @@ bool _BehemothAttacked(Critter cr, Critter attacker)
381381
attackerName = PlayerRegistration::GetPlayerName(attacker.Id);
382382
}
383383
else {
384-
attackerName = "@text Dialogs " + STR_NPC_NAME(attacker.DialogId, attacker.ProtoId) + "@";
384+
if (attacker.DialogId == EMPTY_HSTRING) {
385+
attackerName = "@text Critters " + STR_NPC_PROTO_NAME(attacker.ProtoId) + "@";
386+
}
387+
else {
388+
attackerName = "@text Dialogs " + STR_NPC_NAME_DLG(attacker.DialogId) + "@";
389+
}
385390
}
386391
Radio::SendChannelRadioMessage(cr.BehemothRadio, TextPackName::Text, 610, "$pname" + attackerName);
387392
}

Scripts/ClientMain.fos

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,12 +1059,12 @@ string critter_description(Critter& cr, CritterLookTypes lookType)
10591059
bool defaultText = false;
10601060

10611061
if (lookType == CritterLookTypes::OnlyName) {
1062-
result = Game.GetText(TextPackName::Dialogs, STR_NPC_NAME(dlgId, npcPid));
1062+
result = MsgStr::NpcName(dlgId, npcPid);
10631063
}
10641064
// Short info
10651065
else if (lookType == CritterLookTypes::LookShort) {
10661066
if (cr.IsAlive() && Game.IsTextPresent(TextPackName::Dialogs, STR_NPC_INFO_LIFE(dlgId, npcPid))) {
1067-
result += Game.GetText(TextPackName::Dialogs, STR_NPC_INFO_LIFE(dlgId, npcPid));
1067+
result += MsgStr::NpcDesc(dlgId, npcPid);
10681068
}
10691069
else if (cr.IsKnockout() && Game.IsTextPresent(TextPackName::Dialogs, STR_NPC_INFO_KO(dlgId, npcPid))) {
10701070
result += Game.GetText(TextPackName::Dialogs, STR_NPC_INFO_KO(dlgId, npcPid));
@@ -1078,8 +1078,8 @@ string critter_description(Critter& cr, CritterLookTypes lookType)
10781078
}
10791079
// Full info
10801080
else {
1081-
if (cr.IsAlive() && Game.IsTextPresent(TextPackName::Dialogs, STR_NPC_FULL_INFO_LIFE(dlgId, npcPid))) {
1082-
result += Game.GetText(TextPackName::Dialogs, STR_NPC_FULL_INFO_LIFE(dlgId, npcPid));
1081+
if (cr.IsAlive()) {
1082+
result += MsgStr::NpcDesc(dlgId, npcPid);
10831083
}
10841084
else if (cr.IsKnockout() && Game.IsTextPresent(TextPackName::Dialogs, STR_NPC_FULL_INFO_KO(dlgId, npcPid))) {
10851085
result += Game.GetText(TextPackName::Dialogs, STR_NPC_FULL_INFO_KO(dlgId, npcPid));
@@ -1094,21 +1094,15 @@ string critter_description(Critter& cr, CritterLookTypes lookType)
10941094

10951095
if (defaultText) {
10961096
// Check standart text
1097-
if (Game.IsTextPresent(TextPackName::Dialogs, STR_NPC_NAME(dlgId, npcPid))) {
1097+
if (MsgStr::NpcName(dlgId, npcPid) != "") {
10981098
if (cr.IsAlive()) {
1099-
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookLife),
1100-
"NAME",
1101-
Game.GetText(TextPackName::Dialogs, STR_NPC_NAME(dlgId, npcPid)));
1099+
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookLife), "NAME", MsgStr::NpcName(dlgId, npcPid));
11021100
}
11031101
else if (cr.IsKnockout()) {
1104-
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookKo),
1105-
"NAME",
1106-
Game.GetText(TextPackName::Dialogs, STR_NPC_NAME(dlgId, npcPid)));
1102+
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookKo), "NAME", MsgStr::NpcName(dlgId, npcPid));
11071103
}
11081104
else if (cr.IsDead()) {
1109-
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookDead),
1110-
"NAME",
1111-
Game.GetText(TextPackName::Dialogs, STR_NPC_NAME(dlgId, npcPid)));
1105+
result += Game.ReplaceText(Game.GetText(TextPackName::Game, MsgStr::StrCritLookDead), "NAME", MsgStr::NpcName(dlgId, npcPid));
11121106
}
11131107
}
11141108
// Set default text
@@ -1287,13 +1281,13 @@ void critter_action(bool localCall, Critter cr, CritterAction action, int action
12871281
cr.Animate(CritterStateAnim::None, CritterActionAnim::PrepareWeapon);
12881282

12891283
Effects::PlayWeaponSound(SOUND_WEAPON_USE, _WeaponSoundId(proto, use), use != 1 ? '1' : '2');
1290-
cr.Animate(CritterStateAnim::None, _WeaponActionAnim(proto, use), item);
1284+
cr.Animate(CritterStateAnim::None, _WeaponActionAnim(proto, use), item, true);
12911285

12921286
if (fail) {
12931287
cr.Animate(CritterStateAnim::None, CritterActionAnim::DamageFront, item);
12941288
}
12951289
else {
1296-
cr.Animate(CritterStateAnim::None, CritterActionAnim::TurnOffWeapon);
1290+
cr.Animate(CritterStateAnim::None, CritterActionAnim::TurnOffWeapon, item, true);
12971291
}
12981292
}
12991293
break;

Scripts/Combat.fos

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,13 +2242,15 @@ void CriticalFailure(Critter cr, AbstractItem weap, int weaponUse, ProtoItem amm
22422242
tookDamage = true;
22432243
}
22442244

2245-
int ammoRound = _WeaponRound(weapon, weaponUse);
2246-
if (ammoRound > 0 && valid(realWeapon) && !cr.IsUnlimitedAmmo) {
2247-
if (realWeapon.AmmoCount <= ammoRound || FLAG(eff, MF_LOST_REST_OF_AMMO)) {
2248-
realWeapon.AmmoCount = 0;
2249-
}
2250-
else {
2251-
realWeapon.AmmoCount -= ammoRound;
2245+
if (valid(realWeapon)) {
2246+
int ammoRound = _WeaponRound(weapon, weaponUse);
2247+
if (ammoRound > 0 && !cr.IsUnlimitedAmmo) {
2248+
if (realWeapon.AmmoCount <= ammoRound || FLAG(eff, MF_LOST_REST_OF_AMMO)) {
2249+
realWeapon.AmmoCount = 0;
2250+
}
2251+
else {
2252+
realWeapon.AmmoCount -= ammoRound;
2253+
}
22522254
}
22532255
}
22542256

Scripts/FighterQuest.fos

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ class FighterQuest
134134

135135
npc.TeamId = TeamIdFight;
136136
NpcPlanes::AddAttackPlane(npc, FightPriority, player, MinHp);
137-
string lex = "$npcname@text Dialogs " + STR_NPC_NAME(npc.DialogId, npc.ProtoId) + "@";
137+
string lex;
138+
if (npc.DialogId == EMPTY_HSTRING) {
139+
lex = "$npcname@text Critters " + STR_NPC_PROTO_NAME(npc.ProtoId) + "@";
140+
}
141+
else {
142+
lex = "$npcname@text Dialogs " + STR_NPC_NAME_DLG(npc.DialogId) + "@";
143+
}
138144
Messaging::Info(player, TextPackName::Text, STR_FIGHT_BEGIN, lex);
139145
}
140146

@@ -155,9 +161,15 @@ class FighterQuest
155161
if (PlayerId != ZERO_IDENT) {
156162
string lex = "$npcname ";
157163
Critter npc = Game.GetCritter(NpcId);
158-
if (valid(npc) && npc.DialogId != EMPTY_HSTRING) {
159-
lex = "$npcname@text Dialogs " + STR_NPC_NAME(npc.DialogId, npc.ProtoId) + "@";
164+
if (valid(npc)) {
165+
if (npc.DialogId == EMPTY_HSTRING) {
166+
lex = "$npcname@text Critters " + STR_NPC_PROTO_NAME(npc.ProtoId) + "@";
167+
}
168+
else {
169+
lex = "$npcname@text Dialogs " + STR_NPC_NAME_DLG(npc.DialogId) + "@";
170+
}
160171
}
172+
161173
Critter cr = Game.GetCritter(PlayerId);
162174
if (valid(cr)) {
163175
cr.SetAsInt(VarNum, STATUS_WIN);
@@ -178,11 +190,15 @@ class FighterQuest
178190
{
179191
DL("player loose called");
180192
if (PlayerId != ZERO_IDENT) {
181-
DL("var passed");
182193
string lex = "$npcname a";
183194
Critter npc = Game.GetCritter(NpcId);
184-
if (valid(npc) && npc.DialogId != EMPTY_HSTRING) {
185-
lex = "$npcname@text Dialogs " + STR_NPC_NAME(npc.DialogId, npc.ProtoId) + "@";
195+
if (valid(npc)) {
196+
if (npc.DialogId == EMPTY_HSTRING) {
197+
lex = "$npcname@text Critters " + STR_NPC_PROTO_NAME(npc.ProtoId) + "@";
198+
}
199+
else {
200+
lex = "$npcname@text Dialogs " + STR_NPC_NAME_DLG(npc.DialogId) + "@";
201+
}
186202
}
187203
DL(lex);
188204
Critter cr = Game.GetCritter(PlayerId);

Scripts/GuiScreens.fos

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4473,7 +4473,6 @@ namespace GlobalMap
44734473
SetPosition(7, 7);
44744474
SetSize(15, 16);
44754475
SetPressedImage("art/intrface/smallbutton_on.png");
4476-
SetHoverImage("art/intrface/smallbutton_on.png");
44774476
}
44784477

44794478
void OnLMouseClick() override

Scripts/ItemMovement.fos

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ void OnCritterItemMoved(Critter cr, Item item, CritterItemSlot fromSlot)
130130
cr.CurrentArmorPerk = toSlot == CritterItemSlot::Armor ? item.Armor_Perk : 0;
131131
}
132132

133+
if (item.Type == ItemType::Weapon && fromSlot == CritterItemSlot::Outside) {
134+
if (item.Weapon_MaxAmmoCount > 0 && item.AmmoCount == 0) {
135+
if (item.AmmoPid == EMPTY_HSTRING) {
136+
item.AmmoPid = item.Weapon_DefaultAmmoPid;
137+
}
138+
item.AmmoCount = item.Weapon_MaxAmmoCount;
139+
}
140+
}
133141
// Todo: Slot modifiers, Armor_Perk
134142
// SLOT_PERK_MIRROR_SHADES // +1 charisma
135143
// SLOT_PERK_COSMETIC_CASE // +1 charisma to female

Scripts/Location.fos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ bool IsKnownLoc(Critter cr, hstring locPid)
125125
// Делает локацию видимой для криттера.
126126
void SetKnownLoc(Critter cr, ident locId)
127127
{
128-
if (locId == ZERO_IDENT) {
128+
if (locId == ZERO_IDENT || IsKnownLoc(cr, locId)) {
129129
return;
130130
}
131131

Scripts/MsgStr.fos

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ const int StrGameCredits = 2000001010;
643643

644644
#define STR_NPC_PROTO_NAME #(pid)(CRSTR(pid, 0))
645645
#define STR_NPC_PROTO_DESC #(pid)(CRSTR(pid, hstring("Desc").uhash))
646-
#define STR_NPC_NAME #(dlg, pid)((dlg.hash) != 0 ? (dlg.hash) + 10 : STR_NPC_PROTO_NAME(pid))
647646
#define STR_NPC_NAME_DLG #(dlg)((dlg.hash) + 10)
648647
#define STR_NPC_AVATAR #(dlg)((dlg.hash) != 0 ? (dlg.hash) + 11 : 0)
649648
#define STR_NPC_INFO_LIFE #(dlg, pid)((dlg.hash) != 0 ? (dlg.hash) + 20 : STR_NPC_PROTO_DESC(pid))
@@ -706,5 +705,25 @@ const int StrCombatNeedDmgArm = 106;
706705
// ***************************************************************************************
707706
// ***************************************************************************************
708707
// ***************************************************************************************
708+
#if CLIENT
709+
string NpcName(hstring dlg, hstring pid)
710+
{
711+
if (dlg != EMPTY_HSTRING && Game.IsTextPresent(TextPackName::Dialogs, dlg.uhash + 10)) {
712+
return Game.GetText(TextPackName::Dialogs, dlg.uhash + 10);
713+
}
714+
else {
715+
return Game.GetText(TextPackName::Critters, pid.uhash);
716+
}
717+
}
709718

719+
string NpcDesc(hstring dlg, hstring pid)
720+
{
721+
if (dlg != EMPTY_HSTRING && Game.IsTextPresent(TextPackName::Dialogs, dlg.uhash + 21)) {
722+
return Game.GetText(TextPackName::Dialogs, dlg.uhash + 21);
723+
}
724+
else {
725+
return Game.GetText(TextPackName::Critters, pid.uhash + hstring("Desc").uhash);
726+
}
727+
}
728+
#endif
710729
}

0 commit comments

Comments
 (0)