summaryrefslogtreecommitdiff
path: root/src-01_radio-can-use-ups.patch
diff options
context:
space:
mode:
authorjc_gargma <jc_gargma@iserlohn-fortress.net>2023-05-03 15:58:03 -0700
committerjc_gargma <jc_gargma@iserlohn-fortress.net>2023-05-03 15:58:03 -0700
commit6b8d5abd7fc1d2f1d6f794640117c649eae3e01a (patch)
tree0ad0436287ad1f9bbd3cfb28f7574d5a6710592f /src-01_radio-can-use-ups.patch
parentUpdated to 2023-04-15-1344 (diff)
downloadcataclysm-bn-6b8d5abd7fc1d2f1d6f794640117c649eae3e01a.tar.xz
Updated to 2023-04-30-2223
Revert more ammo patches. Revert more books patches. Clean up old book patch. Fix removed traits patch. Fix bathroom fluff patch. Remove obsolete vacutainer patch. Rename source patches.
Diffstat (limited to 'src-01_radio-can-use-ups.patch')
-rw-r--r--src-01_radio-can-use-ups.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/src-01_radio-can-use-ups.patch b/src-01_radio-can-use-ups.patch
new file mode 100644
index 0000000..a47b1d4
--- /dev/null
+++ b/src-01_radio-can-use-ups.patch
@@ -0,0 +1,55 @@
+--- a/src/iuse.cpp
++++ b/src/iuse.cpp
+@@ -350,6 +350,7 @@
+ static const std::string flag_HEATS_FOOD( "HEATS_FOOD" );
+ static const std::string flag_PLANT( "PLANT" );
+ static const std::string flag_PLOWABLE( "PLOWABLE" );
++static const std::string flag_USE_UPS( "USE_UPS" );
+
+ // how many characters per turn of radio
+ static constexpr int RADIO_PER_TURN = 25;
+@@ -2205,7 +2206,8 @@
+ }
+ } else { // Activated
+ int ch = 1;
+- if( it->ammo_remaining() > 0 ) {
++ if( it->ammo_remaining() > 0 || ( it->has_flag( flag_USE_UPS ) &&
++ p->has_enough_charges( *it, false ) ) ) {
+ ch = uilist( _( "Radio:" ), {
+ _( "Scan" ), _( "Turn off" )
+ } );
+@@ -4074,7 +4076,8 @@
+ if( t ) { // Effects while simply on
+
+ } else {
+- if( !it->units_sufficient( *p ) ) {
++ if( !it->units_sufficient( *p ) || !( it->has_flag( flag_USE_UPS ) &&
++ p->has_enough_charges( *it, false ) ) ) {
+ p->add_msg_if_player( m_info, _( "Your tactical tonfa is out of power." ) );
+ it->convert( itype_shocktonfa_off ).active = false;
+ } else {
+@@ -4099,7 +4102,8 @@
+ int iuse::mp3( player *p, item *it, bool, const tripoint & )
+ {
+ // TODO: avoid item id hardcoding to make this function usable for pure json-defined devices.
+- if( !it->units_sufficient( *p ) ) {
++ if( !it->units_sufficient( *p ) || !( it->has_flag( flag_USE_UPS ) &&
++ p->has_enough_charges( *it, false ) ) ) {
+ p->add_msg_if_player( m_info, _( "The device's batteries are dead." ) );
+ } else if( p->has_active_item( itype_mp3_on ) || p->has_active_item( itype_smartphone_music ) ||
+ p->has_active_item( itype_afs_atomic_smartphone_music ) ||
+@@ -6366,9 +6370,12 @@
+ int iuse::einktabletpc( player *p, item *it, bool t, const tripoint &pos )
+ {
+ if( t ) {
+- if( !it->get_var( "EIPC_MUSIC_ON" ).empty() && ( it->ammo_remaining() > 0 ) ) {
++ if( !it->get_var( "EIPC_MUSIC_ON" ).empty() &&
++ ( it->ammo_remaining() > 0 || ( it->has_flag( flag_USE_UPS ) &&
++ p->has_enough_charges( *it, false ) ) ) ) {
+ if( calendar::once_every( 5_minutes ) ) {
+- it->ammo_consume( 1, p->pos() );
++ //it->ammo_consume( 1, p->pos() );
++ p->consume_charges( *it, 1 );
+ }
+
+ //the more varied music, the better max mood.