Skip to content

Commit

Permalink
Codestyle for color_defs. Fix crash when log userdata. Fix crash rela…
Browse files Browse the repository at this point in the history
…ted to artefact hunters and animaly evaluator. Corrected evaluator anomaly naming typo.
  • Loading branch information
Neloreck committed Sep 11, 2023
1 parent bca2717 commit 8f99c41
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/engine/core/objects/ai/types/motivator_evaluators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export enum EEvaluatorId {
COVER_REACHED = stalker_ids.property_cover_reached, // 43
LOOKED_AROUND = stalker_ids.property_looked_around, // 44
GRENADE_EXPLODED = stalker_ids.property_grenade_exploded, // 45
ANONALY = stalker_ids.property_anomaly, // 46
ANOMALY = stalker_ids.property_anomaly, // 46
INSIDE_ANONALY = stalker_ids.property_inside_anomaly, // 47
// ...
SCRIPT = stalker_ids.property_script, // 74
Expand Down
10 changes: 0 additions & 10 deletions src/engine/core/objects/binders/creature/StalkerBinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import {
LuabindClass,
object_binder,
patrol,
property_evaluator_const,
time_global,
} from "xray16";

import {
closeLoadMarker,
closeSaveMarker,
DUMMY_LTX,
getStoryIdByObjectId,
IBaseSchemeState,
IRegistryObjectState,
loadObjectLogic,
Expand Down Expand Up @@ -180,14 +178,6 @@ export class StalkerBinder extends object_binder {

GlobalSoundManager.initializeObjectSounds(this.object);

// todo: Separate place.
if (getStoryIdByObjectId(objectId) === "zat_b53_artefact_hunter_1") {
const actionPlanner: ActionPlanner = this.object.motivation_action_manager();

actionPlanner.remove_evaluator(EActionId.ANOMALY);
actionPlanner.add_evaluator(EActionId.ANOMALY, new property_evaluator_const(false));
}

SchemeReachTask.addReachTaskSchemeAction(this.object);

// todo: Why? Already same ref in parameter?
Expand Down
4 changes: 2 additions & 2 deletions src/engine/core/schemes/animpoint/SchemeAnimpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class SchemeAnimpoint extends AbstractScheme {

addCommonActionPreconditions(actionReachAnimpoint);
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.IS_ANIMPOINT_NEEDED, true));
actionReachAnimpoint.add_precondition(new world_property(EEvaluatorId.IS_ANIMPOINT_REACHED, false));
Expand All @@ -94,7 +94,7 @@ export class SchemeAnimpoint extends AbstractScheme {

addCommonActionPreconditions(actionAnimpoint);
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.IS_ANIMPOINT_NEEDED, true));
actionAnimpoint.add_precondition(new world_property(EEvaluatorId.IS_ANIMPOINT_REACHED, true));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/camper/SchemeCamper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SchemeCamper extends AbstractScheme {
actionPatrol.add_precondition(new world_property(EEvaluatorId.IS_CLOSE_COMBAT, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.CAN_FIGHT, true));
actionPatrol.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));

