Coder Social home page Coder Social logo

vinci6k / enki Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 25 KB

Custom package for Source.Python for handling player interactions with water.

Home Page: https://forums.sourcepython.com/viewtopic.php?f=38&t=2731

License: GNU General Public License v3.0

Python 100.00%
csgo css custom-package hl2dm hl2mp source-engine source-python tf2

enki's Introduction

Enki

This is a small custom package for Source.Python that gives plugin developers quick and easy access to the Player instance whenever the player starts or stops touching water.


First gif: water_spash.py; Second gif: water_walk.py

Installation

  1. Install Source.Python.
  2. Download the latest release of Enki.
  3. Extract the files into your game server's root folder.
    (e.g. ../csgo/ for Counter-Strike: Global Offensive)
  4. Restart your server.

Usage

# ../water_splash/water_splash.py

# Source.Python
from entities.entity import Entity
from stringtables import string_tables

# Enki
from enki.listeners import OnPlayerEnterWater


@OnPlayerEnterWater
def on_player_enter_water(player):
    """Called when a player starts touching water."""
    # Did the player enter the water at a reasonable velocity?
    if player.velocity.length > 300:
        # Let's make a big water splash!
        particle = Entity.create('info_particle_system')
        particle.origin = player.origin
        # NOTE: This particle effect only exists in CS:GO, there are similar
        # effects in other games, e.g. 'water_splash_01' in CS:S.
        particle.effect_name = 'explosion_basic_water'
        particle.effect_index = string_tables.ParticleEffectNames.add_string(
            'explosion_basic_water'
        )
        particle.start()
        particle.delay(1, particle.remove)

There are a few more examples which showcase how this package works.
To see all the available imports/modules, head over to the wiki.

Supported Games

Counter-Strike: Source
Counter-Strike: Global Offensive
Half Life 2: Deathmatch
Team Fortress 2

enki's People

Contributors

vinci6k avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.