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

External Ammo Autoloader/Container #2436

Merged
merged 38 commits into from
Oct 11, 2023
Merged

Conversation

CMDR-Bill-Doors
Copy link
Contributor

@CMDR-Bill-Doors CMDR-Bill-Doors commented Apr 12, 2023

Additions

-A brand new thingclass of Building_AmmoContainerCE, inherited from Building.

-Building_AmmoContainerCE requires a CompAmmoUser, ticker type of normal and drawer type of MapMeshAndRealTime.
-When placed adjacent to a turret, it will replenish the turret's ammo when being called to do so (via a gizmo, or when turret calls for TryOrderReload())
-Reloading will only occur if the turret's current ammo is the same as the ammo container's ammo, or the ammo container's shouldReplaceAmmo property is true and both buildings has the same ammoset. And only when turret is not full, or ammo container is not empty.
-(again, shouldReplaceAmmo is setted via a gizmo, I'm considering making it turret's property instead of ammo container's)
-Reloading will take (currently, subject to changes) as much time as it is normally reloaded, affected by ReloadSpeed stat, a progress bar will be rendered when the container is reloaded.
-Ammo containers drop ammo when destroyed or an unload gizmo is pressed.
-When an ammo container is destroyed violently, the resulting dropped ammo will take some damage and (hopefully) cook off. Haven't tested yet.
-CompFacility is yeeted, no more patching required.
-Pawns will reload containers as if they're turrets.
-Reload-One-At-Once turrets now get reload one at once-d
-Possibility of different graphic when empty, half full, or full (above 75%), via a mod extension

Changes

-Several additions and changes to make ammoUser works without an actual gun. CE doesn't like giving ammouser to sth not a weapon, but coding a new one will require reinventing too many wheels.
-Mostly additional null checks.
-Some "is Building_AmmoContainerCE" checks are added to make some function work normally for ammo container, I'll try to replace them with less hardcoded checks if possible.

Todo List

-Code clean up, probably
-Multi player support? IDK how to do it, needs enlightment.
-Learning helper, or tutor, or conceptdef.
-Chinese translation for associated strings

Reasoning

Preperation for VE deserter's ammo boxes.
I wanted it for my pack hound missile launcher

Alternatives

Nope lol.

Testing

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • Playtested a colony (specify how long)

Implemented:
edits in base CE to better accommodate verb-less ammo users.
Basis behaviours for ammo container
Turret auto rearm from container when depleted
Todo:
Pawns reload container
Optional autopatcher for linkables
Eliminate "is AmmoContainer" hardcoded checks
ammo replacement now drops replaced ammo on ground instead of devouring it.
No more compfacilities, no more need to autopatch
slightly optimized code in building turret gun CE
pawns now will reload ammo containers
ammo containers now reload reload-one-at-once turrets as intended
now takes in account of comppower, compmannable etc.
now it does not reload forbidden turrets
Now active reloading only reloads empty or not firing turrets
plus learning helper placeholder
also fixed ammo detonation
Move External Ammo Container From My Own Fork To Here
@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-4678012055.zip

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Apr 12, 2023
@CMDR-Bill-Doors CMDR-Bill-Doors marked this pull request as ready for review April 12, 2023 12:03
@CMDR-Bill-Doors CMDR-Bill-Doors requested review from a team as code owners April 12, 2023 12:03
Thorbane
Thorbane previously approved these changes May 29, 2023
@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6144163869.zip

@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6144167574.zip

@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6144205566.zip

@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6145226657.zip

fixed example def
fixed a bug that lock turret in reloading stat if the ammo container is destroyed or otherwise emptied mid-reload
@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6238404151.zip

@github-actions
Copy link

github-actions bot commented Oct 4, 2023

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6411790416.zip

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6414549977.zip

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6414552984.zip

rename ammo container to auto loader
no idea why I name it that way in the first place
additional rename for textures
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6415597089.zip

N7Huntsman
N7Huntsman previously approved these changes Oct 5, 2023
Copy link
Contributor

@N7Huntsman N7Huntsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in testing for me. We can probably get rid of the example in the future, but it's useful enough to have as a template for the time being.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6432106862.zip

N7Huntsman
N7Huntsman previously approved these changes Oct 10, 2023
@github-actions
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-6473162591.zip

@N7Huntsman N7Huntsman merged commit 8457f99 into Development Oct 11, 2023
2 checks passed
@N7Huntsman N7Huntsman deleted the AmmoContainer(Upstream) branch October 11, 2023 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Download in Comments This PR has a zipfile download available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants