/
githubmirror
/
vgstation13
Обзор
Документация
Войти
/
githubmirror
/
vgstation13
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Bleeding-Edge
code/game/objects/structures/ladders.dm
141 строка
4 KB
mentgah
Custom sounds for ladders (#37511)
06 май 2025, 21:46
Не верифицирован
06 май 2025, 21:46
135642c
Код
Авторство
О чём код?
var/list/ladders = list() /obj/structure/ladder name = "ladder" desc = "A sturdy metal ladder." icon = 'icons/obj/structures.dmi' icon_state = "ladder11" anchored = 1 var/custom_message_up = "" var/custom_message_down = "" var/custom_message_others_up = "" var/custom_message_others_down = "" var/custom_upanddown = "" var/custom_upanddown_up = "" var/custom_upanddown_down = "" var/custom_sound = null var/id = null var/height = 0 //the 'height' of the ladder. higher numbers are considered physically higher var/obj/structure/ladder/down = null //the ladder below this one var/obj/structure/ladder/up = null //the ladder above this one /obj/structure/ladder/New() ..() ladders.Add(src) spawn(10) update_links() /obj/structure/ladder/spawned_by_map_element(datum/map_element/ME, list/objects) ..() update_links() /obj/structure/ladder/variable_edited(variable_name, old_value, new_value) ..() switch(variable_name) if("down", "up", "height", "id") spawn() update_links() /obj/structure/ladder/Destroy() ..() for(var/obj/structure/ladder/L in ladders) L.update_links() ladders.Remove(src) /obj/structure/ladder/proc/update_links() for(var/obj/structure/ladder/L in ladders) if(L == src) continue if(!isturf(L.loc)) continue //Only link to existing ladders if(L.id == id) if(L.height == (height - 1)) src.down = L L.up = src else if(L.height == (height + 1)) src.up = L L.down = src if(up && down) //if both our connections are filled break if(down && !isturf(down.loc)) //Remove connections to ladders that no longer exist down = null if(up && !isturf(up.loc)) up = null update_icon() /obj/structure/ladder/update_icon() if(up && down) icon_state = "ladder11" else if(up) icon_state = "ladder10" else if(down) icon_state = "ladder01" else //wtf make your ladders properly assholes icon_state = "ladder00" /obj/structure/ladder/proc/go_up(mob/user) user.visible_message("<span class='notice'>[user] [custom_message_others_up? custom_message_others_up : "climbs up the ladder!"]</span>", \ "<span class='notice'>You [custom_message_up? custom_message_up : "climb up the ladder!"]</span>") climb(user, get_turf(up)) up.add_fingerprint(user) /obj/structure/ladder/proc/go_down(mob/user) user.visible_message("<span class='notice'>[user] [custom_message_others_down? custom_message_others_down : "climbs down the ladder!"]</span>", \ "<span class='notice'>You [custom_message_down? custom_message_down : "climb down the ladder!"]</span>") climb(user, get_turf(down)) down.add_fingerprint(user) /obj/structure/ladder/attack_hand(mob/user) if(up && down) var/choice = alert("[custom_upanddown?custom_upanddown : "Go up or down the ladder?"]", "[src]", "[custom_upanddown_up?custom_upanddown_up : "Up"]", "[custom_upanddown_down?custom_upanddown_down : "Down"]", "Cancel") if(choice == "[custom_upanddown_up]" || choice == "Up") go_up(user) if(choice == "[custom_upanddown_down]" || choice == "Down") go_down(user) if(choice == "Cancel") return else if(up) go_up(user) else if(down) go_down(user) else to_chat(user, "<span class='notice'>This [src] is broken!</span>") add_fingerprint(user) /obj/structure/ladder/attack_paw(mob/user as mob) return attack_hand(user) /obj/structure/ladder/attackby(obj/item/weapon/W, mob/user as mob) if(isrobot(user)) return return attack_hand(user) /obj/structure/ladder/attack_slime(mob/user) return attack_hand(user) /obj/structure/ladder/proc/climb(mob/user, turf/destination) if (custom_sound) playsound(src, custom_sound, 100, 0) user.forceMove(destination) for(var/obj/item/weapon/grab/G in user.held_items) if(G.affecting) G.affecting.forceMove(destination) /obj/structure/ladder/attack_ghost(mob/user) return attack_hand(user)