Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie committed Sep 10, 2017
2 parents 527d044 + 29888bc commit 45ddcb3
Show file tree
Hide file tree
Showing 33 changed files with 295 additions and 144 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ the new version.
Hippie Station currently comes equipped with six maps.

* [Hippie BoxStation (default)](http://tgstation13.org/wiki/Boxstation)
* [BoxStation](http://tgstation13.org/wiki/Boxstation)
* [BoxStation (default)](http://tgstation13.org/wiki/Boxstation)
* [MetaStation](https://tgstation13.org/wiki/MetaStation)
* [DeltaStation](https://tgstation13.org/wiki/DeltaStation)
* [OmegaStation](https://tgstation13.org/wiki/OmegaStation)
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,8 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define SHELLEO_ERRORLEVEL 1
#define SHELLEO_STDOUT 2
#define SHELLEO_STDERR 3

//server security mode
#define SECURITY_SAFE 1
#define SECURITY_ULTRASAFE 2
#define SECURITY_TRUSTED 3
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
//to differentiate it, naturally everyone forgot about this immediately and so some things
//would bump twice, so now it's called Collide
/atom/movable/proc/Collide(atom/A)
if((A))
if(A)
if(throwing)
throwing.hit_atom(A)
. = 1
Expand Down
19 changes: 19 additions & 0 deletions code/game/world.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
GLOBAL_VAR(security_mode)
GLOBAL_PROTECT(security_mode)

/world/New()
log_world("World loaded at [time_stamp()]")

SetupExternalRSC()

GLOB.config_error_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = file("data/logs/config_error.log") //temporary file used to record errors with loading config, moved to log directory once logging is set bl

CheckSecurityMode()

make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)

config = new
Expand Down Expand Up @@ -95,6 +100,20 @@
if(GLOB.round_id)
log_game("Round ID: [GLOB.round_id]")

/world/proc/CheckSecurityMode()
//try to write to data
if(!text2file("The world is running at least safe mode", "data/server_security_check.lock"))
GLOB.security_mode = SECURITY_ULTRASAFE
warning("/tg/station 13 is not supported in ultrasafe security mode. Everything will break!")
return

//try to shell
if(shell("echo \"The world is running in trusted mode\"") != null)
GLOB.security_mode = SECURITY_TRUSTED
else
GLOB.security_mode = SECURITY_SAFE
warning("/tg/station 13 uses many file operations, a few shell()s, and some external call()s. Trusted mode is recommended. You can download our source code for your own browsing and compilation at https://github.com/tgstation/tgstation")

/world/Topic(T, addr, master, key)
var/list/input = params2list(T)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/datum/admins/proc/CheckAdminHref(href, href_list)
var/auth = href_list["admin_token"]
. = auth && auth != href_token && auth != GLOB.href_token
. = auth && (auth == href_token || auth == GLOB.href_token)
if(.)
return
var/msg = !auth ? "no" : "a bad"
Expand Down
139 changes: 70 additions & 69 deletions code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,69 +142,55 @@
user.set_machine(src)
interact(user)

/*******************
* SmartFridge Menu
********************/

/obj/machinery/smartfridge/interact(mob/user)
if(stat)
return FALSE

var/dat = "<TT><b>Select an item:</b><br>"
/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "smartvend", name, 440, 550, master_ui, state)
ui.open()

if (contents.len == 0)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/listofitems = list()
for (var/atom/movable/O in contents)
if (listofitems[O.name])
listofitems[O.name]++
else
listofitems[O.name] = 1
sortList(listofitems)

for (var/O in listofitems)
if(listofitems[O] <= 0)
continue
var/N = listofitems[O]
var/itemName = url_encode(O)
dat += "<FONT color = 'blue'><B>[capitalize(O)]</B>:"
dat += " [N] </font>"
dat += "<a href='byond://?src=\ref[src];vend=[itemName];amount=1'>Vend</A> "
if(N > 5)
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=5'>x5</A>)"
if(N > 10)
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=10'>x10</A>)"
if(N > 25)
dat += "(<a href='byond://?src=\ref[src];vend=[itemName];amount=25'>x25</A>)"
if(N > 1)
dat += "(<a href='?src=\ref[src];vend=[itemName];amount=[N]'>All</A>)"

dat += "<br>"

dat += "</TT>"
user << browse("<HEAD><TITLE>[src] supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
onclose(user, "smartfridge")
return dat

/obj/machinery/smartfridge/Topic(var/href, var/list/href_list)
if(..())
return
usr.set_machine(src)
/obj/machinery/smartfridge/ui_data(mob/user)
. = list()

var/listofitems = list()
for (var/I in src)
var/atom/movable/O = I
if (listofitems[O.name])
listofitems[O.name]["amount"]++
else
listofitems[O.name] = list("name" = O.name, "type" = O.type, "amount" = 1)
sortList(listofitems)

.["contents"] = listofitems
.["name"] = name
.["isdryer"] = FALSE

var/N = href_list["vend"]
var/amount = text2num(href_list["amount"])

var/i = amount
for(var/obj/O in contents)
if(i <= 0)
break
if(O.name == N)
O.loc = src.loc
i--
/obj/machinery/smartfridge/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("Release")
var/desired = 0

if (params["amount"])
desired = text2num(params["amount"])
else
desired = input("How many items?", "How many items would you like to take out?", 1) as null|num

if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src)) // Sanity checkin' in case stupid stuff happens while we wait for input()
return FALSE

updateUsrDialog()
for(var/obj/item/O in src)
if(desired <= 0)
break
if(O.name == params["name"])
O.forceMove(drop_location())
desired--
return TRUE
return FALSE


// ----------------------------
Expand Down Expand Up @@ -240,20 +226,35 @@
/obj/machinery/smartfridge/drying_rack/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 1)
..()

/obj/machinery/smartfridge/drying_rack/interact(mob/user)
var/dat = ..()
if(dat)
dat += "<br>"
dat += "<a href='byond://?src=\ref[src];dry=1'>Toggle Drying</A> "
user << browse("<HEAD><TITLE>[src] supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
onclose(user, "smartfridge")
/obj/machinery/smartfridge/drying_rack/ui_data(mob/user)
. = list()

/obj/machinery/smartfridge/drying_rack/Topic(href, list/href_list)
..()
if(href_list["dry"])
toggle_drying(FALSE)
updateUsrDialog()
update_icon()
var/listofitems = list()
for (var/I in src)
var/atom/movable/O = I

if (listofitems[O.name])
listofitems[O.name]["amount"]++
else
listofitems[O.name] = list("name" = O.name, "type" = O.type, "amount" = 1)
sortList(listofitems)

.["contents"] = listofitems
.["name"] = name
.["isdryer"] = TRUE
.["verb"] = "Take"
.["drying"] = drying


/obj/machinery/smartfridge/drying_rack/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("Dry")
toggle_drying(FALSE)
return TRUE
return FALSE

/obj/machinery/smartfridge/drying_rack/power_change()
if(powered() && anchored)
Expand Down
16 changes: 7 additions & 9 deletions code/modules/holodeck/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,15 @@
else
..()

/obj/structure/holohoop/CanPass(atom/movable/mover, turf/target)
if (isitem(mover) && mover.throwing)
var/obj/item/I = mover
if(istype(I, /obj/item/projectile))
return
/obj/structure/holohoop/hitby(atom/movable/AM)
if (isitem(AM) && !istype(AM,/obj/item/projectile))
if(prob(50))
I.forceMove(get_turf(src))
visible_message("<span class='warning'>Swish! [I] lands in [src].</span>")
AM.forceMove(get_turf(src))
visible_message("<span class='warning'>Swish! [AM] lands in [src].</span>")
return
else
visible_message("<span class='danger'>[I] bounces off of [src]'s rim!</span>")
return 0
visible_message("<span class='danger'>[AM] bounces off of [src]'s rim!</span>")
return ..()
else
return ..()

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
. = ..()
for(var/datum/mutation/human/HM in dna.mutations)
HM.on_move(src, NewLoc)

if(shoes)
if(!lying && !buckled)
if(loc == NewLoc)
Expand Down Expand Up @@ -55,7 +56,6 @@
//End bloody footprints

S.step_action()

/mob/living/carbon/human/Moved()
. = ..()
if(buckled_mobs && buckled_mobs.len && riding_datum)
Expand Down
10 changes: 7 additions & 3 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@

var/datum/gas_mixture/breath

if(health <= HEALTH_THRESHOLD_CRIT || (pulledby && pulledby.grab_state >= GRAB_KILL && !getorganslot("breathing_tube")))
if(health <= HEALTH_THRESHOLD_FULLCRIT || (pulledby && pulledby.grab_state >= GRAB_KILL && !getorganslot("breathing_tube")))
losebreath++

else if(health <= HEALTH_THRESHOLD_CRIT)
losebreath += 0.25

//Suffocate
if(losebreath > 0)
losebreath--
if(prob(10))
emote("gasp")
if(istype(loc, /obj/))
Expand Down Expand Up @@ -108,7 +110,9 @@
if(!breath || (breath.total_moles() == 0) || !lungs)
if(reagents.has_reagent("epinephrine") && lungs)
return
adjustOxyLoss(1)
var/oxy_loss = min(losebreath, 1)
adjustOxyLoss(oxy_loss)
losebreath -= oxy_loss
failed_last_breath = 1
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
return 0
Expand Down
28 changes: 15 additions & 13 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
else
return 0

var/old_direction = dir
var/atom/movable/pullee = pulling
if(pullee && get_dist(src, pullee) > 1)
stop_pulling()
Expand All @@ -444,10 +445,6 @@

var/pull_dir = get_dir(src, pulling)
if(get_dist(src, pulling) > 1 || ((pull_dir - 1) & pull_dir)) //puller and pullee more than one tile away or in diagonal position
if(isliving(pulling))
var/mob/living/M = pulling
if(M.lying && !M.buckled && (prob(M.getBruteLoss()*200/M.maxHealth)))
M.makeTrail(T)
pulling.Move(T, get_dir(pulling, T)) //the pullee tries to reach our previous position
if(pulling && get_dist(src, pulling) > 1) //the pullee couldn't keep up
stop_pulling()
Expand All @@ -458,6 +455,10 @@
if (s_active && !(CanReach(s_active,view_only = TRUE)))
s_active.close(src)

if(lying && !buckled && prob(getBruteLoss()*200/maxHealth))

makeTrail(newloc, T, old_direction)

/mob/living/movement_delay(ignorewalk = 0)
. = ..()
if(isopenturf(loc) && !is_flying())
Expand All @@ -474,31 +475,32 @@
if(MOVE_INTENT_WALK)
. += config.walk_speed

/mob/living/proc/makeTrail(turf/target_turf)
/mob/living/proc/makeTrail(turf/target_turf, turf/start, direction)
if(!has_gravity())
return
var/blood_exists = FALSE

for(var/obj/effect/decal/cleanable/trail_holder/C in loc) //checks for blood splatter already on the floor
for(var/obj/effect/decal/cleanable/trail_holder/C in start) //checks for blood splatter already on the floor
blood_exists = TRUE
if(isturf(loc))
if(isturf(start))
var/trail_type = getTrail()
if(trail_type)
var/brute_ratio = round(getBruteLoss() / maxHealth, 0.1)
if(blood_volume && blood_volume > max(BLOOD_VOLUME_NORMAL*(1 - brute_ratio * 0.25), 0))//don't leave trail if blood volume below a threshold
blood_volume = max(blood_volume - max(1, brute_ratio * 2), 0) //that depends on our brute damage.
var/newdir = get_dir(target_turf, loc)
if(newdir != dir)
newdir = newdir | dir
var/newdir = get_dir(target_turf, start)
if(newdir != direction)
newdir = newdir | direction
if(newdir == 3) //N + S
newdir = NORTH
else if(newdir == 12) //E + W
newdir = EAST
if((newdir in GLOB.cardinals) && (prob(50)))
newdir = turn(get_dir(target_turf, loc), 180)
newdir = turn(get_dir(target_turf, start), 180)
if(!blood_exists)
new /obj/effect/decal/cleanable/trail_holder(loc)
for(var/obj/effect/decal/cleanable/trail_holder/TH in loc)
new /obj/effect/decal/cleanable/trail_holder(start)

for(var/obj/effect/decal/cleanable/trail_holder/TH in start)
if((!(newdir in TH.existing_dirs) || trail_type == "trails_1" || trail_type == "trails_2") && TH.existing_dirs.len <= 16) //maximum amount of overlays is 16 (all light & heavy directions filled)
TH.existing_dirs += newdir
TH.add_overlay(image('icons/effects/blood.dmi', trail_type, dir = newdir))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@
var/turf/T = get_turf(client.eye)
stat("Location:", COORD(T))
stat("CPU:", "[world.cpu]")
stat("Instances:", "[world.contents.len]")
stat("Instances:", "[num2text(world.contents.len, 10)]")
GLOB.stat_entry()
config.stat_entry()
stat(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
glass_desc = "Aromatic beverage served piping hot. According to folk tales it can almost wake the dead."

/datum/reagent/consumable/ethanol/hearty_punch/on_mob_life(mob/living/M)
if(M.stat == UNCONSCIOUS && M.health <= 0)
if(M.health <= 0)
M.adjustBruteLoss(-7, 0)
M.adjustFireLoss(-7, 0)
M.adjustToxLoss(-7, 0)
Expand Down
Loading

0 comments on commit 45ddcb3

Please sign in to comment.