Skip to content

Commit

Permalink
Revert "Revert "Bay update.""
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Feb 7, 2016
1 parent 97fc3c2 commit 7c3993b
Show file tree
Hide file tree
Showing 136 changed files with 1,163 additions and 1,513 deletions.
94 changes: 42 additions & 52 deletions bot/NanoTrasenBot.py
Expand Up @@ -35,10 +35,9 @@
try:
tiedosto = open("psycodownload.txt","r")
except:
tiedosto = open("psycodownload.txt","w")
tiedosto.write("http://www.voidspace.org.uk/python/modules.shtml#psyco")
tiedosto.write("\nhttp://psyco.sourceforge.net/download.html")
tiedosto.close()
with open("psycodownload.txt","w") as tiedosto:
tiedosto.write("http://www.voidspace.org.uk/python/modules.shtml#psyco")
tiedosto.write("\nhttp://psyco.sourceforge.net/download.html")
print "Check psycodownload.txt for a link"
else:
print "For god's sake, open psycodownload.txt"
Expand Down Expand Up @@ -190,15 +189,13 @@ def psyco_bond(func):
if CORE_DATA.DISABLE_ALL_NON_MANDATORY_SOCKET_CONNECTIONS:
nudgeable = False
try:
tiedosto = open("replacenames.cache","r")
replacenames = pickle.load(tiedosto)
tiedosto.close()
with open("replacenames.cache","r") as tiedosto:
replacenames = pickle.load(tiedosto)
for i in replacenames.values():
if len(i) > call_me_max_length:
replacenames[replacenames.keys()[replacenames.values().index(i)]] = i[:call_me_max_length]
tiedosto = open("replacenames.cache","w")
pickle.dump(replacenames,tiedosto)
tiedosto.close()
with open("replacenames.cache","w") as tiedosto:
pickle.dump(replacenames,tiedosto)
if "[\0x01]" in i.lower() or "[\\0x01]" in i.lower():
i = i.replace("[\0x01]","")
i = i.replace("[\0X01]","")
Expand All @@ -211,13 +208,12 @@ def psyco_bond(func):
replacenames = {}
print "replacenames.cache is corrupt and couldn't be loaded."
try:
tiedosto = open("peopleheknows.cache","r")
peopleheknows = pickle.load(tiedosto)
tiedosto.close()
with open("peopleheknows.cache","r") as tiedosto:
peopleheknows = pickle.load(tiedosto)
except IOError:
peopleheknows = [[],[]]
tiedosto = open("peopleheknows.cache","w")
tiedosto.close()
with open("peopleheknows.cache","w") as tiedosto:
pass
except EOFError:
peopleheknows = [[],[]]
print "peopleheknows.cache is corrupt and couldn't be loaded."
Expand Down Expand Up @@ -345,16 +341,14 @@ def aggressive_ping(delay,refresh):
self_time = 0
global backup,disconnects,conn
while disconnects < 5:
if backup > self_time:
if time.time()-backup > delay:
conn.send("PONG "+pongtarg)
print "Ponged"
self_time = time.time()
else:
if time.time()-self_time > delay:
conn.send("PONG "+pongtarg)
print "Ponged"
self_time = time.time()
if backup > self_time and time.time()-backup > delay:
conn.send("PONG "+pongtarg)
print "Ponged"
self_time = time.time()
elif time.time()-self_time > delay:
conn.send("PONG "+pongtarg)
print "Ponged"
self_time = time.time()
time.sleep(refresh)
thread.start_new_thread(aggressive_ping,(aggressive_pinging_delay,aggressive_pinging_refresh,))
def stop(sender,debug=1):
Expand All @@ -370,16 +364,15 @@ def stop(sender,debug=1):
access_granted = True
else:
access_granted = False
if access_granted:
if debug:
print sender+":"+prefix+"stop"
if random.randint(0,100) == 50:
conn.privmsg(channel,"Hammertime!")
else:
conn.privmsg(channel,"Shutting down.")
disconnects = 99999
conn.quit()
return True
if access_granted and debug:
print sender+":"+prefix+"stop"
if random.randint(0,100) == 50:
conn.privmsg(channel,"Hammertime!")
else:
conn.privmsg(channel,"Shutting down.")
disconnects = 99999
conn.quit()
return True
else:
conn.privmsg(channel,"You cannot command me")
return False
Expand All @@ -401,13 +394,12 @@ def target(who,how_long):
if debug:
print "Banned",who,"For",how_long,"seconds"
if logbans:
tiedosto = open(targetdirectory+"banlog/"+str(int(start))+"-"+str(int(end))+".txt","w")
tiedosto.write("Start of ban on "+who+":"+str(int(start)))
tiedosto.write("\n")
tiedosto.write("End of ban on "+who+":"+str(int(end)))
tiedosto.write("\n")
tiedosto.write("In total:"+str(int(end-start))+"Seconds")
tiedosto.close()
with open(targetdirectory+"banlog/"+str(int(start))+"-"+str(int(end))+".txt","w") as tiedosto:
tiedosto.write("Start of ban on "+who+":"+str(int(start)))
tiedosto.write("\n")
tiedosto.write("End of ban on "+who+":"+str(int(end)))
tiedosto.write("\n")
tiedosto.write("In total:"+str(int(end-start))+"Seconds")
else:
CALL_OFF = False
pass
Expand Down Expand Up @@ -576,13 +568,12 @@ def autoRecv():
time.sleep(6)
Name = origname
conn.nick(Name)
if origname in truesender:
if influx == prefix+"stop":
time.sleep(0.5) #A small delay
conn.privmsg(channel,"Shutting down.")
conn.quit()
disconnects = 99999
break
if origname in truesender and influx == prefix+"stop":
time.sleep(0.5) #A small delay
conn.privmsg(channel,"Shutting down.")
conn.quit()
disconnects = 99999
break
if len(translateable) > 0 and enabled == True:
people = "-5|5|1-".join(users).lower()
if truesender.lower() in translateable:
Expand Down Expand Up @@ -633,9 +624,8 @@ def autoRecv():
arg = influx.lower()[8+len(prefix):]
if debug:
print truesender+":"+prefix+"suggest "+arg
tiedosto = open(targetdirectory+"suggestions/suggestions_"+str(int(time.time()))+".txt","a")
tiedosto.write(arg)
tiedosto.close()
with open(targetdirectory+"suggestions/suggestions_"+str(int(time.time()))+".txt","a") as tiedosto:
tiedosto.write(arg)
conn.privmsg(targetchannel,"Suggestion received")
elif cocheck( prefix+"help "): #Space in front of the ( to make sure that my command finder does not pick this up.
arg = " ".join(influx.split(" ")[1:]).lower()
Expand Down
3 changes: 0 additions & 3 deletions code/ATMOSPHERICS/datum_pipeline.dm
Expand Up @@ -28,9 +28,6 @@ datum/pipeline
if(!member.check_pressure(pressure))
break //Only delete 1 pipe per process

