From 9e0acada23a26738c0ca4d69b9124c5e0294ea3a Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 7 Sep 2021 00:44:35 +0200 Subject: [PATCH] QOL feature: Elemental Coating auto-use. --- cvarinfo.base | 2 ++ language.def_menu | 4 +++ language.es_menu | 4 +++ language.version | 4 +-- menudef.txt | 2 ++ zscript/items/swwm_powerups.zsc | 48 +++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 2 deletions(-) diff --git a/cvarinfo.base b/cvarinfo.base index 53c608f17..1372be601 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -114,6 +114,8 @@ nosave int swwm_sewercount = 0; // I'm sorry Civvie server bool swwm_ondemandammo = false; // don't spawn ammo for unavailable weapons user float swwm_bumpstrength = 1.0; // intensity of fov bumping server bool swwm_nomagdrop = true; // does not drop spent magazines (the "environmentally conscious" option) +user bool swwm_autousebarrier = true; // auto-use elemental coating when standing on damaging floors +server int swwm_enforceautousebarrier = 0; // enforced auto-use for coating // minimap settings nosave bool swwm_mm_enable = true; // show a minimap below the score counter diff --git a/language.def_menu b/language.def_menu index fc6228c63..1c747ff7a 100644 --- a/language.def_menu +++ b/language.def_menu @@ -197,6 +197,8 @@ SWWM_BUMP = "FOV Bump Strength"; SWWM_ENGINE = "Engine"; SWWM_ITEMGLOWS = "Distant Items Glow"; SWWM_NOMAGDROP = "Drop Spent Mags"; +SWWM_BARRIERUSE = "Automatically Use Coating"; +SWWM_SVBARRIERUSE = "Enforce Coating Auto-Use"; SWWM_MMTITLE = "Minimap Settings"; SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_ROTATE = "Rotate Minimap"; @@ -340,6 +342,8 @@ TOOLTIP_SWWM_BUMPSTRENGTH = "Controls how strong the bumping of the FOV is from TOOLTIP_SWWM_ENGINE = "Don't touch this."; TOOLTIP_SWWM_ITEMGLOWS = "If enabled, items that are far away from the player will display a shimmering glow (requires a map restart to take full effect)."; TOOLTIP_SWWM_NOMAGDROP = "By default, the Demolitionist will be somewhat environmentally conscious and not leave spent magazines lying around. Enable if you prefer the added clutter."; +TOOLTIP_SWWM_AUTOUSEBARRIER = "When enabled, elemental coating will be automatically used as needed if standing on damaging floors."; +TOOLTIP_SWWM_ENFORCEAUTOUSEBARRIER = "Enforce a specific coating auto-use setting for all players, or respects per-player settings."; TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap under the score counter."; TOOLTIP_SWWM_MM_ROTATE = "Rotates the minimap view."; TOOLTIP_SWWM_MM_GRID = "Shows a 128x128 grid on the minimap."; diff --git a/language.es_menu b/language.es_menu index b8e10cb89..0df0d93d8 100644 --- a/language.es_menu +++ b/language.es_menu @@ -196,6 +196,8 @@ SWWM_BUMP = "Intensidad de Sacudida de FOV"; SWWM_ENGINE = "Motor"; SWWM_ITEMGLOWS = "Los Ítems Lejanos Brillan"; SWWM_NOMAGDROP = "Tirar Cargadores Usados"; +SWWM_BARRIERUSE = "Usar Revestimiento Automáticamente"; +SWWM_SVBARRIERUSE = "Forzar Auto-Uso de Revestimiento"; SWWM_MMTITLE = "Opciones de Minimapa"; SWWM_MM_ENABLE = "Mostrar Minimapa"; SWWM_MM_ROTATE = "Rotar Minimapa"; @@ -339,6 +341,8 @@ TOOLTIP_SWWM_BUMPSTRENGTH = "Controla lo intensa que es la sacudida del FOV por TOOLTIP_SWWM_ENGINE = "No toques esto."; TOOLTIP_SWWM_ITEMGLOWS = "Al activar, los ítems que se encuentren lejos del jugador mostrarán un ligero destello (requiere un reinicio del mapa para tener efecto completamente)."; TOOLTIP_SWWM_NOMAGDROP = "Por defecto, la Demolicionista será un poco consciente con el medio ambiente y no dejará cargadores usados por ahí. Activa si prefieres la basura adicional."; +TOOLTIP_SWWM_AUTOUSEBARRIER = "Cuando esto está activado, el revestimiento elemental será usado automáticamente si es necesario al estar en suelos dañinos."; +TOOLTIP_SWWM_ENFORCEAUTOUSEBARRIER = "Fuerza una opción específica de auto-uso de revestimiento para todos los jugadores, o respeta la opción de cada uno."; TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa bajo el contador de puntuación."; TOOLTIP_SWWM_MM_ROTATE = "Gira la vista del minimapa."; TOOLTIP_SWWM_MM_GRID = "Muestra una cuadrícula de 128x128 en el minimapa."; diff --git a/language.version b/language.version index 4b5bbcb10..5823e1bba 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1pre r10 \cu(Tue 7 Sep 00:39:49 CEST 2021)\c-"; -SWWM_SHORTVER="\cw1.1pre r10 \cu(2021-09-07 00:39:49)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.1pre r10 \cu(Tue 7 Sep 00:44:35 CEST 2021)\c-"; +SWWM_SHORTVER="\cw1.1pre r10 \cu(2021-09-07 00:44:35)\c-"; diff --git a/menudef.txt b/menudef.txt index 13dfa3a15..658532f0c 100644 --- a/menudef.txt +++ b/menudef.txt @@ -183,6 +183,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_ARMORUSE", "swwm_autousearmor", "YesNo" Option "$SWWM_HEALTHUSE", "swwm_autousehealth", "YesNo" Option "$SWWM_AMMOUSE", "swwm_autouseammo", "YesNo" + Option "$SWWM_BARRIERUSE", "swwm_autousebarrier", "YesNo" Option "$SWWM_SINGLEFIRST", "swwm_singlefirst", "YesNo" Option "$SWWM_EARBUSTER", "swwm_earbuster", "YesNo" Option "$SWWM_BUSTERPAUSE", "swwm_cbtpause", "YesNo" @@ -194,6 +195,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_SVARMORUSE", "swwm_enforceautousearmor", "SWWMEnforce" Option "$SWWM_SVHEALTHUSE", "swwm_enforceautousehealth", "SWWMEnforce" Option "$SWWM_SVAMMOUSE", "swwm_enforceautouseammo", "SWWMEnforce" + Option "$SWWM_SVBARRIERUSE", "swwm_enforceautousebarrier", "SWWMEnforce" Option "$SWWM_OTHERVOICE", "swwm_othervoice", "YesNo" StaticText " " StaticText "$SWWM_MCTITLE", "Blue" diff --git a/zscript/items/swwm_powerups.zsc b/zscript/items/swwm_powerups.zsc index 9950894aa..b2576e22c 100644 --- a/zscript/items/swwm_powerups.zsc +++ b/zscript/items/swwm_powerups.zsc @@ -2170,6 +2170,8 @@ Class EBarrier : Inventory Mixin SWWMRespawn; Mixin SWWMPickupGlow; + int terrainwait; + override bool Use( bool pickup ) { if ( pickup && !deathmatch ) return false; @@ -2204,6 +2206,52 @@ Class EBarrier : Inventory tracer.target = self; tracer.FloatBobPhase = FloatBobPhase; } + override void DoEffect() + { + Super.DoEffect(); + // check terrain for auto-use + let b = Powerup(Owner.FindInventory("BarrierPower")); + if ( b && (b.EffectTics > 5) ) + { + terrainwait = 20; + return; + } + bool damageterrain = false; + // check any 3d floors first + for ( int i=0; i= (Owner.pos.z+Owner.Height) ) continue; + damageterrain = true; + break; + } + if ( !damageterrain && (Owner.pos.z <= Owner.floorz) ) + { + if ( (Owner.floorsector.damageamount > 0) && (Owner.floorsector.damageinterval > 0) ) damageterrain = true; + else + { + let t = Owner.GetFloorTerrain(); + if ( t && (t.DamageAmount > 0) && (t.DamageTimeMask > 0) ) + damageterrain = true; + } + } + if ( !damageterrain ) + { + terrainwait = max(0,terrainwait-1); + return; + } + else terrainwait++; + if ( terrainwait <= 20 ) return; + terrainwait = 0; + bool shouldautouse = false; + if ( swwm_enforceautousebarrier == 1 ) shouldautouse = true; + else if ( swwm_enforceautousebarrier == -1 ) shouldautouse = false; + else shouldautouse = CVar.GetCVar('swwm_autousebarrier',Owner.player).GetBool(); + if ( shouldautouse ) Owner.UseInventory(self); + } Default {