actionPatrol.add_precondition(new world_property(EEvaluatorId.IS_MEET_CONTACT, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED, false));
Expand Down
4 changes: 2 additions & 2 deletions src/engine/core/schemes/combat_camper/SchemeCombatCamper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class SchemeCombatCamper extends AbstractScheme {

shootAction.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
shootAction.add_precondition(new world_property(EEvaluatorId.ENEMY, true));
shootAction.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
shootAction.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
shootAction.add_precondition(new world_property(EEvaluatorId.IS_SCRIPTED_COMBAT, true));
shootAction.add_precondition(new world_property(EEvaluatorId.IS_COMBAT_CAMPING_ENABLED, true));
shootAction.add_precondition(new world_property(EEvaluatorId.SEE_BEST_ENEMY, true));
Expand All @@ -46,7 +46,7 @@ export class SchemeCombatCamper extends AbstractScheme {

const lookAroundAction: ActionLookAround = new ActionLookAround(state);

lookAroundAction.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
lookAroundAction.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
lookAroundAction.add_precondition(new world_property(EEvaluatorId.IS_SCRIPTED_COMBAT, true));
lookAroundAction.add_precondition(new world_property(EEvaluatorId.IS_COMBAT_CAMPING_ENABLED, true));
lookAroundAction.add_precondition(new world_property(EEvaluatorId.SEE_BEST_ENEMY, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SchemeCorpseDetection extends AbstractScheme {
action.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
action.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
action.add_precondition(new world_property(EEvaluatorId.DANGER, false));
action.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
action.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
action.add_precondition(new world_property(EEvaluatorId.IS_CORPSE_EXISTING, true));
action.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED_EXISTING, false));

Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/cover/SchemeCover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class SchemeCover extends AbstractScheme {
newAction.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
newAction.add_precondition(new world_property(EEvaluatorId.DANGER, false));
newAction.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
newAction.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
newAction.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
newAction.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED, false));
newAction.add_precondition(new world_property(EEvaluatorId.NEED_COVER, true));
// Mark as cover not needed anymore.
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/help_wounded/SchemeHelpWounded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SchemeHelpWounded extends AbstractScheme {
action.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
action.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
action.add_precondition(new world_property(EEvaluatorId.DANGER, false));
action.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
action.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
action.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED, false));
action.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED_EXISTING, true));

Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/meet/SchemeMeet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SchemeMeet extends AbstractScheme {
actionMeetWait.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionMeetWait.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionMeetWait.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionMeetWait.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionMeetWait.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionMeetWait.add_precondition(new world_property(EEvaluatorId.ITEMS, false));

actionMeetWait.add_precondition(new world_property(EEvaluatorId.IS_WOUNDED_EXISTING, false));
Expand Down
4 changes: 2 additions & 2 deletions src/engine/core/schemes/patrol/SchemePatrol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class SchemePatrol extends AbstractScheme {
actionCommander.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionCommander.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionCommander.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionCommander.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionCommander.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
addCommonActionPreconditions(actionCommander);
actionCommander.add_precondition(new world_property(EEvaluatorId.IS_PATROL_ENDED, false));
actionCommander.add_precondition(new world_property(EEvaluatorId.IS_PATROL_COMMANDER, true));
Expand All @@ -129,7 +129,7 @@ export class SchemePatrol extends AbstractScheme {
actionPatrol.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionPatrol.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
addCommonActionPreconditions(actionPatrol);
actionPatrol.add_precondition(new world_property(EEvaluatorId.IS_PATROL_ENDED, false));
actionPatrol.add_precondition(new world_property(EEvaluatorId.IS_PATROL_COMMANDER, false));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/remark/SchemeRemark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class SchemeRemark extends AbstractScheme {
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionRemarkActivity.add_precondition(new world_property(EEvaluatorId.NEED_REMARK, true));
addCommonActionPreconditions(actionRemarkActivity);
actionRemarkActivity.add_effect(new world_property(EEvaluatorId.NEED_REMARK, false));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/sleeper/SchemeSleeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class SchemeSleeper extends AbstractScheme {
actionSleeper.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionSleeper.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionSleeper.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionSleeper.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionSleeper.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionSleeper.add_precondition(new world_property(EEvaluatorId.NEED_SLEEPER, true));

addCommonActionPreconditions(actionSleeper);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/smartcover/SchemeSmartCover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class SchemeSmartCover extends AbstractScheme {
const actionSmartCoverActivity: ActionSmartCoverActivity = new ActionSmartCoverActivity(state);

actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.IS_SMART_COVER_NEEDED, true));
actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.CAN_USE_SMART_COVER_IN_COMBAT, false));
actionSmartCoverActivity.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/schemes/walker/SchemeWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class SchemeWalker extends AbstractScheme {
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.ALIVE, true));
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.DANGER, false));
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.ENEMY, false));
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.ANONALY, false));
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.ANOMALY, false));
actionWalkerActivity.add_precondition(new world_property(EEvaluatorId.NEED_WALKER, true));

addCommonActionPreconditions(actionWalkerActivity);
Expand Down
2 changes: 2 additions & 0 deletions src/engine/core/utils/logging/LuaLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export class LuaLogger {
args.set(index, it);
} else if (itType === "boolean") {
args.set(index, string.format("<boolean: %s>", it === true ? TRUE : FALSE));
} else if (itType === "userdata") {
args.set(index, "<userdata>");
} else {
args.set(index, string.format("<%s: %s>", itType, tostring(it)));
}
Expand Down
86 changes: 42 additions & 44 deletions src/engine/forms/color_defs.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
import { JSXNode, JSXXML } from "jsx-xml";

// todo: Use enum with defined colors.