//Allow for reactions
//air.react() //Should be handled by pipe_network now

proc/temporarily_store_air()
//Update individual gas_mixtures by volume ratio

Expand Down
1 change: 1 addition & 0 deletions code/__defines/atmos.dm
Expand Up @@ -19,6 +19,7 @@
#define BREATH_MOLES (ONE_ATMOSPHERE * BREATH_VOLUME / (T20C * R_IDEAL_GAS_EQUATION)) // Amount of air to take a from a tile
#define BREATH_PERCENTAGE (BREATH_VOLUME / CELL_VOLUME) // Amount of air needed before pass out/suffocation commences.
#define HUMAN_NEEDED_OXYGEN (MOLES_CELLSTANDARD * BREATH_PERCENTAGE * 0.16)
#define HUMAN_HEAT_CAPACITY 280000 //J/K For 80kg person

#define SOUND_MINIMUM_PRESSURE 10

Expand Down
1 change: 1 addition & 0 deletions code/__defines/math_physics.dm
Expand Up @@ -13,6 +13,7 @@
#define GAS_CRITICAL_TEMPERATURE 132.65 // K. The critical point temperature for air.

#define RADIATOR_EXPOSED_SURFACE_AREA_RATIO 0.04 // (3 cm + 100 cm * sin(3deg))/(2*(3+100 cm)). Unitless ratio.
#define HUMAN_EXPOSED_SURFACE_AREA 5.2 //m^2, surface area of 1.7m (H) x 0.46m (D) cylinder

