Parachute v0.02!

Release your plugins here!
User avatar
L'In20Cible
Project Leader
Posts: 999
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Parachute!

Postby L'In20Cible » Tue Jan 24, 2017 12:19 am

Remove the info part.
User avatar
Painkiller
Senior Member
Posts: 315
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: Parachute!

Postby Painkiller » Tue Jan 24, 2017 8:11 am

Ok i have, but now come this.

Syntax: Select all

09:10:17 [SP] Loading plugin 'parachute'...

[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 174, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 67, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/parachute/parachute.py", line 48, in <module>
configuration = ConfigManager(informations.basename)

NameError: name 'informations' is not defined


[SP] Plugin 'parachute' was unable to be loaded.
User avatar
L'In20Cible
Project Leader
Posts: 999
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Parachute!

Postby L'In20Cible » Tue Jan 24, 2017 8:17 am

Replace all occurences of informations.basename with 'parachute'.
User avatar
Painkiller
Senior Member
Posts: 315
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: Parachute!

Postby Painkiller » Tue Oct 03, 2017 10:01 am

Hii have find an error.

Code: Select all

[SP] Loading plugin 'parachute'...

[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/parachute/parachute.py", line 67, in <module>
    with open(CFG_PATH / 'parachute' / 'precache.res') as f:

FileNotFoundError: [Errno 2] No such file or directory: Path('../cfg/source-python/parachute/precache.res')


[SP] Plugin 'parachute' was unable to be loaded.
User avatar
Ayuto
Project Leader
Posts: 1667
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Parachute!

Postby Ayuto » Tue Oct 03, 2017 10:51 am

Looks like you are using this version, but didn't fully installed it...:
viewtopic.php?p=9047#p9047
User avatar
L'In20Cible
Project Leader
Posts: 999
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Parachute!

Postby L'In20Cible » Wed Oct 04, 2017 4:42 am

Like Ayuto said, you didn't install it correctly. The traceback you posted clearly tells you that you are missing a file:

Code: Select all

FileNotFoundError: [Errno 2] No such file or directory: Path('../cfg/source-python/parachute/precache.res')
User avatar
iPlayer
Developer
Posts: 567
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Parachute!

Postby iPlayer » Wed Oct 04, 2017 5:03 am

Well, the plugin needed to be updated, too (due to the PluginInfo changes - it hasn't been updated since then)

Here's the new version

Syntax: Select all

# ../addons/source-python/plugins/parachute/parachute.py


# ============================================================================
# >> IMPORTS
# ============================================================================
# Python Imports
from random import choice

# Source.Python Imports
from cvars import ConVarFlags
from entities.constants import MoveType
from paths import CFG_PATH
from players.constants import PlayerStates
from players.constants import PlayerButtons

from mathlib import Vector
# Config
from config.manager import ConfigManager
# Core
from core import echo_console
# ConVars
from cvars import ConVar
# Models
from engines.precache import Model
# Entities
from entities.entity import Entity
# Events
from events import Event
# Filters
from filters.players import PlayerIter
# Messages
from messages import HintText
# Players
from players.entity import Player
# Plugins
from plugins.info import PluginInfo
from plugins.manager import plugin_manager
# Tick
from listeners import OnTick
from listeners.tick import Delay
# Stringtables
from stringtables.downloads import Downloadables
# Translations
from translations.strings import LangStrings


# ============================================================================
# >> INFORMATIONS
# ============================================================================
info = plugin_manager.get_plugin_info(__name__)


# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Create and execute the configuration file...
configuration = ConfigManager(info.name)
parachute_advert = configuration.cvar('parachute_advert', '1',
description='Enable/Disable the advert every round start.')
parachute_button = configuration.cvar('parachute_button', 'SPEED',
description='Defines the button to use the parachute.')
parachute_falling_speed = configuration.cvar('parachute_falling_speed', '10',
description='Defines the falling speed of the parachute.')
configuration.write()
configuration.execute()

# Parse the translations files...
translations = LangStrings(info.name)

# Get a global HintText...
advert = HintText(message=translations['Advert'])


# Parse precache.res
models = []
with open(CFG_PATH / info.name / 'precache.res') as f:
for line in f:
line = line.strip()
if not line:
continue
models.append(Model(line))

# Parse downloadables.res
downloadables = Downloadables()
with open(CFG_PATH / info.name / 'downloadables.res') as f:
for line in f:
line = line.strip()
if not line:
continue
downloadables.add(line)

parachutes = {}


# ============================================================================
# >> FUNCTIONS
# ============================================================================
def open_parachute(player):
parachute = Entity.create('prop_dynamic_override')
parachutes[player.userid] = (player, parachute)

parachute.model = choice(models)
parachute.teleport(player.origin, player.angles, None)
parachute.spawn()


def close_parachute(player):
parachutes.pop(player.userid)[1].remove()


# ============================================================================
# >> LISTENER CALLBACKS
# ============================================================================
@OnTick
def tick_listener():
'''Fired each game frame...'''

try:
# Teleport existing parachutes to their owners
for player, parachute in parachutes.values():
parachute.teleport(player.origin, player.angles, None)

# Loop through all living, human players...
for player in PlayerIter(is_filters=['alive'], not_filters=['bot']):

# Is the player not falling?
if (player.fall_velocity < 1.0 or

# Is the player not holding his parachute key?
not player.buttons & getattr(PlayerButtons,
parachute_button.get_string().upper()) or

# Is the player currently in a ladder?
player.move_type & MoveType.LADDER or

# Is the player currently in water?
player.flags & PlayerStates.INWATER):

if player.userid in parachutes:
close_parachute(player)

continue

# Revert the falling velocity to slow down the player speed...
player.base_velocity = Vector(
0,
0,
player.fall_velocity + (
parachute_falling_speed.get_float() * -1)
)

if player.userid not in parachutes:
open_parachute(player)

except Exception as e:
echo_console(str(e))


# ============================================================================
# >> GAME EVENTS
# ============================================================================
@Event('round_start')
def round_start(game_event):
'''Fired at the beginning of every round...'''

# Clear entities list
parachutes.clear()

# Is the advert disabled?
if not parachute_advert.get_bool():

# No need to go further...
return

# Send the advert...
# NOTE: Since ResetHud is sent every round, we need to wait a bit before
# sending a HintText message...
Delay(0.5, advert.send,
kwargs={'button': parachute_button.get_string().lower()})


Here's info.ini:

Syntax: Select all

verbose_name = "Parachute"
author = "L'In20Cible, iPlayer"
description = "You know..."
version = "1.0"


This plugin desperately needs a repo.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
L'In20Cible
Project Leader
Posts: 999
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Parachute!

Postby L'In20Cible » Sat Oct 14, 2017 10:17 pm



  • Optimizations.
  • New mechanic: Steering lines!
  • New model for OrangeBox and CS:GO engines.
  • Cheap "scaling" animation to simulate the deployment of the parachute.
  • Parachute parenting for movement prediction.

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 1 guest