Smoketraill

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Smoketraill

Postby Kami » Sat Dec 19, 2015 12:16 pm

User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Sat Dec 19, 2015 1:11 pm

Syntax: Select all

from players.entity import Player
from colors import Color
from commands.say import SayCommand
from entities.entity import Entity
from mathlib import Vector
from engines.precache import Generic as PrecacheGeneric


PrecacheGeneric("particle/SmokeStack.vmt", preload=True)


@SayCommand('do')
def _smoke_trail(command, index, team=None):
player = Player(index)
userid = player.userid
entity = Entity.create('env_smokestack')
entity.set_key_value_int('BaseSpread', 20)
entity.set_key_value_int('EndSize', 30)
entity.set_key_value_int('JetLength', 180)
entity.set_key_value_int('Rate', 20)
entity.set_key_value_int('renderamt', 255)
entity.set_key_value_color('rendercolor', Color(255, 255, 255))
entity.set_key_value_string('SmokeMaterial', 'particle/SmokeStack.vmt')
entity.set_key_value_int('Speed', 30)
entity.set_key_value_int('SpreadSpeed', 15)
entity.set_key_value_int('StartSize', 20)
entity.set_key_value_int('InitialState', 1)
entity.teleport(player.origin, None, None)
entity.spawn()


This creates default smokestack. Not sure if precache is needed though.

Also, InitialState set to 1 lets us avoid calling TurnOn input.
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Postby Kami » Sat Dec 19, 2015 2:14 pm

Awesome this worked :D Didn't know about some of the functions you used so thanks for those too!
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Dec 19, 2015 4:26 pm

We added CSmokeStack data yesterday, so most of those set_key_value_<type> calls can be changed to use the attributes.
https://github.com/Source-Python-Dev-Team/Source.Python/commit/350250a0e6f625202c8f50547df80bcbd4c78d08
Image
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Sat Dec 19, 2015 4:31 pm

I knew I saw CSmokeStack somewhere :) And I guess that rendercolor and renderamt already had shortcuts.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 125 guests