forked from greghaynes/xsbs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/amstan/hyperserv
Conflicts: src/pyscripts/hyperserv/servercommands.py
- Loading branch information
Showing
13 changed files
with
137 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""This file contains the required functions for the editing features""" | ||
|
||
import base | ||
from hypershade.cubescript import playerCS, CSCommand | ||
from hyperserv.servercommands import ServerError | ||
|
||
editentnumber=base.packettypenumber("EDITENT") | ||
editentlength=base.packettypes[editentnumber][1] | ||
i=0 | ||
imax=5000 | ||
istart=5000 | ||
|
||
@CSCommand("ent","trusted") | ||
def entcommand(caller, *args): | ||
ent(args) | ||
|
||
def ent(args): | ||
if len(args)==editentlength: | ||
j=args[0] | ||
args=args[1:] | ||
elif len(args)==editentlength-1: | ||
global i | ||
i+=1 | ||
i%=imax | ||
j=i | ||
else: | ||
raise ServerError("EDITENT must have 9(if id is unspecified) or 10 arguments.") | ||
base.packetSendingQueue.put((editentnumber,j+istart)+args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""This file contains the required functions for the editing features""" | ||
|
||
import sbserver | ||
from hypershade.cubescript import playerCS, CSCommand | ||
from hyperserv.servercommands import ServerError | ||
|
||
def merge(a): | ||
return (reduce(lambda y,x: x*256+y, a, 0),) | ||
|
||
def getPosition(cn): | ||
return sbserver.playerPosition(cn)[:3] | ||
|
||
def getYaw(cn): | ||
return sbserver.playerPosition(cn)[3] | ||
|
||
@CSCommand("pos","master") | ||
def getPositionCS(caller, cn=None): | ||
if cn is None: | ||
if caller[0]!="ingame": | ||
raise ServerError("You are not ingame. Please specify cn.") | ||
cn=int(caller[1]) | ||
return "Pos: %s, Yaw: %s" %(getPosition(int(cn)),getYaw(int(cn))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python | ||
from hypershade.cubescript import playerCS, CSCommand | ||
from hyperserv.servercommands import ServerError | ||
from hyperserv.position import getPosition | ||
from editing.base import sendpacket | ||
from editing.ents import ent | ||
|
||
flamecolours = { | ||
"good": 0, | ||
"evil": 15, | ||
"neutral": 240, | ||
} | ||
|
||
@CSCommand("mark","trusted") | ||
def mark(caller,color): | ||
cn=int(caller[1]) | ||
color=flamecolours[color] | ||
position=map(lambda a: a*16, getPosition(cn)) | ||
entity=(position[0],position[1],position[2]+64,5,0,0,0,color,0) | ||
ent(entity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters