Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explosives - Add bury/unbury mine actions #156

Open
wants to merge 2 commits into
base: experimental
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions addons/core/Configs/ACE/ACE_SurfaceLabels.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ACE_SurfaceLabelsConfig {
m_aEntries {
ACE_SurfaceLabelConfigEntry "{6494FEBC9AF3C9AC}" {
m_eLabel DIGGABLE
m_aPhysMatResNames {
"{99CE88C5B1865216}Common/Materials/Physics/dirt.physmat"
"{2B4B89135A4F0637}Common/Materials/Physics/grass.physmat"
"{8AEE78000E7E1346}Common/Materials/Physics/gravel.physmat"
"{C2004DDEB7A62E05}Common/Materials/Physics/sand.physmat"
"{EFF6CC81E77B1860}Common/Materials/Physics/snow.physmat"
"{B0F2C4F345C4894C}Common/Materials/Physics/soil.physmat"
}
}
}
}
17 changes: 17 additions & 0 deletions addons/core/Configs/ACE/ACE_SurfaceLabels.conf.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MetaFileClass {
Name "{4E2AF3E9D54A29B4}Configs/ACE/ACE_SurfaceTypes.conf"
Configurations {
CONFResourceClass PC {
}
CONFResourceClass XBOX_ONE : PC {
}
CONFResourceClass XBOX_SERIES : PC {
}
CONFResourceClass PS4 : PC {
}
CONFResourceClass PS5 : PC {
}
CONFResourceClass HEADLESS : PC {
}
}
}
53 changes: 53 additions & 0 deletions addons/core/scripts/Game/ACE_Core/Configs/ACE_SurfaceTypesConfig.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//----------------------------------------------------------------------------------------
[BaseContainerProps(configRoot: true)]
class ACE_SurfaceLabelsConfig
{
[Attribute(desc: "Registered surface labels")]
protected ref array<ref ACE_SurfaceLabelConfigEntry> m_aEntries;

//----------------------------------------------------------------------------------------
bool HasLabel(BaseContainer gameMatContainer, ACE_ESurfaceLabel label)
{
foreach (ACE_SurfaceLabelConfigEntry entry : m_aEntries)
{
if (label != entry.GetLabel())
continue;

return entry.HasLabel(gameMatContainer);
}

return false;
}
}

//----------------------------------------------------------------------------------------
[BaseContainerProps(), SCR_BaseContainerCustomTitleEnum(ACE_ESurfaceLabel, "m_eLabel")]
class ACE_SurfaceLabelConfigEntry
{
[Attribute(uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(ACE_ESurfaceLabel), desc: "A property label for surfaces")]
protected ACE_ESurfaceLabel m_eLabel;

[Attribute(desc: "Physical materials that have this label", uiwidget: UIWidgets.ResourceNamePicker, params: "physmat")]
protected ref array<ResourceName> m_aPhysMatResNames;

//----------------------------------------------------------------------------------------
ACE_ESurfaceLabel GetLabel()
{
return m_eLabel;
}

//----------------------------------------------------------------------------------------
bool HasLabel(BaseContainer gameMatContainer)
{
ResourceName resName;
gameMatContainer.Get("Physics material", resName);

foreach (ResourceName whitelistedResName : m_aPhysMatResNames)
{
if (whitelistedResName == resName)
return true;
}

return false;
}
}
6 changes: 6 additions & 0 deletions addons/core/scripts/Game/ACE_Core/Global/ACE_ESurfaceLabel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//----------------------------------------------------------------------------------------
enum ACE_ESurfaceLabel
{
NONE,
DIGGABLE
}
22 changes: 22 additions & 0 deletions addons/core/scripts/Game/ACE_Core/Global/ACE_SurfaceHelper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------------------------
class ACE_SurfaceHelper
{
protected static ref ACE_SurfaceLabelsConfig s_SurfaceLabelsConfig;
protected static const ResourceName SURFACE_LABELS_CONFIG_NAME = "{4E2AF3E9D54A29B4}Configs/ACE/ACE_SurfaceLabels.conf";

//------------------------------------------------------------------------------------------------
protected static void Init()
{
s_SurfaceLabelsConfig = SCR_ConfigHelperT<ACE_SurfaceLabelsConfig>.GetConfigObject(SURFACE_LABELS_CONFIG_NAME);
}

//------------------------------------------------------------------------------------------------
//! Returns true when the surface has the given label
static bool HasLabel(notnull SurfaceProperties props, ACE_ESurfaceLabel label)
{
if (!s_SurfaceLabelsConfig)
Init();

return s_SurfaceLabelsConfig.HasLabel(props, label);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class ACE_GadgetUserAction : ScriptedUserAction

//------------------------------------------------------------------------------------------------
//! Stop animation when action is completed
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
{
super.PerformAction(pOwnerEntity, pUserEntity);
CancelPlayerAnimation(pUserEntity);
}

Expand All @@ -34,7 +35,7 @@ class ACE_GadgetUserAction : ScriptedUserAction
params.SetAllowMovementDuringAction(false);
params.SetKeepInHandAfterSuccess(true);
params.SetCommandID(itemActionId);
params.SetCommandIntArg(m_iAnimationIndex);
params.SetCommandIntArg(GetAnimationIndex());

charController.TryUseItemOverrideParams(params);
}
Expand All @@ -47,20 +48,7 @@ class ACE_GadgetUserAction : ScriptedUserAction
override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
{
super.OnActionCanceled(pOwnerEntity, pUserEntity);

ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
if (!character)
return;

CharacterControllerComponent charController = character.GetCharacterController();
if (charController)
{
CharacterAnimationComponent pAnimationComponent = charController.GetAnimationComponent();
int itemActionId = pAnimationComponent.BindCommand("CMD_Item_Action");
CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(pAnimationComponent.GetCommandHandler());
if (cmdHandler)
cmdHandler.FinishItemUse(true);
}
CancelPlayerAnimation(pUserEntity);
}

//------------------------------------------------------------------------------------------------
Expand All @@ -75,12 +63,15 @@ class ACE_GadgetUserAction : ScriptedUserAction
return;

CharacterControllerComponent charController = character.GetCharacterController();
if (charController)
{
CharacterAnimationComponent pAnimationComponent = charController.GetAnimationComponent();
CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(pAnimationComponent.GetCommandHandler());
if (!charController)
return;
CharacterAnimationComponent animationComponent = charController.GetAnimationComponent();
if (!animationComponent)
return;

CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(animationComponent.GetCommandHandler());
if (cmdHandler)
cmdHandler.FinishItemUse(true);
}
}