/**
* Generate definitions of colors and related UI forms.
*
* For applying specified color insert %cColorName into the text.
* Use %cDEFAULT color when need to switch to default color of UI element.
*/
export function create(): JSXNode {
// <!-- For applying specified color insert "%cColorName" into the text -->
// <!-- Use "%cDEFAULT" color when need to switch to default color of UI element -->

return (
<colors>
<color name="red" r="255" g="0" b="0" />
<color name="green" r="0" g="255" b="0" />
<color name="blue" r="0" g="0" b="255" />
<color name="white" r="255" g="255" b="255" />
<color name="black" r="0" g="0" b="0" />
<color name="gray" r="128" g="128" b="128" />
<color name="light_gray" r="115" g="114" b="112" />
<color name="tut_gray" r="100" g="100" b="100" />
<color name="dark_gray" r="80" g="80" b="80" />
<color name="yellow" r="255" g="255" b="0" />

<color name="ui_red" r="255" g="0" b="0" />
<color name="ui_green" r="0" g="255" b="0" />
<color name="ui_blue" r="0" g="0" b="255" />
<color name="ui_white" r="255" g="255" b="255" />
<color name="ui_black" r="0" g="0" b="0" />
<color name="ui_gray" r="128" g="128" b="128" />
<color name="ui_yellow" r="255" g="255" b="0" />

<color name="ui_lime" r="135" g="183" b="116" />

<color name="ui_1" r="255" g="255" b="255" />
<color name="ui_2" r="255" g="232" b="208" />
<color name="ui_3" r="128" g="128" b="128" />
<color name="ui_4" r="189" g="189" b="224" />
<color name="ui_5" r="135" g="123" b="116" />
<color name="ui_6" r="240" g="217" b="182" />
<color name="ui_7" r="238" g="155" b="23" />
<color name="ui_8" r="216" g="186" b="140" />
<color name="ui_9" r="150" g="150" b="180" />
<color name="ui_10" r="225" g="225" b="250" />

<color name="ui_mm_font" r="41" g="27" b="16" />

<color name="pda_green" r="25" g="123" b="48" />
<color name="pda_yellow" r="248" g="148" b="29" />
<color name="pda_red" r="238" g="28" b="36" />
<color name="pda_blue" r="11" g="178" b="248" />
<color name="edit" r="207" g="155" b="80" />
<color name={"red"} r={255} g={0} b={0} />
<color name={"green"} r={0} g={255} b={0} />
<color name={"blue"} r={0} g={0} b={255} />
<color name={"white"} r={255} g={255} b={255} />
<color name={"black"} r={0} g={0} b={0} />
<color name={"gray"} r={128} g={128} b={128} />
<color name={"light_gray"} r={115} g={114} b={112} />
<color name={"tut_gray"} r={100} g={100} b={100} />
<color name={"dark_gray"} r={80} g={80} b={80} />
<color name={"yellow"} r={255} g={255} b={0} />

<color name={"ui_red"} r={255} g={0} b={0} />
<color name={"ui_green"} r={0} g={255} b={0} />
<color name={"ui_blue"} r={0} g={0} b={255} />
<color name={"ui_white"} r={255} g={255} b={255} />
<color name={"ui_black"} r={0} g={0} b={0} />
<color name={"ui_gray"} r={128} g={128} b={128} />
<color name={"ui_yellow"} r={255} g={255} b={0} />

<color name={"ui_lime"} r={135} g={183} b={116} />

<color name={"ui_1"} r={255} g={255} b={255} />
<color name={"ui_2"} r={255} g={232} b={208} />
<color name={"ui_3"} r={128} g={128} b={128} />
<color name={"ui_4"} r={189} g={189} b={224} />
<color name={"ui_5"} r={135} g={123} b={116} />
<color name={"ui_6"} r={240} g={217} b={182} />
<color name={"ui_7"} r={238} g={155} b={23} />
<color name={"ui_8"} r={216} g={186} b={140} />
<color name={"ui_9"} r={150} g={150} b={180} />
<color name={"ui_10"} r={225} g={225} b={250} />

<color name={"ui_mm_font"} r={41} g={27} b={16} />

<color name={"pda_green"} r={25} g={123} b={48} />
<color name={"pda_yellow"} r={248} g={148} b={29} />
<color name={"pda_red"} r={238} g={28} b={36} />
<color name={"pda_blue"} r={11} g={178} b={248} />
<color name={"edit"} r={207} g={155} b={80} />
</colors>
);
}
2 changes: 2 additions & 0 deletions src/engine/scripts/declarations/callbacks/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ extern("pda", {
actor_menu_mode: (...args: AnyArgs): void => {
logger.info("Pda actor menu mode changed:", ...args);
},
// todo: m_UIPropertiesBox, m_cur_location
property_box_clicked: (...args: AnyArgs): void => {
logger.info("Pda box property clicked");
},
// todo: m_UIPropertiesBox, m_cur_location->ObjectID(), (LPCSTR)m_cur_location->GetLevelName().c_str(), m_cur_location
property_box_add_properties: (...args: AnyArgs): void => {
logger.info("Pda box property added:", ...args);
},
Expand Down

0 comments on commit 8f99c41

Please sign in to comment.