New opendream pragmas (#20260)

Enabled new opendream pragmas
Fixed some runtime access check operators (`:`) around the codebase (not
all, some are unfixable as they're used in macros)

No player facing changes (hopefully)
This commit is contained in:
Fluffy
2024-12-29 11:12:09 +00:00
committed by GitHub
parent f55072cc42
commit 1ba0b35838
60 changed files with 324 additions and 813 deletions
+4 -3
View File
@@ -71,9 +71,10 @@
var/a_ip
if(holder && holder.owner && istype(holder.owner, /client))
a_ckey = holder.owner:ckey
a_computerid = holder.owner:computer_id
a_ip = holder.owner:address
var/client/owner_client = holder.owner
a_ckey = owner_client.ckey
a_computerid = owner_client.computer_id
a_ip = owner_client.address
else
a_ckey = "Adminbot"
a_computerid = ""
+4 -4
View File
@@ -202,11 +202,11 @@
var/list/keys = list()
for(var/mob/M in GLOB.player_list)
keys += M.client
var/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sortKey(keys)
var/client/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sortKey(keys)
if(!selection)
to_chat(src, "No keys found.")
return
var/mob/M = selection:mob
var/mob/M = selection.mob
log_admin("[key_name(usr)] jumped to [key_name(M)]")
message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]", 1)
usr.on_mob_jump()
@@ -242,10 +242,10 @@
var/list/keys = list()
for(var/mob/M in GLOB.player_list)
keys += M.client
var/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sortKey(keys)
var/client/selection = input("Please, select a player!", "Admin Jumping", null, null) as null|anything in sortKey(keys)
if(!selection)
return
var/mob/M = selection:mob
var/mob/M = selection.mob
if(!M)
return
+7 -7
View File
@@ -72,9 +72,9 @@
alert("Wait until the game starts")
return
if(istype(M, /mob/living/carbon/human))
log_admin("[key_name(src)] has robotized [M.key].")
spawn(10)
M:Robotize()
var/mob/living/carbon/human/H = M
log_admin("[key_name(src)] has robotized [H.key].")
H.Robotize()
else
alert("Invalid mob")
@@ -108,10 +108,10 @@
alert("Wait until the game starts")
return
if(ishuman(M))
log_and_message_admins("has slimeized [key_name(M)].", user = usr)
spawn(10)
M:slimeize()
feedback_add_details("admin_verb","MKMET") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
var/mob/living/carbon/human/H = M
log_and_message_admins("has slimeized [key_name(H)].", user = usr)
H.slimeize()
feedback_add_details("admin_verb","MKMET") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
alert("Invalid mob")
+2 -2
View File
@@ -89,9 +89,9 @@
output += "&nbsp;&nbsp;[filter]: ERROR<br>"
continue
output += "&nbsp;&nbsp;[filter]: [f.len]<br>"
for (var/device in f)
for (var/obj/device as anything in f)
if (isobj(device))
output += "&nbsp;&nbsp;&nbsp;&nbsp;[device] ([device:x],[device:y],[device:z] in area [get_area(device:loc)])<br>"
output += "&nbsp;&nbsp;&nbsp;&nbsp;[device] ([device.x],[device.y],[device.z] in area [get_area(device.loc)])<br>"
else
output += "&nbsp;&nbsp;&nbsp;&nbsp;[device]<br>"
+1 -1
View File
@@ -122,7 +122,7 @@
if (!istype(O, /atom))
original_name = "[REF(O)] ([O])"
else
original_name = O:name
original_name = O.name
switch(class)
if("restore to default")
+1 -1
View File
@@ -584,7 +584,7 @@ var/list/VVdynamic_lock = list(
if (!istype(O, /atom))
original_name = "[REF(O)] ([O])"
else
original_name = O:name
original_name = O.name
if(holder.marked_datum && class == "marked datum ([holder.marked_datum.type])")
class = "marked datum"
+1 -1
View File
@@ -293,7 +293,7 @@ Ccomp's first proc.
G.has_enabled_antagHUD = 2
G.can_reenter_corpse = 1
G:show_message(SPAN_NOTICE("<B>You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead.</B>"), 1)
G.show_message(SPAN_NOTICE("<B>You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead.</B>"), 1)
log_admin("[key_name(usr)] allowed [key_name(G)] to bypass the [GLOB.config.respawn_delay] minute respawn limit")
message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(G)] to bypass the [GLOB.config.respawn_delay] minute respawn limit", 1)
@@ -92,12 +92,15 @@
return null
/obj/machinery/atmospherics/unary/vent_pump/proc/is_welded() // TODO: refactor welding into unary
if (welded > 0)
return 1
return 0
/obj/machinery/atmospherics/unary/proc/is_welded()
return FALSE
/obj/machinery/atmospherics/unary/vent_scrubber/proc/is_welded()
/obj/machinery/atmospherics/unary/vent_pump/is_welded()
if (welded > 0)
return 1
return 0
return TRUE
return FALSE
/obj/machinery/atmospherics/unary/vent_scrubber/is_welded()
if (welded > 0)
return TRUE
return FALSE
+4 -3
View File
@@ -74,10 +74,11 @@
var/energy_to_temp = parent.air.get_thermal_energy_change(lava_temperature)
parent.air.add_thermal_energy(max(min(energy_to_temp, max_energy_change), 0))
else if(istype(loc, /turf/simulated/))
else if(istype(loc, /turf/simulated))
var/turf/simulated/simulated_turf = loc
var/environment_temperature = 0
if(loc:blocks_air)
environment_temperature = loc:temperature
if(simulated_turf.blocks_air)
environment_temperature = simulated_turf.temperature
else
var/datum/gas_mixture/environment = loc.return_air()
environment_temperature = environment.temperature
+6 -4
View File
@@ -479,6 +479,7 @@
/obj/machinery/bookbinder/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paper))
var/obj/item/paper/paper = attacking_item
if(!anchored)
to_chat(user, SPAN_WARNING("\The [src] must be secured to the floor first!"))
return
@@ -486,7 +487,7 @@
to_chat(user, SPAN_WARNING("You must wait for \the [src] to finish its current operation!"))
return
var/turf/T = get_turf(src)
user.drop_from_inventory(attacking_item,src)
user.drop_from_inventory(paper,src)
user.visible_message(SPAN_NOTICE("\The [user] loads some paper into \the [src]."), SPAN_NOTICE("You load some paper into \the [src]."))
visible_message(SPAN_NOTICE("\The [src] begins to hum as it warms up its printing drums."))
playsound(T, 'sound/bureaucracy/binder.ogg', 75, 1)
@@ -495,16 +496,17 @@
binding = FALSE
if(!anchored)
visible_message(SPAN_WARNING("\The [src] buzzes and flashes an error light."))
attacking_item.forceMove(T)
paper.forceMove(T)
return
visible_message(SPAN_NOTICE("\The [src] whirs as it prints and binds a new book."))
playsound(T, 'sound/bureaucracy/print.ogg', 75, 1)
var/obj/item/book/b = new(T)
b.dat = attacking_item:info
b.dat = paper.info
b.name = "blank book"
b.icon_state = "book[rand(1,7)]"
qdel(attacking_item)
qdel(paper)
return
if(attacking_item.iswrench())
attacking_item.play_tool_sound(get_turf(src), 75)
if(anchored)
+6 -2
View File
@@ -304,8 +304,12 @@
if (light_angle)
var/ndir
if (istype(top_atom, /mob) && top_atom:facing_dir)
ndir = top_atom:facing_dir
if(istype(top_atom, /mob) && top_atom:facing_dir)
var/mob/mob = top_atom
if(mob.facing_dir)
ndir = mob.facing_dir
else
ndir = top_atom.dir
else
ndir = top_atom.dir
-599
View File
@@ -1,599 +0,0 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/*
SwapMaps library by Lummox JR
developed for digitalBYOND
http://www.digitalbyond.org
Version 2.1
The purpose of this library is to make it easy for authors to swap maps
in and out of their game using savefiles. Swapped-out maps can be
transferred between worlds for an MMORPG, sent to the client, etc.
This is facilitated by the use of a special datum and a global list.
Uses of swapmaps:
- Temporary battle arenas
- House interiors
- Individual custom player houses
- Virtually unlimited terrain
- Sharing maps between servers running different instances of the same game
- Loading and saving pieces of maps for reusable room templates
*/
/*
User Interface:
VARS:
swapmaps_iconcache
An associative list of icon files with names, like
'player.dmi' = "player"
swapmaps_mode
This must be set at runtime, like in world/New().
SWAPMAPS_SAV 0 (default)
Uses .sav files for raw /savefile output.
SWAPMAPS_TEXT 1
Uses .txt files via ExportText() and ImportText(). These maps
are easily editable and appear to take up less space in the
current version of BYOND.
PROCS:
SwapMaps_Find(id)
Find a map by its id
SwapMaps_Load(id)
Load a map by its id
SwapMaps_Save(id)
Save a map by its id (calls swapmap.Save())
SwapMaps_Unload(id)
Save and unload a map by its id (calls swapmap.Unload())
SwapMaps_Save_All()
Save all maps
SwapMaps_DeleteFile(id)
Delete a map file
SwapMaps_CreateFromTemplate(id)
Create a new map by loading another map to use as a template.
This map has id==src and will not be saved. To make it savable,
change id with swapmap.SetID(newid).
SwapMaps_LoadChunk(id,turf/locorner)
Load a swapmap as a "chunk", at a specific place. A new datum is
created but it's not added to the list of maps to save or unload.
The new datum can be safely deleted without affecting the turfs
it loaded. The purpose of this is to load a map file onto part of
another swapmap or an existing part of the world.
locorner is the corner turf with the lowest x,y,z values.
SwapMaps_SaveChunk(id,turf/corner1,turf/corner2)
Save a piece of the world as a "chunk". A new datum is created
for the chunk, but it can be deleted without destroying any turfs.
The chunk file can be reloaded as a swapmap all its own, or loaded
via SwapMaps_LoadChunk() to become part of another map.
SwapMaps_GetSize(id)
Return a list corresponding to the x,y,z sizes of a map file,
without loading the map.
Returns null if the map is not found.
SwapMaps_AddIconToCache(name,icon)
Cache an icon file by name for space-saving storage
swapmap.New(id,x,y,z)
Create a new map; specify id, width (x), height (y), and depth (z)
Default size is world.maxx,world.maxy,1
swapmap.New(id,turf1,turf2)
Create a new map; specify id and 2 corners
This becomes a /swapmap for one of the compiled-in maps, for easy saving.
swapmap.New()
Create a new map datum, but does not allocate space or assign an ID (used for loading).
swapmap.Del()
Deletes a map but does not save
swapmap.Save()
Saves to map_[id].sav
Maps with id==src are not saved.
swapmap.Unload()
Saves the map and then deletes it
Maps with id==src are not saved.
swapmap.SetID(id)
Change the map's id and make changes to the lookup list
swapmap.AllTurfs(z)
Returns a block of turfs encompassing the entire map, or on just one z-level
z is in world coordinates; it is optional
swapmap.Contains(turf/T)
Returns nonzero if T is inside the map's boundaries.
Also works for objs and mobs, but the proc is not area-safe.
swapmap.InUse()
Returns nonzero if a mob with a key is within the map's boundaries.
swapmap.LoCorner(z=z1)
Returns locate(x1,y1,z), where z=z1 if none is specified.
swapmap.HiCorner(z=z2)
Returns locate(x2,y2,z), where z=z2 if none is specified.
swapmap.BuildFilledRectangle(turf/corner1,turf/corner2,item)
Builds a filled rectangle of item from one corner turf to the other, on multiple z-levels if necessary. The corners may be specified in any order.
item is a type path like /turf/wall or /obj/barrel{full=1}.
swapmap.BuildRectangle(turf/corner1,turf/corner2,item)
Builds an unfilled rectangle of item from one corner turf to the other, on multiple z-levels if necessary.
swapmap.BuildInTurfs(list/turfs,item)
Builds item on all of the turfs listed. The list need not contain only turfs, or even only atoms.
*/
/swapmap
var/id // a string identifying this map uniquely
var/x1 // minimum x,y,z coords
var/y1
var/z1
var/x2 // maximum x,y,z coords (also used as width,height,depth until positioned)
var/y2
var/z2
var/tmp/locked // don't move anyone to this map; it's saving or loading
var/tmp/mode // save as text-mode
var/ischunk // tells the load routine to load to the specified location
/swapmap/New(_id,x,y,z)
if(isnull(_id)) return
id=_id
mode=swapmaps_mode
if(isturf(x) && isturf(y))
/*
Special format: Defines a map as an existing set of turfs;
this is useful for saving a compiled map in swapmap format.
Because this is a compiled-in map, its turfs are not deleted
when the datum is deleted.
*/
x1=min(x:x,y:x);x2=max(x:x,y:x)
y1=min(x:y,y:y);y2=max(x:y,y:y)
z1=min(x:z,y:z);z2=max(x:z,y:z)
InitializeSwapMaps()
if(z2>swapmaps_compiled_maxz ||\
y2>swapmaps_compiled_maxy ||\
x2>swapmaps_compiled_maxx)
qdel(src)
return
x2=x?(x):world.maxx
y2=y?(y):world.maxy
z2=z?(z):1
AllocateSwapMap()
/swapmap/Del()
// a temporary datum for a chunk can be deleted outright
// for others, some cleanup is necessary
if(!ischunk)
swapmaps_loaded-=src
swapmaps_byname-=id
if(z2>swapmaps_compiled_maxz ||\
y2>swapmaps_compiled_maxy ||\
x2>swapmaps_compiled_maxx)
var/list/areas=new
for(var/atom/A in block(locate(x1,y1,z1),locate(x2,y2,z2)))
for(var/obj/O in A) qdel(O)
for(var/mob/M in A)
if(!M.key) qdel(M)
else M.loc=null
areas[A.loc]=null
qdel(A)
// delete areas that belong only to this map
for(var/area/a in areas)
if(a && !a.contents.len) qdel(a)
if(x2>=world.maxx || y2>=world.maxy || z2>=world.maxz) CutXYZ()
qdel(areas)
..()
/swapmap/Read(savefile/S,_id,turf/locorner)
var/x
var/y
var/z
var/n
var/list/areas
var/area/defarea=locate(world.area)
id=_id
if(locorner)
ischunk=1
x1=locorner.x
y1=locorner.y
z1=locorner.z
if(!defarea) defarea=new world.area
if(!_id)
S["id"] >> id
else
var/dummy
S["id"] >> dummy
S["z"] >> z2 // these are depth,
S["y"] >> y2 // height,
S["x"] >> x2 // width
S["areas"] >> areas
locked=1
AllocateSwapMap() // adjust x1,y1,z1 - x2,y2,z2 coords
var/oldcd=S.cd
for(z=z1,z<=z2,++z)
S.cd="[z-z1+1]"
for(y=y1,y<=y2,++y)
S.cd="[y-y1+1]"
for(x=x1,x<=x2,++x)
S.cd="[x-x1+1]"
var/tp
S["type"]>>tp
var/turf/T=locate(x,y,z)
T.loc.contents-=T
T=new tp(locate(x,y,z))
if("AREA" in S.dir)
S["AREA"]>>n
var/area/A=areas[n]
A.contents+=T
else defarea.contents+=T
// clear the turf
for(var/obj/O in T) qdel(O)
for(var/mob/M in T)
if(!M.key) qdel(M)
else M.loc=null
// finish the read
T.Read(S)
S.cd=".."
S.cd=".."
sleep()
S.cd=oldcd
locked=0
qdel(areas)
/*
Find an empty block on the world map in which to load this map.
If no space is found, increase world.maxz as necessary. (If the
map is greater in x,y size than the current world, expand
world.maxx and world.maxy too.)
Ignore certain operations if loading a map as a chunk. Use the
x1,y1,z1 position for it, and *don't* count it as a loaded map.
*/
/swapmap/proc/AllocateSwapMap()
InitializeSwapMaps()
world.maxx=max(x2,world.maxx) // stretch x/y if necessary
world.maxy=max(y2,world.maxy)
if(!ischunk)
if(world.maxz<=swapmaps_compiled_maxz)
z1=swapmaps_compiled_maxz+1
x1=1;y1=1
else
var/list/l=ConsiderRegion(1,1,world.maxx,world.maxy,swapmaps_compiled_maxz+1)
x1=l[1]
y1=l[2]
z1=l[3]
qdel(l)
x2+=x1-1
y2+=y1-1
z2+=z1-1
if(z2 > world.maxz)
world.maxz = z2 // stretch z if necessary
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, world.maxz)
if(!ischunk)
swapmaps_loaded[src]=null
swapmaps_byname[id]=src
/swapmap/proc/ConsiderRegion(X1,Y1,X2,Y2,Z1,Z2)
while(1)
var/nextz=0
var/swapmap/M
for(M in swapmaps_loaded)
if(M.z2<Z1 || (Z2 && M.z1>Z2) || M.z1>=Z1+z2 ||\
M.x1>X2 || M.x2<X1 || M.x1>=X1+x2 ||\
M.y1>Y2 || M.y2<Y1 || M.y1>=Y1+y2) continue
// look for sub-regions with a defined ceiling
var/nz2=Z2?(Z2):Z1+z2-1+M.z2-M.z1
if(M.x1>=X1+x2)
.=ConsiderRegion(X1,Y1,M.x1-1,Y2,Z1,nz2)
if(.) return
else if(M.x2<=X2-x2)
.=ConsiderRegion(M.x2+1,Y1,X2,Y2,Z1,nz2)
if(.) return
if(M.y1>=Y1+y2)
.=ConsiderRegion(X1,Y1,X2,M.y1-1,Z1,nz2)
if(.) return
else if(M.y2<=Y2-y2)
.=ConsiderRegion(X1,M.y2+1,X2,Y2,Z1,nz2)
if(.) return
nextz=nextz?min(nextz,M.z2+1):(M.z2+1)
if(!M)
/* If nextz is not 0, then at some point there was an overlap that
could not be resolved by using an area to the side */
if(nextz) Z1=nextz
if(!nextz || (Z2 && Z2-Z1+1<z2))
return (!Z2 || Z2-Z1+1>=z2)?list(X1,Y1,Z1):null
X1=1;X2=world.maxx
Y1=1;Y2=world.maxy
/swapmap/proc/CutXYZ()
var/mx=swapmaps_compiled_maxx
var/my=swapmaps_compiled_maxy
var/mz=swapmaps_compiled_maxz
for(var/swapmap/M in swapmaps_loaded) // may not include src
mx=max(mx,M.x2)
my=max(my,M.y2)
mz=max(mz,M.z2)
world.maxx=mx
world.maxy=my
world.maxz=mz
// save and delete
/swapmap/proc/Unload()
Save()
qdel(src)
/swapmap/proc/Save()
if(id==src) return 0
var/savefile/S=mode?(new):new("map_[id].sav")
to_chat(S, src)
while(locked) sleep(1)
if(mode)
fdel("map_[id].txt")
S.ExportText("/","map_[id].txt")
return 1
// this will not delete existing savefiles for this map
/swapmap/proc/SetID(newid)
swapmaps_byname-=id
id=newid
swapmaps_byname[id]=src
/swapmap/proc/AllTurfs(z)
if(isnum(z) && (z<z1 || z>z2)) return null
return block(LoCorner(z),HiCorner(z))
// this could be safely called for an obj or mob as well, but
// probably not an area
/swapmap/proc/Contains(turf/T)
return (T && T.x>=x1 && T.x<=x2\
&& T.y>=y1 && T.y<=y2\
&& T.z>=z1 && T.z<=z2)
/swapmap/proc/InUse()
for(var/turf/T in AllTurfs())
for(var/mob/M in T) if(M.key) return 1
/swapmap/proc/LoCorner(z=z1)
return locate(x1,y1,z)
/swapmap/proc/HiCorner(z=z2)
return locate(x2,y2,z)
// Build procs: Take 2 turfs as corners, plus an item type.
// An item may be like:
//
// /turf/wall
// /obj/fence{icon_state="iron"}
/swapmap/proc/BuildFilledRectangle(turf/T1,turf/T2,item)
if(!Contains(T1) || !Contains(T2)) return
var/turf/T=T1
// pick new corners in a block()-friendly form
T1=locate(min(T1.x,T2.x),min(T1.y,T2.y),min(T1.z,T2.z))
T2=locate(max(T.x,T2.x),max(T.y,T2.y),max(T.z,T2.z))
for(T in block(T1,T2)) new item(T)
/swapmap/proc/BuildRectangle(turf/T1,turf/T2,item)
if(!Contains(T1) || !Contains(T2)) return
var/turf/T=T1
// pick new corners in a block()-friendly form
T1=locate(min(T1.x,T2.x),min(T1.y,T2.y),min(T1.z,T2.z))
T2=locate(max(T.x,T2.x),max(T.y,T2.y),max(T.z,T2.z))
if(T2.x-T1.x<2 || T2.y-T1.y<2) BuildFilledRectangle(T1,T2,item)
else
//for(T in block(T1,T2)-block(locate(T1.x+1,T1.y+1,T1.z),locate(T2.x-1,T2.y-1,T2.z)))
for(T in block(T1,locate(T2.x,T1.y,T2.z))) new item(T)
for(T in block(locate(T1.x,T2.y,T1.z),T2)) new item(T)
for(T in block(locate(T1.x,T1.y+1,T1.z),locate(T1.x,T2.y-1,T2.z))) new item(T)
for(T in block(locate(T2.x,T1.y+1,T1.z),locate(T2.x,T2.y-1,T2.z))) new item(T)
/*
Supplementary build proc: Takes a list of turfs, plus an item
type. Actually the list doesn't have to be just turfs.
*/
/swapmap/proc/BuildInTurfs(list/turfs,item)
for(var/T in turfs) new item(T)
/atom/Read(savefile/S)
var/list/l
if(contents.len) l=contents
..()
// if the icon was a text string, it would not have loaded properly
// replace it from the cache list
if(!icon && ("icon" in S.dir))
var/ic
S["icon"]>>ic
if(istext(ic)) icon=swapmaps_iconcache[ic]
if(l && contents!=l)
contents+=l
qdel(l)
// set this up (at runtime) as follows:
// list(
// 'player.dmi'="player",
// 'monster.dmi'="monster",
// ...
// 'item.dmi'="item")
var/list/swapmaps_iconcache
// preferred mode; sav or text
var/const/SWAPMAPS_SAV=0
var/const/SWAPMAPS_TEXT=1
var/swapmaps_mode=SWAPMAPS_SAV
var/swapmaps_compiled_maxx
var/swapmaps_compiled_maxy
var/swapmaps_compiled_maxz
var/swapmaps_initialized
var/swapmaps_loaded
var/swapmaps_byname
/proc/InitializeSwapMaps()
if(swapmaps_initialized) return
swapmaps_initialized=1
swapmaps_compiled_maxx=world.maxx
swapmaps_compiled_maxy=world.maxy
swapmaps_compiled_maxz=world.maxz
swapmaps_loaded=list()
swapmaps_byname=list()
if(swapmaps_iconcache)
for(var/V in swapmaps_iconcache)
// reverse-associate everything
// so you can look up an icon file by name or vice-versa
swapmaps_iconcache[swapmaps_iconcache[V]]=V
/proc/SwapMaps_AddIconToCache(name,icon)
if(!swapmaps_iconcache) swapmaps_iconcache=list()
swapmaps_iconcache[name]=icon
swapmaps_iconcache[icon]=name
/proc/SwapMaps_Find(id)
InitializeSwapMaps()
return swapmaps_byname[id]
/proc/SwapMaps_Load(id)
InitializeSwapMaps()
var/swapmap/M=swapmaps_byname[id]
if(!M)
var/savefile/S
var/text=0
if(swapmaps_mode==SWAPMAPS_TEXT && fexists("map_[id].txt"))
text=1
else if(fexists("map_[id].sav"))
S=new("map_[id].sav")
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[id].txt"))
text=1
else return // no file found
if(text)
S=new
S.ImportText("/",file("map_[id].txt"))
S >> M
while(M.locked) sleep(1)
M.mode=text
return M
/proc/SwapMaps_Save(id)
InitializeSwapMaps()
var/swapmap/M=swapmaps_byname[id]
if(M) M.Save()
return M
/proc/SwapMaps_Save_All()
InitializeSwapMaps()
for(var/swapmap/M in swapmaps_loaded)
if(M) M.Save()
/proc/SwapMaps_Unload(id)
InitializeSwapMaps()
var/swapmap/M=swapmaps_byname[id]
if(!M) return // return silently from an error
M.Unload()
return 1
/proc/SwapMaps_DeleteFile(id)
fdel("map_[id].sav")
fdel("map_[id].txt")
/proc/SwapMaps_CreateFromTemplate(template_id)
var/swapmap/M=new
var/savefile/S
var/text=0
if(swapmaps_mode==SWAPMAPS_TEXT && fexists("map_[template_id].txt"))
text=1
else if(fexists("map_[template_id].sav"))
S=new("map_[template_id].sav")
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[template_id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_CreateFromTemplate(): map_[template_id] file not found."
return
if(text)
S=new
S.ImportText("/",file("map_[template_id].txt"))
/*
This hacky workaround is needed because S >> M will create a brand new
M to fill with data. There's no way to control the Read() process
properly otherwise. The //.0 path should always match the map, however.
*/
S.cd="//.0"
M.Read(S,M)
M.mode=text
while(M.locked) sleep(1)
return M
/proc/SwapMaps_LoadChunk(chunk_id,turf/locorner)
var/swapmap/M=new
var/savefile/S
var/text=0
if(swapmaps_mode==SWAPMAPS_TEXT && fexists("map_[chunk_id].txt"))
text=1
else if(fexists("map_[chunk_id].sav"))
S=new("map_[chunk_id].sav")
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[chunk_id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_LoadChunk(): map_[chunk_id] file not found."
return
if(text)
S=new
S.ImportText("/",file("map_[chunk_id].txt"))
/*
This hacky workaround is needed because S >> M will create a brand new
M to fill with data. There's no way to control the Read() process
properly otherwise. The //.0 path should always match the map, however.
*/
S.cd="//.0"
M.Read(S,M,locorner)
while(M.locked) sleep(1)
qdel(M)
return 1
/proc/SwapMaps_SaveChunk(chunk_id,turf/corner1,turf/corner2)
if(!corner1 || !corner2)
world.log << "SwapMaps error in SwapMaps_SaveChunk():"
if(!corner1) world.log << " corner1 turf is null"
if(!corner2) world.log << " corner2 turf is null"
return
var/swapmap/M=new
M.id=chunk_id
M.ischunk=1 // this is a chunk
M.x1=min(corner1.x,corner2.x)
M.y1=min(corner1.y,corner2.y)
M.z1=min(corner1.z,corner2.z)
M.x2=max(corner1.x,corner2.x)
M.y2=max(corner1.y,corner2.y)
M.z2=max(corner1.z,corner2.z)
M.mode=swapmaps_mode
M.Save()
while(M.locked) sleep(1)
qdel(M)
return 1
/proc/SwapMaps_GetSize(id)
var/savefile/S
var/text=0
if(swapmaps_mode==SWAPMAPS_TEXT && fexists("map_[id].txt"))
text=1
else if(fexists("map_[id].sav"))
S=new("map_[id].sav")
else if(swapmaps_mode!=SWAPMAPS_TEXT && fexists("map_[id].txt"))
text=1
else
world.log << "SwapMaps error in SwapMaps_GetSize(): map_[id] file not found."
return
if(text)
S=new
S.ImportText("/",file("map_[id].txt"))
/*
The //.0 path should always be the map. There's no other way to
read this data.
*/
S.cd="//.0"
var/x
var/y
var/z
S["x"] >> x
S["y"] >> y
S["z"] >> z
return list(x,y,z)
+3 -2
View File
@@ -262,9 +262,10 @@
if((isskeleton(H)) && (!H.w_uniform) && (!H.wear_suit))
H.play_xylophone()
else
if (istype(src,/mob/living/carbon/human) && src:w_uniform)
if (istype(src,/mob/living/carbon/human))
var/mob/living/carbon/human/H = src
H.w_uniform.add_fingerprint(M)
if(H.w_uniform)
H.w_uniform.add_fingerprint(M)
var/show_ssd
var/mob/living/carbon/human/H
@@ -506,7 +506,9 @@ This saves us from having to call add_fingerprint() any time something is put in
if (lying || !shoes || !istype(shoes, /obj/item/clothing/shoes))
return
if (shoes:silent)
var/obj/item/clothing/shoes/clothing_shoes = shoes
if (clothing_shoes.silent)
return
is_noisy = TRUE
+6 -4
View File
@@ -163,10 +163,12 @@ default behaviour is:
return
step(AM, t)
if(ishuman(AM) && AM:grabbed_by)
for(var/obj/item/grab/G in AM:grabbed_by)
step(G:assailant, get_dir(G:assailant, AM))
G.adjust_position()
if(ishuman(AM))
var/mob/living/carbon/human/H = AM
if(H.grabbed_by)
for(var/obj/item/grab/G in H.grabbed_by)
step(G.assailant, get_dir(G.assailant, H))
G.adjust_position()
now_pushing = FALSE
+1 -1
View File
@@ -119,7 +119,7 @@
switch(PRP)
if (1) to_chat(src, "Unable to locate APC!")
else to_chat(src, "Lost connection with the APC!")
src:ai_restore_power_routine = 2
ai_restore_power_routine = 2
return
if (current_area.power_equip)
if (!istype(T, /turf/space))
+2 -2
View File
@@ -69,7 +69,7 @@
m_type = 1
if("law")
if (src:secHUD)
if (secHUD)
message = "<B>[src]</B> flashes its legal authorization barcode."
playsound(src.loc, 'sound/voice/biamthelaw.ogg', 50, 0)
m_type = 2
@@ -102,7 +102,7 @@
m_type = 1
if("halt")
if (src:secHUD)
if (secHUD)
message = "<B>[src]</B>'s speakers skreech, \"Halt! Security!\"."
playsound(src.loc, 'sound/voice/halt.ogg', 50, 0)
@@ -276,11 +276,11 @@
if(I && !(istype(I, /obj/item/cell) || istype(I, /obj/item/device/radio) || istype(I, /obj/machinery/camera) || istype(I, /obj/item/device/mmi)))
client.screen += I
if(module_state_1)
module_state_1:screen_loc = ui_inv1
module_state_1.screen_loc = ui_inv1
if(module_state_2)
module_state_2:screen_loc = ui_inv2
module_state_2.screen_loc = ui_inv2
if(module_state_3)
module_state_3:screen_loc = ui_inv3
module_state_3.screen_loc = ui_inv3
update_icon()
/mob/living/silicon/robot/proc/process_killswitch()
@@ -929,19 +929,22 @@
O.hud_layerise()
contents += O
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode |= module_state_1:sight_mode
var/obj/item/borg/sight/sight_module = module_state_3
sight_mode |= sight_module.sight_mode
else if(!module_state_2)
module_state_2 = O
O.hud_layerise()
contents += O
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode |= module_state_2:sight_mode
var/obj/item/borg/sight/sight_module = module_state_3
sight_mode |= sight_module.sight_mode
else if(!module_state_3)
module_state_3 = O
O.hud_layerise()
contents += O
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode |= module_state_3:sight_mode
var/obj/item/borg/sight/sight_module = module_state_3
sight_mode |= sight_module.sight_mode
else
to_chat(src, SPAN_WARNING("You need to disable a module first!"))
installed_modules()
+18 -10
View File
@@ -41,9 +41,11 @@
/proc/ishuman_species(A)
if(istype(A, /mob/living/carbon/human) && (A:get_species() == SPECIES_HUMAN))
return 1
return 0
if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = A
if(H.get_species() == SPECIES_HUMAN)
return TRUE
return FALSE
/proc/isoffworlder(A)
if(ishuman(A))
@@ -71,7 +73,8 @@
/proc/istajara(A)
if(istype(A, /mob/living/carbon/human))
switch(A:get_species())
var/mob/living/carbon/human/H = A
switch(H.get_species())
if (SPECIES_TAJARA)
return 1
if(SPECIES_TAJARA_ZHAN)
@@ -86,7 +89,8 @@
/proc/isskrell(A)
if(istype(A, /mob/living/carbon/human))
switch(A:get_species())
var/mob/living/carbon/human/H = A
switch(H.get_species())
if (SPECIES_SKRELL)
return 1
if (SPECIES_SKRELL_AXIORI)
@@ -97,7 +101,8 @@
/proc/isvaurca(A, var/isbreeder = FALSE)
if(istype(A, /mob/living/carbon/human))
switch(A:get_species())
var/mob/living/carbon/human/H = A
switch(H.get_species())
if(SPECIES_VAURCA_WORKER)
if(isbreeder)
return FALSE
@@ -151,9 +156,11 @@
return FALSE
/proc/isskeleton(A)
if(istype(A, /mob/living/carbon/human) && (A:get_species() == SPECIES_SKELETON))
return 1
return 0
if(istype(A, /mob/living/carbon/human))
var/mob/living/carbon/human/H = A
if(H.get_species() == SPECIES_SKELETON)
return TRUE
return FALSE
/proc/iszombie(A)
if(ishuman(A))
@@ -188,7 +195,8 @@
/proc/islesserform(A)
if(istype(A, /mob/living/carbon/human))
switch(A:get_species())
var/mob/living/carbon/human/H = A
switch(H.get_species())
if (SPECIES_MONKEY)
return 1
if (SPECIES_MONKEY_TAJARA)
+7 -3
View File
@@ -93,7 +93,8 @@
/client/verb/swap_hand()
set hidden = 1
if(istype(mob, /mob/living/carbon))
mob:swap_hand()
var/mob/living/carbon/C = mob
C.swap_hand()
if(istype(mob,/mob/living/silicon/robot))
var/mob/living/silicon/robot/R = mob
R.cycle_modules()
@@ -112,8 +113,11 @@
set hidden = 1
if(!istype(mob, /mob/living/carbon))
return
if (!mob.stat && isturf(mob.loc) && !mob.restrained())
mob:toggle_throw_mode()
var/mob/living/carbon/C = mob
if (!C.stat && isturf(C.loc) && !C.restrained())
C.toggle_throw_mode()
else
return
+2 -1
View File
@@ -203,7 +203,8 @@
/atom/movable/openspace/turf_mimic/Initialize(mapload, ...)
. = ..()
ASSERT(isturf(loc))
delegate = loc:below
var/turf/T = loc
delegate = T.below
/atom/movable/openspace/turf_mimic/attackby(obj/item/attacking_item, mob/user)
loc.attackby(attacking_item, user)
+2 -2
View File
@@ -210,9 +210,9 @@ var/global/photo_count = 0
holding = "They are holding \a [A.r_hand]"
if(!mob_detail)
mob_detail = "You can see [A] in the photo[A:health < 75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]. "
mob_detail = "You can see [A] in the photo[A.health < 75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]. "
else
mob_detail += "You can also see [A] in the photo[A:health < 75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]."
mob_detail += "You can also see [A] in the photo[A.health < 75 ? " - [A] looks hurt":""].[holding ? " [holding]":"."]."
return mob_detail
/obj/item/device/camera/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
@@ -46,8 +46,9 @@
if (A)
if(ismob(A))
toxmob(A)
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/)))
A:energy += energy
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity)))
var/obj/singularity/singulo = A
singulo.energy += energy
else if(istype(A, /obj/machinery/power/fusion_core))
var/obj/machinery/power/fusion_core/collided_core = A
if(particle_type && particle_type != "neutron")
+2 -2
View File
@@ -123,7 +123,7 @@
// Process the beaker
if(beaker)
var/datum/reagents/beaker_reagents = beaker:reagents
var/datum/reagents/beaker_reagents = beaker.reagents
for(var/reagent in beaker_reagents.reagent_volumes)
var/singleton/reagent/reagent_singleton = GET_SINGLETON(reagent)
@@ -199,7 +199,7 @@
// These actions makes sense only if there's a beaker in
if(beaker)
if(action == "analyze")
var/datum/reagents/R = beaker:reagents
var/datum/reagents/R = beaker.reagents
if(!condi)
if(params["name"] == "Blood")
var/singleton/reagent/blood/G = GET_SINGLETON(/singleton/reagent/blood)
@@ -141,7 +141,7 @@
var/hotspot = (locate(/obj/fire) in T)
if(hotspot && !istype(T, /turf/space))
var/datum/gas_mixture/lowertemp = T.remove_air(T:air:total_moles)
var/datum/gas_mixture/lowertemp = T.remove_air(T.air.total_moles)
lowertemp.temperature = max(lowertemp.temperature-2000, lowertemp.temperature / 2, T0C)
lowertemp.react()
T.assume_air(lowertemp)
+4 -3
View File
@@ -101,9 +101,10 @@
return
else if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us.
target.add_fingerprint(user)
var/obj/structure/reagent_dispensers/reagent_dispensers = target
reagent_dispensers.add_fingerprint(user)
if(!target.reagents.total_volume && target.reagents)
if(!reagent_dispensers.reagents.total_volume && reagent_dispensers.reagents)
to_chat(user, SPAN_WARNING("\The [target] is empty."))
return
@@ -111,7 +112,7 @@
to_chat(user, SPAN_WARNING("\The [src] is full."))
return
var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
var/trans = reagent_dispensers.reagents.trans_to(src, reagent_dispensers.amount_per_transfer_from_this)
to_chat(user, SPAN_NOTICE("You fill \the [src] with [trans] units of the contents of \the [target]."))
else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it.
@@ -173,9 +173,11 @@
/obj/machinery/artifact/attack_hand(mob/user)
if(use_check_and_message(user, USE_ALLOW_NON_ADV_TOOL_USR))
return
if(ishuman(user) && user:gloves)
to_chat(user, "<b>You touch \the [src]</b> with your gloved hands, [pick("but nothing of note happens","but nothing happens","but nothing interesting happens","but you notice nothing different","but nothing seems to have happened")].")
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.gloves)
to_chat(user, "<b>You touch \the [src]</b> with your gloved hands, [pick("but nothing of note happens","but nothing happens","but nothing interesting happens","but you notice nothing different","but nothing seems to have happened")].")
return
src.add_fingerprint(user)
@@ -251,8 +251,9 @@
possible_spawns += /obj/item/stack/material/silver
var/new_type = pick(possible_spawns)
new_item = new new_type(src.loc)
new_item:amount = rand(5,45)
var/obj/item/stack/material/new_mat_stack = new new_type(src.loc)
new_mat_stack.amount = rand(5,45)
new_item = new_mat_stack
if(15)
if(prob(75))
new_item = new /obj/item/pen(src.loc)
+2 -1
View File
@@ -42,7 +42,8 @@
affected.status &= ~ORGAN_ARTERY_CUT
affected.update_damages()
if(ishuman(user) && prob(40))
user:bloody_hands(target, 0)
var/mob/living/carbon/human/H = user
H.bloody_hands(target, 0)
/singleton/surgery_step/fix_vein/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
+1 -1
View File
@@ -151,7 +151,7 @@ var/global/list/can_enter_vent_with = list(
if(vent_found)
break
if(vent_found:is_welded()) // welded check
if(vent_found.is_welded()) // welded check
to_chat(src, SPAN_WARNING("You can't crawl into a welded vent!"))
return
@@ -33,14 +33,16 @@
/obj/machinery/atmospherics/proc/ventcrawl_to(var/mob/living/user, var/obj/machinery/atmospherics/target_move, var/direction)
if(target_move)
if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through())
if(target_move:is_welded())
var/obj/machinery/atmospherics/unary/UA = target_move
if(UA.is_welded())
user.visible_message(SPAN_WARNING("You hear something banging on \the [target_move.name]!"), SPAN_NOTICE("You can't escape from a welded vent."))
else
user.remove_ventcrawl()
user.forceMove(target_move.loc) //handles entering and so on
user.forceMove(UA.loc) //handles entering and so on
user.sight &= ~(SEE_TURFS|BLIND)
user.visible_message(SPAN_WARNING("You hear something squeezing through the ducts."), "You climb out the ventilation system.")
user.vent_trap_check("arriving", target_move)
user.vent_trap_check("arriving", UA)
else if(target_move.can_crawl_through())
if(target_move.return_network(target_move) != return_network(src))
user.remove_ventcrawl()