//------------------------------------------------------------------------------------------------
Expand All @@ -94,6 +85,12 @@ class ACE_GadgetUserAction : ScriptedUserAction
return gadgetManager.GetHeldGadget();
}

//------------------------------------------------------------------------------------------------
int GetAnimationIndex()
{
return m_iAnimationIndex;
}

//------------------------------------------------------------------------------------------------
//! Destructor - End Gadget animation
void ~ACE_GadgetUserAction()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions addons/explosives/Language/ACE_Explosives_Localization.cs_cz.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
StringTableRuntime {
Ids {
"ACE-Explosives_FailReason_Buried"
"ACE-Explosives_FailReason_HardSurface"
"ACE-Explosives_UserAction_Bury_Name"
"ACE-Explosives_UserAction_Disarm_Name"
"ACE-Explosives_UserAction_Unbury_Name"
}
Texts {
"Buried"
"Hard surface"
"Bury"
"Disarm"
"Unbury"
}
}
14 changes: 14 additions & 0 deletions addons/explosives/Language/ACE_Explosives_Localization.de_de.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
StringTableRuntime {
Ids {
"ACE-Explosives_FailReason_Buried"
"ACE-Explosives_FailReason_HardSurface"
"ACE-Explosives_UserAction_Bury_Name"
"ACE-Explosives_UserAction_Disarm_Name"
"ACE-Explosives_UserAction_Unbury_Name"
}
Texts {
"Eingegraben"
"Harte Oberfläche"
"Eingraben"
"Entschärfen"
"Ausgraben"
}
}
14 changes: 14 additions & 0 deletions addons/explosives/Language/ACE_Explosives_Localization.en_us.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
StringTableRuntime {
Ids {
"ACE-Explosives_FailReason_Buried"
"ACE-Explosives_FailReason_HardSurface"
"ACE-Explosives_UserAction_Bury_Name"
"ACE-Explosives_UserAction_Disarm_Name"
"ACE-Explosives_UserAction_Unbury_Name"
}
Texts {
"Buried"
"Hard surface"
"Bury"
"Disarm"
"Unbury"
}
}
14 changes: 14 additions & 0 deletions addons/explosives/Language/ACE_Explosives_Localization.es_es.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
StringTableRuntime {
Ids {
"ACE-Explosives_FailReason_Buried"
"ACE-Explosives_FailReason_HardSurface"
"ACE-Explosives_UserAction_Bury_Name"
"ACE-Explosives_UserAction_Disarm_Name"
"ACE-Explosives_UserAction_Unbury_Name"
}
Texts {
"Buried"
"Hard surface"
"Bury"
"Disarm"
"Unbury"
}
}
Loading