Snowfall for Black Mesa

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Snowfall for Black Mesa

Postby Painkiller » Mon Nov 02, 2015 1:30 pm

Could someone a snowfall plugin writing for Black Mesa?
Greeting Painkiller
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Thu Nov 05, 2015 7:06 pm

Nobody can help me ?
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Fri Nov 06, 2015 3:20 pm

I tested L'In20Cible's old snowfall addon with EventScripts on CS:S. Somehow, this was crashing my client when setting the precipitation model. Then I have also tested it with SP and it's crashing as well. We might need to figure out a new way of creating precipitation (or I was too tired yesterday and made a stupid mistake).
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Tue Dec 08, 2015 5:20 pm

Hi mates,
could someone take a look at it again?
User avatar
Doldol
Senior Member
Posts: 200
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Wed Dec 09, 2015 3:42 am

Painkiller wrote:Hi mates,
could someone take a look at it again?


This works in CSGO for me, but as said crashes CSS with a C++ error message, maybe CSS does some optimisation @ map compile time?
I guess you could test this out in Black Mesa?

Syntax: Select all

from events import Event
from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from engines.server import global_vars
from colors import Color


@Event("round_start")
def round_start(game_event):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(global_vars.map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Mon Dec 14, 2015 5:35 pm

Does not work under Black Mesa and Half Life 2 Deathmatch
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Mon Dec 14, 2015 6:22 pm

There is no round_start event in either of those games. Try using OnLevelInit instead (untested):

Syntax: Select all

from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from colors import Color
from listeners import OnLevelInit


@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Mon Dec 14, 2015 7:51 pm

satoon101 wrote:

Syntax: Select all

@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
I think I would rather recommend using:

Syntax: Select all

from entities.constants import WORLD_ENTITY_INDEX

@OnLevelInit
def level_init(map_name):
worldspawn = Entity(WORLD_ENTITY_INDEX)
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Mon Dec 14, 2015 7:59 pm

L'In20Cible wrote:I think I would rather recommend using:

Syntax: Select all

from entities.constants import WORLD_ENTITY_INDEX

@OnLevelInit
def level_init(map_name):
worldspawn = Entity(WORLD_ENTITY_INDEX)
And even if WORLD_ENTITY_INDEX didn't exist, I'd say using next() is much more Pythonic than for: break
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Wed Dec 16, 2015 4:16 pm

satoon101 wrote:There is no round_start event in either of those games. Try using OnLevelInit instead (untested):

Syntax: Select all

from entities.entity import Entity
from entities.helpers import create_entity
from filters.entities import EntityIter
from colors import Color
from listeners import OnLevelInit


@OnLevelInit
def level_init(map_name):
for worldspawn in EntityIter("worldspawn"):
break
else:
raise NotImplementedError("No world on round start ~ wut?")
for func_precipitation in EntityIter("func_precipitation"):
if func_precipitation.get_key_value_int("preciptype") == 3:
break
else:
func_precipitation = Entity(create_entity("func_precipitation"))
func_precipitation.set_key_value_string("model", "maps/{0}.bsp".format(map_name))
func_precipitation.set_key_value_int("preciptype", 3)
func_precipitation.set_key_value_int("renderamt", 255)
func_precipitation.color = Color(218, 243, 255)
func_precipitation.set_key_value_int("renderfx", 255)
func_precipitation.set_key_value_int("rendermode", 3)
func_precipitation.get_input("Alpha")(250)
func_precipitation.spawn()
func_precipitation.mins = worldspawn.get_property_vector("m_WorldMins")
func_precipitation.maxs = worldspawn.get_property_vector("m_WorldMaxs")
func_precipitation.origin = (func_precipitation.mins + func_precipitation.maxs) / 2



This Error come on
Half Life 2 Deathmatch and Black Mesa Source


Syntax: Select all

18:02:26 [SP] Loading plugin 'snow'... 

[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/plugins/manager.py', line 71, in __missing__
instance = self.instance(plugin_name, self.base_import)
File '../addons/source-python/packages/source-python/plugins/instance.py', line 82, in __init__
self._plugin = import_module(import_name)
File '../addons/source-python/plugins/snow/snow.py', line 5, in <module>
from listeners import OnLevelInit

ImportError: cannot import name 'OnLevelInit'


[SP] Plugin 'snow' was unable to be loaded.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Dec 16, 2015 4:21 pm

Update your Source.Python version.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Wed Dec 16, 2015 4:24 pm

:( not yet
but it's ok I know.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Fri Dec 18, 2015 6:11 pm

Ok i have the newest SP- Version and plugin load.

No error and not work.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Dec 18, 2015 9:46 pm

I did test some code, but it only seemed to work on CS:GO. It isn't that it didn't "work" on CS:S, HL2:DM, or BM:S, it actually crashed my client on all 3. If I can get that figured out and fixed, I will post some code. Note that I will certainly test on both BM:S and HL2:DM before posting working code (if I can figure it out).

*Edit: I narrowed down the crashing of the client, but I really don't know why it does it. Here is my test script:

Syntax: Select all

from colors import Color
from entities.constants import WORLD_ENTITY_INDEX
from entities.entity import Entity
from engines.precache import Model
from engines.server import global_vars
from events import Event
from listeners import OnLevelInit
from listeners.tick import tick_delays


@OnLevelInit
@Event('round_start')
def create_snow(*args):
try:
worldspawn = Entity(WORLD_ENTITY_INDEX)
except ValueError:
tick_delays.delay(0, create_snow)
return
func_precipitation = Entity.find_or_create("func_precipitation")
func_precipitation.model = Model("maps/{0}.bsp".format(global_vars.map_name))
func_precipitation.precip_type = 3
func_precipitation.color = Color(218, 243, 255)
func_precipitation.render_mode = 3
func_precipitation.spawn()
func_precipitation.mins = worldspawn.world_mins
func_precipitation.maxs = worldspawn.world_maxs
origin = (func_precipitation.mins + func_precipitation.maxs) / 2
func_precipitation.origin = origin

create_snow()


If I comment out setting the model, the client does not crash, but there is no effect. This code works perfectly on CS:GO. If I comment out setting the model in CS:GO, the effect does not show. So, setting the model is necessary, but crashes the client on CS:S, HL2:DM, and BM:S (probably DOD:S and TF2, as well).


*Edit2: I did notice that in this addon, sicman_adrian uses env_smokestack instead of func_precipitation. This requires multiple entities to be created and for locations to be specified in data files. I will do some testing to see if that works on all games.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Sat Dec 19, 2015 4:16 pm

Thanks in Advance
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Wed Dec 23, 2015 3:25 pm

still no snow :(
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Winter is NOT coming !

Postby L'In20Cible » Thu Dec 24, 2015 3:24 am

User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: Snowfall for Black Mesa

Postby Painkiller » Tue Oct 10, 2017 4:54 pm

Is there any new information?


Code: Select all

18:51:38 sp plugin load snow
18:51:38 [SP] Loading plugin 'snow'...
         
         [SP] Caught an Exception:
         Traceback (most recent call last):
           File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
             plugin = self.manager.load(plugin_name)
           File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load
             plugin._load()
           File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
             self.module = import_module(self.import_name)
           File "../addons/source-python/plugins/snow/snow.py", line 8, in <module>
             from listeners.tick import tick_delays
         
         ImportError: cannot import name 'tick_delays'
         
         
         [SP] Plugin 'snow' was unable to be loaded.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Snowfall for Black Mesa

Postby Ayuto » Tue Oct 10, 2017 5:25 pm

That exception is unrelated to the crash mentioned in the previous posts. And since there haven't been any updates to HL2DM I highly doubt it's now working without crashing.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: Snowfall for Black Mesa

Postby Painkiller » Tue Oct 10, 2017 6:30 pm

This is the current error code when I loaded it.

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 22 guests