fix up some 515+516 compiler issues

This commit is contained in:
Spookerton
2025-07-09 16:51:48 +01:00
parent 4f97866d65
commit 3243478f57
4 changed files with 76 additions and 68 deletions

View File

@@ -172,9 +172,6 @@ Turf and target are separate in case you want to teleport some distance from a t
return 1 return 1
return 0 return 0
/proc/sign(x)
return x!=0?x/abs(x):0
/proc/getline(atom/M,atom/N)//Ultra-Fast Bresenham Line-Drawing Algorithm /proc/getline(atom/M,atom/N)//Ultra-Fast Bresenham Line-Drawing Algorithm
var/px=M.x //starting x var/px=M.x //starting x
var/py=M.y var/py=M.y
@@ -183,8 +180,8 @@ Turf and target are separate in case you want to teleport some distance from a t
var/dy=N.y-py var/dy=N.y-py
var/dxabs=abs(dx)//Absolute value of x distance var/dxabs=abs(dx)//Absolute value of x distance
var/dyabs=abs(dy) var/dyabs=abs(dy)
var/sdx=sign(dx) //Sign of x distance (+ or -) var/sdx=SIGN(dx) //Sign of x distance (+ or -)
var/sdy=sign(dy) var/sdy=SIGN(dy)
var/x=dxabs>>1 //Counters for steps taken, setting to distance/2 var/x=dxabs>>1 //Counters for steps taken, setting to distance/2
var/y=dyabs>>1 //Bit-shifting makes me l33t. It also makes getline() unnessecarrily fast. var/y=dyabs>>1 //Bit-shifting makes me l33t. It also makes getline() unnessecarrily fast.
var/j //Generic integer for counting var/j //Generic integer for counting

View File

@@ -29,10 +29,10 @@
error("Invalid hook '/hook/[hook]' called.") error("Invalid hook '/hook/[hook]' called.")
return 0 return 0
var/caller = new hook_path var/hook/instance = new hook_path
var/status = 1 var/status = 1
for(var/P in typesof("[hook_path]/proc")) for(var/P in typesof("[hook_path]/proc"))
if(!call(caller, P)(arglist(args))) if(!call(instance, P)(arglist(args)))
error("Hook '[P]' failed or runtimed.") error("Hook '[P]' failed or runtimed.")
status = 0 status = 0

View File