#define T0C 273.15 // 0.0 degrees celcius
#define T20C 293.15 // 20.0 degrees celcius
Expand Down
1 change: 1 addition & 0 deletions code/__defines/mobs.dm
Expand Up @@ -25,6 +25,7 @@
#define BORGMESON 0x1
#define BORGTHERM 0x2
#define BORGXRAY 0x4
#define BORGMATERIAL 8

#define HOSTILE_STANCE_IDLE 1
#define HOSTILE_STANCE_ALERT 2
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Expand Up @@ -269,7 +269,7 @@
user.listed_turf = null
else
user.listed_turf = T
user.client.statpanel = T.name
user.client.statpanel = "Turf"
return 1

/mob/proc/TurfAdjacent(var/turf/T)
Expand Down
52 changes: 48 additions & 4 deletions code/_onclick/hud/movable_screen_objects.dm
@@ -1,3 +1,4 @@

//////////////////////////
//Movable Screen Objects//
// By RemieRichards //
Expand Down Expand Up @@ -30,9 +31,10 @@

//Split X+Pixel_X up into list(X, Pixel_X)
var/list/screen_loc_X = text2list(screen_loc_params[1],":")

screen_loc_X[1] = encode_screen_X(text2num(screen_loc_X[1]))
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
var/list/screen_loc_Y = text2list(screen_loc_params[2],":")
screen_loc_Y[1] = encode_screen_Y(text2num(screen_loc_Y[1]))

if(snap2grid) //Discard Pixel Values
screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]"
Expand All @@ -42,8 +44,50 @@
var/pix_Y = text2num(screen_loc_Y[2]) - 16
screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]"

moved = TRUE

/obj/screen/movable/proc/encode_screen_X(X)
if(X > usr.client.view+1)
. = "EAST-[usr.client.view*2 + 1-X]"
else if(X < usr.client.view+1)
. = "WEST+[X-1]"
else
. = "CENTER"

/obj/screen/movable/proc/decode_screen_X(X)
//Find EAST/WEST implementations
if(findtext(X,"EAST-"))
var/num = text2num(copytext(X,6)) //Trim EAST-
if(!num)
num = 0
. = usr.client.view*2 + 1 - num
else if(findtext(X,"WEST+"))
var/num = text2num(copytext(X,6)) //Trim WEST+
if(!num)
num = 0
. = num+1
else if(findtext(X,"CENTER"))
. = usr.client.view+1

/obj/screen/movable/proc/encode_screen_Y(Y)
if(Y > usr.client.view+1)
. = "NORTH-[usr.client.view*2 + 1-Y]"
else if(Y < usr.client.view+1)
. = "SOUTH+[Y-1]"
else
. = "CENTER"

/obj/screen/movable/proc/decode_screen_Y(Y)
if(findtext(Y,"NORTH-"))
var/num = text2num(copytext(Y,7)) //Trim NORTH-
if(!num)
num = 0
. = usr.client.view*2 + 1 - num
else if(findtext(Y,"SOUTH+"))
var/num = text2num(copytext(Y,7)) //Time SOUTH+
if(!num)
num = 0
. = num+1
else if(findtext(Y,"CENTER"))
. = usr.client.view+1

//Debug procs
/client/proc/test_movable_UI()
Expand Down Expand Up @@ -81,4 +125,4 @@

S.screen_loc = screen_l

screen += S
screen += S
52 changes: 34 additions & 18 deletions code/_onclick/hud/spell_screen_objects.dm
Expand Up @@ -19,9 +19,12 @@
spell_objects.Cut()
if(spell_holder)
spell_holder.spell_masters -= src
if(spell_holder.client && spell_holder.client.screen)
spell_holder.client.screen -= src
spell_holder = null

/obj/screen/movable/spell_master/ResetVars()
..("spell_objects")
..("spell_objects", args)
spell_objects = list()

/obj/screen/movable/spell_master/MouseDrop()
Expand All @@ -47,25 +50,34 @@
overlays.len = 0
overlays.Add(closed_state)
else if(forced_state != 1)
var/temp_loc = screen_loc

