Raised This Month: $51 Target: $400
 12% 

[ND] Commander Structure Intercepts


Post New Thread Reply   
 
Thread Tools Display Modes
Author
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Plugin ID:
8346
Plugin Version:
1.2.1
Plugin Category:
Technical/Development
Plugin Game:
Nuclear Dawn
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Intercepts and allows plugins to gracefully block or modify structures being built or sold
    Old 12-28-2022 , 18:23   [ND] Commander Structure Intercepts
    Reply With Quote #1

    Nuclear Dawn Commander Structure Intercepts

    Description

    This plugin exposes a detour of CNDPlayer::Commander_BuildStructure and CNDPlayer::Commander_BuildEmergencyAssembler to enable other SourceMod plugins to gracefully block buildings by structure type or by the position of the building as well as modify the structure type or position before the crate is delivered.

    The SellActionHandlerObject::Run is also exposed to allow plugins to prevent structures from being sold.

    Development Usage

    PHP Code:
    #include <nd_commander_build>

    // check for dependency on nd_structure_intercept
    public void OnAllPluginsLoaded()
    {
        if (!
    LibraryExists("nd_structure_intercept"))
        {
            
    SetFailState("Failed to find plugin dependency nd_structure_intercept");
        }
    }

    public 
    Action ND_OnCommanderBuildStructure(int clienteNDStructures &structurefloat position[3])
    {
        if (
    blockConditions)
        {
            return 
    Plugin_Stop;
        }
        if (
    changeConditions)
        {
            
    structure = ...
            return 
    Plugin_Changed;
        }
        return 
    Plugin_Continue;
    }

    public 
    Action ND_OnCommanderSellStructure(int clientint entity)
    {
        if (
    blockConditions)
        {
            return 
    Plugin_Stop;
        }

        return 
    Plugin_Continue;

    Sepcial Thanks
    • Addie - Double-checking my Ghidra work with IDA and debugging intuition that kept me from going astray
    • psychonic - Providing ND function prototypes as I was exploring what to detour in Ghidra
    • Vertex - Providing a test server environment

    Requirements

    DHooks and the custom gamedata are required for this plugin

    Server Installation

    Place the build-structure.games.txt file in the addons/sourcemod/gamedata/ directory on the server.
    Compile and place the nd_structure_intercept.smx file in the addons/sourcemod/plugins directory on the server.

    Changelog

    1.0 Initial public release
    1.1 Added emergency assembler detour, allowed modifications in addition to blocking structures, and clean up.
    1.2.1 Added sell structure detour
    Attached Files
    File Type: inc nd_commander_build.inc (1.8 KB, 42 views)
    File Type: sp Get Plugin or Get Source (nd_structure_intercept.sp - 83 views - 8.1 KB)
    File Type: txt build-structure.games.txt (3.9 KB, 22 views)
    __________________

    Last edited by databomb; 03-14-2023 at 22:29. Reason: version 1.2.1
    databomb is offline
    databomb
    Veteran Member
    Join Date: Jun 2009
    Location: california
    Old 01-10-2023 , 12:20   Re: [ND] Build Structure Intercept
    Reply With Quote #2

    Updated to version 1.1 which detours the emergency assembler build action from the command bunker as well as improves the detour to allow for modification of the structure type or position in addition to blocking the structure.
    __________________
    databomb is offline
    databomb
    Veteran Member
    Join Date: Jun 2009
    Location: california
    Old 03-10-2023 , 20:04   Re: [ND] Commander Structure Intercepts
    Reply With Quote #3

    Version 1.2.1 posted
    Provides new forward ND_OnCommanderSellStructure to allow plugins to block commanders from selling structures by adding a new detour of SellActionHandlerObject::Run
    __________________
    databomb is offline
    databomb
    Veteran Member
    Join Date: Jun 2009
    Location: california
    Old 03-14-2023 , 22:28   Re: [ND] Commander Structure Intercepts
    Reply With Quote #4

    Updated gamedata to include CNuclearDawn::GetCommandBunkerForTeam
    __________________
    databomb is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 14:06.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode