NathanKell
...
Inspired by KNB and his wonderful reworking of cannons, may I present:
DESTROYABLE CANNONS!
That, and some other fixes, are in NK_b13pre_050419.zip on the FTP.
If you started a new game with my last codebase upload, you shouldn't need to do so now (but please reinit!!).
Same requirements as last time (Pieter's modpack, Screwface's islands, Vassal's muskets, CCC's tut deck, and whatever else I said then)
List of stuff-I-remembered-to-write-down:
(included in the zip)
My three new characters (well, two and a four-in-one)
Added auto armor, changed armor order so better is later.
Added FBQ character inits to NK_Characters.c so reiniting them not necessary on gamestart.
fixed black bars bug by creating shipstats array for temporary ship refs with true stats.
changed town funcs to not always reget town aref.
Changed store pricecheck to use average if qty high enough. Also to use global arStoreTown, not reget town each time.
---new since last upload:
Add toggle RELEASE_AT_SEA to change ransom to release while at sea.
Add release button. Has unworking add ship code for when at sea, currently commented out.
add procEvntQuestCompleteDirect and event EvntQuestCompleteDirect for direct complete quest.
Add delay on divide plunder (REFIT_TIME days), using a fader.
Add quest case "updatedays" which adds pchar.updatedays days, and if pchar.updatedays.disableDCU and/or disableIT will turn them off for the the update.
Added new functions GetWeekDay(int day, int month, int year) and GetMonthName(int month) and GetDayName(int day) to Calendar.c
Added date and time to F2 menu.
added rank based scaling to surrender check
added crew hire cost to auto hire crew in shipyard.
removed crew qty damage scale
added decreasing cannon numbers due to damage and crew. Sadly only via ball (not TOUCH or STORM or whatever).
changed addball to only add correct number of balls
added back some reload time tweak if crew > min for all cannon
fixed Ship_DetonateSmall to not repeat forever.
fixed officers lost on sell ship
added function GetCharPriceMod(ref chr, int price_type, bool summon) rather than have all the different commerce interfaces use their own identical price-buy-com-skill/perk calculations. Applied this to shipyard too.
added canqty handling to cannon.c, shipyard.c
add PROSHIPDEF_NOCRITCH for chance for a crit to be avoided if captain has prof ship def. Stock was always.
changed findotherballtype to be a little faster, and to always return BOMBS if fort. Also fixed so that ships (without bombs) don't always get told bombs.
Added "magazine catches fire" event if fire left to burn too long
Tried different method of dousing fire particle systems
-----------
Notes on destroyable cannon, and changes to KNB's mod:
For every ship in ships_init.c I have added ship-specific and arc-specific cannon quantities (ship.cannons.borts.cannonX.qty, where X is F,B,L,R). I only manually specify bow and stern chasers; the post-init loop at the end auto-calculates broadside qtys.
When you assign a ship to a character, you may specify, in the char.ship.stats attribute tree, different quantities for those arcs (they will supercede the ship-side stats like any other PRS3 local ship stat).
On adding ship to sea, if attribute char.ship.cannons.borts.cannonX.qty does not exist it is created based on the above two-step check (local, then ship base).
During combat, that qty can be reduced (a check is made whenever HP is damaged and the cause is BALL--sorry, no cannon damage from collisions yet).
In addition, the max firable cannon qty is stored as *.curqty, and that is based on *.qty * crew ratio, so if you don't have enough crew you can't man all guns.
When fantoms of type trade are created, they are given a random less than max number of guns in the broadside and stern arcs (not bow, since there are only ever 2 bow chasers).
If you want to see what's happening, uncomment the trace() in AIBalls.c's Ball_AddBall() function, and the trace near the bottom of Ship_ApplyHullDamage() in AIShip.c. That will tell you the ball vs. ship angle.
Note that whenever a gun is destroyed, that /will/ be traced. Nothing to re-enable.
The correct cannon qty is always shown (in interface, in spyglass); on the ships interface you can also see the arc-by-arc breakdown.
When a cannon is destroyed it is checked whether it is placed as "fixable" or really destroyed. The next time a day goes by and you do auto-repair, all fixable guns are re-mounted. This is based on repair skill and defense perks.
In order to repair/re-add all the guns, buy cannons at the shipwright (the price will be correct for how many you need--if you want to stay at the same caliber just buy that caliber, you now can).
So, about qty. When you (or another captain) fires an arc, you will only be able to fire the number of guns that are manned. The red bar will still go down and you'll have to wait for it to "recharge", but you will not lose the ammo.
Yes, this is a kludge (it's done via interrupting Ball_AddBall() ); but it works...
You will get a log message when you personally have lost a gun. The crew will also tell you if it's fixable.
DESTROYABLE CANNONS!
That, and some other fixes, are in NK_b13pre_050419.zip on the FTP.
If you started a new game with my last codebase upload, you shouldn't need to do so now (but please reinit!!).
Same requirements as last time (Pieter's modpack, Screwface's islands, Vassal's muskets, CCC's tut deck, and whatever else I said then)
List of stuff-I-remembered-to-write-down:
(included in the zip)
My three new characters (well, two and a four-in-one)
Added auto armor, changed armor order so better is later.
Added FBQ character inits to NK_Characters.c so reiniting them not necessary on gamestart.
fixed black bars bug by creating shipstats array for temporary ship refs with true stats.
changed town funcs to not always reget town aref.
Changed store pricecheck to use average if qty high enough. Also to use global arStoreTown, not reget town each time.
---new since last upload:
Add toggle RELEASE_AT_SEA to change ransom to release while at sea.
Add release button. Has unworking add ship code for when at sea, currently commented out.
add procEvntQuestCompleteDirect and event EvntQuestCompleteDirect for direct complete quest.
Add delay on divide plunder (REFIT_TIME days), using a fader.
Add quest case "updatedays" which adds pchar.updatedays days, and if pchar.updatedays.disableDCU and/or disableIT will turn them off for the the update.
Added new functions GetWeekDay(int day, int month, int year) and GetMonthName(int month) and GetDayName(int day) to Calendar.c
Added date and time to F2 menu.
added rank based scaling to surrender check
added crew hire cost to auto hire crew in shipyard.
removed crew qty damage scale
added decreasing cannon numbers due to damage and crew. Sadly only via ball (not TOUCH or STORM or whatever).
changed addball to only add correct number of balls
added back some reload time tweak if crew > min for all cannon
fixed Ship_DetonateSmall to not repeat forever.
fixed officers lost on sell ship
added function GetCharPriceMod(ref chr, int price_type, bool summon) rather than have all the different commerce interfaces use their own identical price-buy-com-skill/perk calculations. Applied this to shipyard too.
added canqty handling to cannon.c, shipyard.c
add PROSHIPDEF_NOCRITCH for chance for a crit to be avoided if captain has prof ship def. Stock was always.
changed findotherballtype to be a little faster, and to always return BOMBS if fort. Also fixed so that ships (without bombs) don't always get told bombs.
Added "magazine catches fire" event if fire left to burn too long
Tried different method of dousing fire particle systems
-----------
Notes on destroyable cannon, and changes to KNB's mod:
For every ship in ships_init.c I have added ship-specific and arc-specific cannon quantities (ship.cannons.borts.cannonX.qty, where X is F,B,L,R). I only manually specify bow and stern chasers; the post-init loop at the end auto-calculates broadside qtys.
When you assign a ship to a character, you may specify, in the char.ship.stats attribute tree, different quantities for those arcs (they will supercede the ship-side stats like any other PRS3 local ship stat).
On adding ship to sea, if attribute char.ship.cannons.borts.cannonX.qty does not exist it is created based on the above two-step check (local, then ship base).
During combat, that qty can be reduced (a check is made whenever HP is damaged and the cause is BALL--sorry, no cannon damage from collisions yet).
In addition, the max firable cannon qty is stored as *.curqty, and that is based on *.qty * crew ratio, so if you don't have enough crew you can't man all guns.
When fantoms of type trade are created, they are given a random less than max number of guns in the broadside and stern arcs (not bow, since there are only ever 2 bow chasers).
If you want to see what's happening, uncomment the trace() in AIBalls.c's Ball_AddBall() function, and the trace near the bottom of Ship_ApplyHullDamage() in AIShip.c. That will tell you the ball vs. ship angle.
Note that whenever a gun is destroyed, that /will/ be traced. Nothing to re-enable.
The correct cannon qty is always shown (in interface, in spyglass); on the ships interface you can also see the arc-by-arc breakdown.
When a cannon is destroyed it is checked whether it is placed as "fixable" or really destroyed. The next time a day goes by and you do auto-repair, all fixable guns are re-mounted. This is based on repair skill and defense perks.
In order to repair/re-add all the guns, buy cannons at the shipwright (the price will be correct for how many you need--if you want to stay at the same caliber just buy that caliber, you now can).
So, about qty. When you (or another captain) fires an arc, you will only be able to fire the number of guns that are manned. The red bar will still go down and you'll have to wait for it to "recharge", but you will not lose the ammo.
Yes, this is a kludge (it's done via interrupting Ball_AddBall() ); but it works...
You will get a log message when you personally have lost a gun. The crew will also tell you if it's fixable.