@@ -161,90 +161,101 @@ LINEN BINS
icon_state = "doublesheetian" icon_state = "doublesheetian"
item_state = "sheetian" item_state = "sheetian"
/obj/structure/bedsheetbin /obj/structure/bedsheetbin
name = "linen bin" name = "linen bin"
desc = "A linen bin. It looks rather cosy." desc = "A linen bin. It looks rather cosy."
icon = 'icons/obj/structures.dmi' icon = 'icons/obj/structures.dmi'
icon_state = "linenbin-full" icon_state = "linenbin-full"
anchored = 1 anchored = TRUE
var/amount = 20 var/max_amount = 10
var/min_amount
var/amount
var/list/sheets = list() var/list/sheets = list()
var/obj/item/hidden = null var/obj/item/hidden
/obj/structure/bedsheetbin/Destroy()
QDEL_NULL_LIST(sheets)
QDEL_NULL(hidden)
return ..()
/obj/structure/bedsheetbin/Initialize()
. = ..()
amount = max_amount
/obj/structure/bedsheetbin/examine(mob/user, distance, infix, suffix) /obj/structure/bedsheetbin/examine(mob/user, distance, infix, suffix)
. = ..() . = ..()
if (amount < 1)
if(amount < 1)
. += "There are no bed sheets in the bin." . += "There are no bed sheets in the bin."
else if(amount == 1) else if (amount == 1)
. += "There is one bed sheet in the bin." . += "There is one bed sheet in the bin."
else else
. += "There are [amount] bed sheets in the bin." . += "There are [amount] bed sheets in the bin."
/obj/structure/bedsheetbin/update_icon() /obj/structure/bedsheetbin/update_icon()
switch(amount) var/scale = clamp((amount / max_amount) * 100, 0, 100)
if(0) icon_state = "linenbin-empty" switch (scale)
if(1 to amount / 2) icon_state = "linenbin-half" if (0)
else icon_state = "linenbin-full" icon_state = "linenbin-empty"
if (1 to 50)
icon_state = "linenbin-half"
else
icon_state = "linenbin-full"
/obj/structure/bedsheetbin/attackby(obj/item/I as obj, mob/user as mob) /obj/structure/bedsheetbin/attackby(obj/item/item, mob/living/user)
if(istype(I, /obj/item/bedsheet)) if (istype(item, /obj/item/bedsheet))
user.drop_item() user.drop_item()
I.loc = src item.loc = src
sheets.Add(I) sheets += item
amount++ amount++
to_chat(user, "<span class='notice'>You put [I] in [src].</span>") to_chat(user, "<span class='notice'>You put [item] in [src].</span>")
else if(amount && !hidden && I.w_class < ITEMSIZE_LARGE) //make sure there's sheets to hide it among, make sure nothing else is hidden in there. else if (amount && !hidden && item.w_class < ITEMSIZE_LARGE)
user.drop_item() user.drop_item()
I.loc = src item.loc = src
hidden = I hidden = item
to_chat(user, "<span class='notice'>You hide [I] among the sheets.</span>") to_chat(user, "<span class='notice'>You hide [item] among the sheets.</span>")
/obj/structure/bedsheetbin/attack_hand(mob/user as mob)
if(amount >= 1)
amount--
var/obj/item/bedsheet/B
if(sheets.len > 0)
B = sheets[sheets.len]
sheets.Remove(B)
else
B = new /obj/item/bedsheet(loc)
B.loc = user.loc
user.put_in_hands(B)
to_chat(user, "<span class='notice'>You take [B] out of [src].</span>")
if(hidden)
hidden.loc = user.loc
to_chat(user, "<span class='notice'>[hidden] falls out of [B]!</span>")
hidden = null
/obj/structure/bedsheetbin/attack_hand(mob/living/user)
if(amount < 1)
return
add_fingerprint(user) add_fingerprint(user)
amount--
/obj/structure/bedsheetbin/attack_tk(mob/user as mob) var/obj/item/bedsheet/sheet = length(sheets)
if(amount >= 1) if (sheet)
amount-- sheet = sheets[sheet]
--sheets.len
var/obj/item/bedsheet/B else
if(sheets.len > 0) sheet = new /obj/item/bedsheet
B = sheets[sheets.len] user.put_in_hands(sheet)
sheets.Remove(B) to_chat(user, "<span class='notice'>You take [sheet] out of [src].</span>")
if (hidden)
else hidden.dropInto(loc)
B = new /obj/item/bedsheet(loc) hidden = null
to_chat(user, "<span class='notice'>[hidden] falls out of [src]!</span>")
B.loc = loc update_icon()
to_chat(user, "<span class='notice'>You telekinetically remove [B] from [src].</span>")
update_icon()
if(hidden)
hidden.loc = loc
hidden = null
/obj/structure/bedsheetbin/attack_tk(mob/living/user)
if(amount < 1)
return
add_fingerprint(user) add_fingerprint(user)
amount--
var/obj/item/bedsheet/sheet = length(sheets)
if (sheet)
sheet = sheets[sheet]
--sheets.len
else
sheet = new /obj/item/bedsheet
sheet.dropInto(loc)
to_chat(user, "<span class='notice'>You telekinetically remove [sheet] from [src].</span>")
if (hidden)
hidden.dropInto(loc)
hidden = null
to_chat(user, "<span class='notice'>[hidden] falls out of [src]!</span>")
update_icon()

View File

@@ -236,7 +236,7 @@
src.healths.icon_state = "health3" src.healths.icon_state = "health3"
if(0 to 50) if(0 to 50)
src.healths.icon_state = "health4" src.healths.icon_state = "health4"
if(config.health_threshold_dead to 0) if(-100 to 0)
src.healths.icon_state = "health5" src.healths.icon_state = "health5"
else else
src.healths.icon_state = "health6" src.healths.icon_state = "health6"