ID:139645
 
Code:
area
Outside
proc
weather()
switch(Season)
if("Summer")
if(rand(1,10) >= 5)
Weather = "Raining [rand(1,5)==5 ? "Hard" : "Lightly"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/rain

src.Weathers += r
src.overlays += r
else
world << "It's sunny now."
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
if("Fall")
if(rand(1,10) == 10)
Weather = "Raining [rand(1,5)==5 ? "Lightly" : "Hard"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/rain

src.Weathers += r
src.overlays += r
else if(rand(1,5) == 5)
Weather = "Snowing [rand(1,5)==5 ? "Hard" : "Lightly"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/snow

src.Weathers += r
src.overlays += r
else
world << "It's sunny now."
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
if("Winter")
if(rand(1,10) == 10)
Weather = "Snowing [rand(1,5)==5 ? "Lightly" : "Hard"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/snow

src.Weathers += r
src.overlays += r
else if(rand(1,5) == 5)
Weather = "Snowing [rand(1,5)==5 ? "Hard" : "Lightly"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/snow
src.Weathers += r
src.overlays += r
else
world << "It's sunny now."
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
if("Spring")
if(rand(1,10) == 10)
Weather = "Rain [rand(1,5)==5 ? "Hard" : "Lightly"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/rain

src.Weathers += r
src.overlays += r
else if(rand(1,5) == 5)
Weather = "Snowing [rand(1,10)==5 ? "Hard" : "Lightly"]"
world << "It begins [Weather]"
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
var/obj/Weather/r = new/obj/weather/snow
src.Weathers += r
src.overlays += r
else
world << "It's sunny now."
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null
spawn(150) src.weather()


Problem description:
Okay, so, all the weather appears perfectly fine. But why is it when it turns sunny, the weather doesn't vanish?
I'm not exactly sure, but I sure do see a lot of repetitive code, and structure issues. You should be changing the values of variables in your statements, that then effect a small chunk of code at the bottom. I believe this could be called some sort of modular programming?
Why not delete it when you want it to vanish?
In response to Jarquille
The problem you are having are these lines:

else
world << "It's sunny now."
for(var/obj/Weather/w in src.Weathers)
src.overlays -= w
w.loc = null

When you create w and add it both to src.Weathers and src.overlays, you are actualy adding two instances of the object.

Put simply, they're separate objects, so src.overlays-=w will not work. Just do two for loops, one for src.Weathers and one for src.overlays. Then it should work.