diff --git a/language.version b/language.version index 519aad21e..861b218ff 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r351 \cu(Fri 12 Mar 20:08:40 CET 2021)\c-"; -SWWM_SHORTVER="\cw0.9.11b-pre r351 \cu(2021-03-12 20:08:40)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r352 \cu(Fri 12 Mar 21:36:08 CET 2021)\c-"; +SWWM_SHORTVER="\cw0.9.11b-pre r352 \cu(2021-03-12 21:36:08)\c-"; diff --git a/zscript/utility/swwm_utility.zsc b/zscript/utility/swwm_utility.zsc index a5f281163..81ac07d7c 100644 --- a/zscript/utility/swwm_utility.zsc +++ b/zscript/utility/swwm_utility.zsc @@ -1658,7 +1658,7 @@ Class SWWMUtility int np = 0; for ( int i=0; i0); } // checks if instances of a certain item exist // skipme: optionally, ignore checking for one specific instance // (useful to check if we're the only copy of an item) - static bool ItemExists( Class itm, Inventory skipme = null ) + // mapstart: this function is being called during map load, so we + // should also check STAT_TRAVELLING inventory + static bool ItemExists( Class itm, Inventory skipme = null, bool mapstart = false ) { let ti = ThinkerIterator.Create(itm); Inventory i; @@ -1686,6 +1695,13 @@ Class SWWMUtility if ( i == skipme ) continue; return true; } + if ( !mapstart ) return false; + ti = ThinkerIterator.Create(itm,Thinker.STAT_TRAVELLING); + while ( i = Inventory(ti.Next()) ) + { + if ( i == skipme ) continue; + return true; + } return false; }