-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Demining Action for Landmines Adds a Shovel prompt to disassemble landmines placed by players. Also makes landmines immune to Gunfire, in favor of this new change. * Update - Minor Tweaks Tweaked the UserActions to appropriately reflect the new Class Tweaked the Radius of the Action Moved "HasLocalEffectOnlyScript" to Chopping_UserAction from ShovelDestroyUserAction * String table String Table and Localization addition for the Mine Disarming action * Minor Script Optimizations Removed some unnecessary lines from each Script * Update AUTHORS Added my name to the list of Authors * Create explosives.mdx Add Documentation * Create ACE_WrenchDestroyUserAction.c * Built String Table * Added ACE_GadgetUserAction Changed ShovelDestroyUserAction to ShovelUserAction Changed WrenchDestroyUserAction to WrenchUserAction * Updated Documentation * Removed unnecessary Script * Optimized Prefabs and Intarg params * Refactor code * Revise disarming * Rename localization files and add German translation * Rename localization key * Update AUTHORS Alphabetic order * Update explosives.mdx Fix capitalization * Only show action for activated mines * Add license and thumbnail * Change mod title --------- Co-authored-by: Kex <[email protected]>
- Loading branch information
1 parent
f1f0cd9
commit 2213241
Showing
56 changed files
with
776 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ OverlordZorn | |
PuFu | ||
Skamdrept | ||
Smith <[email protected]> | ||
TraceSnowOwl | ||
Zelik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ ACE_Chopping_HelperEntity { | |
} | ||
UIInfo UIInfo "{611A26EA9DC95817}" { | ||
} | ||
m_iAnimationIndex 2 | ||
} | ||
} | ||
} | ||
|
173 changes: 27 additions & 146 deletions
173
addons/chopping/scripts/Game/ACE_Chopping/UserActions/ACE_Chopping_UserAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,150 +1,31 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Tree deletion user action | ||
class ACE_Chopping_UserAction : ScriptedUserAction | ||
class ACE_Chopping_UserAction : ACE_ShovelUserAction | ||
{ | ||
protected SCR_GadgetManagerComponent m_GadgetManager; | ||
protected IEntity m_pUser; | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Request deletion of the tree | ||
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity) | ||
{ | ||
SCR_PlayerController userCtrl = SCR_PlayerController.Cast(GetGame().GetPlayerController()); | ||
if (!userCtrl) | ||
return; | ||
|
||
ACE_Chopping_HelperEntity helper = ACE_Chopping_HelperEntity.Cast(GetOwner()); | ||
if (!helper) | ||
return; | ||
|
||
IEntity plant = helper.GetAssociatedPlant(); | ||
if (!plant) | ||
return; | ||
|
||
userCtrl.ACE_DeleteEntityAtPosition(plant.GetOrigin()); | ||
SCR_EntityHelper.DeleteEntityAndChildren(helper); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Start E-tool animation | ||
override void OnActionStart(IEntity pUserEntity) | ||
{ | ||
super.OnActionStart(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"); | ||
ItemUseParameters params = new ItemUseParameters(); | ||
params.SetEntity(GetBuildingTool(pUserEntity)); | ||
params.SetAllowMovementDuringAction(false); | ||
params.SetKeepInHandAfterSuccess(true); | ||
params.SetCommandID(itemActionId); | ||
params.SetCommandIntArg(2); | ||
|
||
charController.TryUseItemOverrideParams(params); | ||
} | ||
|
||
m_pUser = pUserEntity; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! End E-tool animation | ||
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(); | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! End E-tool animation | ||
void CancelPlayerAnimation(IEntity entity) | ||
{ | ||
if (!entity) | ||
return; | ||
|
||
ChimeraCharacter character = ChimeraCharacter.Cast(entity); | ||
if (!character) | ||
return; | ||
|
||
CharacterControllerComponent charController = character.GetCharacterController(); | ||
if (charController) | ||
{ | ||
CharacterAnimationComponent pAnimationComponent = charController.GetAnimationComponent(); | ||
CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(pAnimationComponent.GetCommandHandler()); | ||
cmdHandler.FinishItemUse(); | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Get building tool entity | ||
IEntity GetBuildingTool(notnull IEntity ent) | ||
{ | ||
SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.GetGadgetManager(ent); | ||
if (!gadgetManager) | ||
return null; | ||
|
||
return gadgetManager.GetHeldGadget(); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Sets a new gadget manager. Controlled by an event when the controlled entity has changed. | ||
void SetNewGadgetManager(IEntity from, IEntity to) | ||
{ | ||
m_GadgetManager = SCR_GadgetManagerComponent.GetGadgetManager(to); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! User needs to equip the shovel for the action to show up | ||
override bool CanBeShownScript(IEntity user) | ||
{ | ||
if (!m_GadgetManager) | ||
{ | ||
m_GadgetManager = SCR_GadgetManagerComponent.GetGadgetManager(user); | ||
|
||
SCR_PlayerController playerController = SCR_PlayerController.Cast(GetGame().GetPlayerController()); | ||
if (playerController) | ||
playerController.m_OnControlledEntityChanged.Insert(SetNewGadgetManager); | ||
|
||
return false; | ||
}; | ||
|
||
if (!SCR_CampaignBuildingGadgetToolComponent.Cast(m_GadgetManager.GetHeldGadgetComponent())) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Trees have no RplComponent, hence only local scripts will work | ||
override bool HasLocalEffectOnlyScript() | ||
{ | ||
return true; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Destructor - End E-tool animation | ||
void ~ACE_Chopping_UserAction() | ||
{ | ||
CancelPlayerAnimation(m_pUser); | ||
} | ||
//------------------------------------------------------------------------------------------------ | ||
//! Request deletion of the tree | ||
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity) | ||
{ | ||
SCR_PlayerController userCtrl = SCR_PlayerController.Cast(GetGame().GetPlayerController()); | ||
if (!userCtrl) | ||
return; | ||
|
||
ACE_Chopping_HelperEntity helper = ACE_Chopping_HelperEntity.Cast(GetOwner()); | ||
if (!helper) | ||
return; | ||
|
||
IEntity plant = helper.GetAssociatedPlant(); | ||
if (!plant) | ||
return; | ||
|
||
userCtrl.ACE_DeleteEntityAtPosition(plant.GetOrigin()); | ||
SCR_EntityHelper.DeleteEntityAndChildren(helper); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! For entities that have no RplComponent, only local scripts will work | ||
override bool HasLocalEffectOnlyScript() | ||
{ | ||
return true; | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
addons/core/scripts/Game/ACE_Core/UserActions/ACE_GadgetUserAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Gadget Entity user action | ||
class ACE_GadgetUserAction : ScriptedUserAction | ||
{ | ||
[Attribute(defvalue: "1", desc: "Index of the gadget animation to play")] | ||
protected int m_iAnimationIndex; | ||
|
||
protected IEntity m_pUser; | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Stop animation when action is completed | ||
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity) | ||
{ | ||
CancelPlayerAnimation(pUserEntity); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Start gadget animation | ||
override void OnActionStart(IEntity pUserEntity) | ||
{ | ||
super.OnActionStart(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"); | ||
ItemUseParameters params = new ItemUseParameters(); | ||
params.SetEntity(GetHeldGadget(pUserEntity)); | ||
params.SetAllowMovementDuringAction(false); | ||
params.SetKeepInHandAfterSuccess(true); | ||
params.SetCommandID(itemActionId); | ||
params.SetCommandIntArg(m_iAnimationIndex); | ||
|
||
charController.TryUseItemOverrideParams(params); | ||
} | ||
|
||
m_pUser = pUserEntity; | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! End gadget animation | ||
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(); | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! End gadget animation | ||
void CancelPlayerAnimation(IEntity entity) | ||
{ | ||
if (!entity) | ||
return; | ||
|
||
ChimeraCharacter character = ChimeraCharacter.Cast(entity); | ||
if (!character) | ||
return; | ||
|
||
CharacterControllerComponent charController = character.GetCharacterController(); | ||
if (charController) | ||
{ | ||
CharacterAnimationComponent pAnimationComponent = charController.GetAnimationComponent(); | ||
CharacterCommandHandlerComponent cmdHandler = CharacterCommandHandlerComponent.Cast(pAnimationComponent.GetCommandHandler()); | ||
cmdHandler.FinishItemUse(); | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Get gadget entity | ||
IEntity GetHeldGadget(notnull IEntity ent) | ||
{ | ||
SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.GetGadgetManager(ent); | ||
if (!gadgetManager) | ||
return null; | ||
|
||
return gadgetManager.GetHeldGadget(); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Destructor - End Gadget animation | ||
void ~ACE_GadgetUserAction() | ||
{ | ||
CancelPlayerAnimation(m_pUser); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
addons/core/scripts/Game/ACE_Core/UserActions/ACE_ShovelUserAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Shovel Entity user action | ||
class ACE_ShovelUserAction : ACE_GadgetUserAction | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
//! User needs to equip the shovel for the action to show up | ||
override bool CanBeShownScript(IEntity user) | ||
{ | ||
IEntity gadget = GetHeldGadget(user); | ||
if (!gadget) | ||
return false; | ||
|
||
if (!gadget.FindComponent(SCR_CampaignBuildingGadgetToolComponent)) | ||
return false; | ||
|
||
return true; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
addons/core/scripts/Game/ACE_Core/UserActions/ACE_WrenchUserAction.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Wrench Entity user action | ||
class ACE_WrenchUserAction : ACE_GadgetUserAction | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
//! User needs to equip the wrench for the action to show up | ||
override bool CanBeShownScript(IEntity user) | ||
{ | ||
IEntity gadget = GetHeldGadget(user); | ||
if (!gadget) | ||
return false; | ||
|
||
if (!gadget.FindComponent(SCR_RepairSupportStationComponent)) | ||
return false; | ||
|
||
return true; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.cs_cz.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Disarm" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.de_de.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Entschärfen" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.en_us.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Disarm" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.es_es.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Disarm" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.fr_fr.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Disarm" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
addons/explosives/Language/ACEExplosivesLocalization.it_it.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
StringTableRuntime { | ||
Ids { | ||
"ACE-Explosives_DisarmUserAction_Name" | ||
} | ||
Texts { | ||
"Disarm" | ||
} | ||
} |
Oops, something went wrong.