[Script request] Height limiter (for hallway)

3 posts Page 1 of 1 First unread post
GreaseMonkey
Coder
Coder
Posts: 733
Joined: Tue Oct 30, 2012 11:07 pm


I thought this would be amusing to add to Iceball and PABH suggested that I make a request for a Pyspades script.

There are 3 ways to play hallway (not counting griefing and all that stupid crap):
1. Charge the middle.
2. Dig through the sides.
3. Climb to the roof, run to the enemy base, and spawncamp.

The purpose of this script is to stop people doing #3 so easily - that is, they actually have to dig a tunnel to spawncamp.

So here's my idea...

Make the top 2 layers (0 and 1) impenetrable and fully solid. The lower one should contain something that looks like a sky. The upper one should have the colour of the highest block that isn't on these two layers.

You will have to modify the spawning "get Z coordinate" code to ignore the top 2 layers when it calculates its blocks.

For bonus points, you could clamp the Z (vertical) coordinate of the player to always be >= 2 + head_bbox_top_offset.

Sound good?
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Here you go; Fresh out of the tin
Code: Select all
"""
thepolm3
how high can you go? designed to reduce the need for boundaries
Idea by Greasemonkey
"""

LIMIT=2 #highest players can go

def apply_script(protocol, connection, config):
    
    class LimitConnection(connection):
        last_safe_pos=(0,0,0)

        def on_spawn_location(self,pos):
            if pos<=LIMIT:
                for z in range(LIMIT,62):
                    if is_location_free(pos[0],pos[1],z):
                        return (pos[0],pos[1],z)
            return connection.on_spawn_location(self,pos)
                
        def on_position_update(self):
            pos=self.get_location()
            if pos[2]<=LIMIT:
                self.set_location(self.last_safe_pos)
            else:
                self.last_safe_pos=int(pos[0]),int(pos[1])+0.5,pos[2]-0.5
            return connection.on_position_update(self)

        def on_orientation_update(self,x,y,z):
            if self.get_location()[2]<=LIMIT: self.set_location(self.last_safe_pos)
            return connection.on_orientation_update(self,x,y,z)
    return protocol, LimitConnection
Attachments
maxheight.py
(1.07 KiB) Downloaded 257 times
Venator
League Participant
League Participant
Posts: 1225
Joined: Wed Nov 07, 2012 8:32 pm


thepolm3 deservers a golden Scripter badge.
3 posts Page 1 of 1 First unread post
Return to “Help Discussions”

Who is online

Users browsing this forum: No registered users and 10 guests