var/x_position = text2num(copytext(temp_loc, 1, findtext(temp_loc, ":")))
var/x_pix = text2num(copytext(temp_loc, findtext(temp_loc, ":") + 1, findtext(temp_loc, ",")))
temp_loc = copytext(temp_loc, findtext(temp_loc, ",") + 1)
var/y_position = text2num(copytext(temp_loc, 1, findtext(temp_loc, ":")))
var/y_pix = text2num(copytext(temp_loc, findtext(temp_loc, ":")+1))

for(var/i = 1; i <= spell_objects.len; i++)
var/obj/screen/spell/S = spell_objects[i]
S.screen_loc = "[x_position + (x_position < 8 ? 1 : -1)*(i%7)]:[x_pix],[y_position + (y_position < 8 ? round(i/7) : -round(i/7))]:[y_pix]"
if(spell_holder && spell_holder.client)
spell_holder.client.screen += S
S.handle_icon_updates = 1
open_spellmaster()
update_spells(1)
showing = 1
overlays.len = 0
overlays.Add(open_state)

/obj/screen/movable/spell_master/proc/open_spellmaster()
var/list/screen_loc_xy = text2list(screen_loc,",")

//Create list of X offsets
var/list/screen_loc_X = text2list(screen_loc_xy[1],":")
var/x_position = decode_screen_X(screen_loc_X[1])
var/x_pix = screen_loc_X[2]

//Create list of Y offsets
var/list/screen_loc_Y = text2list(screen_loc_xy[2],":")
var/y_position = decode_screen_Y(screen_loc_Y[1])
var/y_pix = screen_loc_Y[2]

for(var/i = 1; i <= spell_objects.len; i++)
var/obj/screen/spell/S = spell_objects[i]
var/xpos = x_position + (x_position < 8 ? 1 : -1)*(i%7)
var/ypos = y_position + (y_position < 8 ? round(i/7) : -round(i/7))
S.screen_loc = "[encode_screen_X(xpos)]:[x_pix],[encode_screen_Y(ypos)]:[y_pix]"
if(spell_holder && spell_holder.client)
spell_holder.client.screen += S
S.handle_icon_updates = 1

/obj/screen/movable/spell_master/proc/add_spell(var/spell/spell)
if(!spell) return

Expand All @@ -74,13 +86,14 @@
return
else
spell_objects.Add(spell.connected_button)
toggle_open(2)
if(spell_holder.client)
toggle_open(2)
return

if(spell.spell_flags & NO_BUTTON) //no button to add if we don't get one
return

var/obj/screen/spell/newscreen = new /obj/screen/spell
var/obj/screen/spell/newscreen = PoolOrNew(/obj/screen/spell)
newscreen.spellmaster = src
newscreen.spell = spell

Expand All @@ -96,7 +109,8 @@
newscreen.name = spell.name
newscreen.update_charge(1)
spell_objects.Add(newscreen)
toggle_open(2) //forces the icons to refresh on screen
if(spell_holder.client)
toggle_open(2) //forces the icons to refresh on screen

/obj/screen/movable/spell_master/proc/remove_spell(var/spell/spell)
qdel(spell.connected_button)
Expand Down Expand Up @@ -151,6 +165,8 @@
last_charged_icon = null
if(spellmaster)
spellmaster.spell_objects -= src
if(spellmaster.spell_holder && spellmaster.spell_holder.client)
spellmaster.spell_holder.client.screen -= src
if(spellmaster && !spellmaster.spell_objects.len)
qdel(spellmaster)
spellmaster = null
Expand Down
6 changes: 3 additions & 3 deletions code/controllers/voting.dm
Expand Up @@ -39,12 +39,12 @@ datum/controller/vote
result()
for(var/client/C in voting)
if(C)
C << browse(null,"window=vote;can_close=0")
C << browse(null,"window=vote")
reset()
else
for(var/client/C in voting)
if(C)
C << browse(vote.interface(C),"window=vote;can_close=0")
C << browse(vote.interface(C),"window=vote")

voting.Cut()

Expand Down Expand Up @@ -392,4 +392,4 @@ datum/controller/vote
set name = "Vote"

if(vote)
src << browse(vote.interface(client),"window=vote;can_close=0")
src << browse(vote.interface(client),"window=vote")

0 comments on commit 7c3993b

Please sign in to comment.