Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Сегвеи на станции #157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
do_animate("deny")
return

if(istype(AM, /obj/vehicle))
var/obj/vehicle/V = AM
if(density)
if(V.airlock_automatic_opening && V.load && (src.allowed(V.load) || emergency))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src. здесь может быть чутка лишним.

open()
else
do_animate("deny")
return


if(istype(AM, /obj/structure/stool/bed/chair/wheelchair))
var/obj/structure/stool/bed/chair/wheelchair/wheel = AM
if(density)
Expand Down
9 changes: 9 additions & 0 deletions code/modules/research/designs/mechfabricator_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -908,3 +908,12 @@
materials = list(MAT_METAL=500)
construction_time = 50
category = list("Misc")

/datum/design/segway_common
name = "Segway"
id = "segway_common"
build_type = MECHFAB
build_path =/obj/vehicle/segway
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(!)Куда-то пропавший пробел.

materials = list(MAT_METAL=35000, MAT_GLASS=2500)
construction_time = 80
category = list("Misc")
121 changes: 121 additions & 0 deletions code/modules/vehicles/segway.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/obj/vehicle/segway
name = "segway"
desc = "two-wheeled vehicle of fashion, WOAH!"
icon_state = "segway"
dir = SOUTH

load_item_visible = 1
mob_offset_y = 5
health = 100
maxhealth = 100
on = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on может получать значения, отличные от 1 и 0? Если нет, то почему это не оформлено под булевую переменную?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Потому что так решили кодеры прошлого, вооот. Не хочется в код шпессбайков лезть

can_pull = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Читать комментарий выше.

anchored = 0
Hakasolo marked this conversation as resolved.
Show resolved Hide resolved
layer = MOB_LAYER + 2
Hakasolo marked this conversation as resolved.
Show resolved Hide resolved
airlock_automatic_opening = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Булевая переменная маскирующаяся под целочисленное.


fire_dam_coeff = 0.75
brute_dam_coeff = 0.65
var/protection_percent = 60

var/land_speed = 1.5
var/space_speed = 0

var/step_energy_drain = 5
var/obj/item/weapon/stock_parts/cell/powercell = null

/obj/vehicle/segway/load(mob/living/M)
if(!istype(M))
return FALSE
if(M.buckled || M.incapacitated() || M.lying || !Adjacent(M) || !M.Adjacent(src))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А возможно ли что моб впритык к сегвею, а сегвей к мобу - нет?

return FALSE
. = ..()
if( . )
M.layer = layer - 0.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может конфликтовать.

return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ого это выход из функции в конце функции?


/obj/vehicle/segway/MouseDrop_T(mob/living/M, mob/living/user)
if(!istype(user, /mob/living/carbon/human) || !istype(M, /mob/living/carbon/human))
return
if(isessence(user))
return
if(user.incapacitated() || user.lying)
return
if(!load(M))
to_chat(user, "<span class='warning'>You were unable to load \the [M] onto \the [src].</span>")
return

/obj/vehicle/segway/atom_init()
. = ..()
overlays += image('icons/obj/vehicles.dmi', "[icon_state]_overlay", MOB_LAYER + 1)
turn_off()

/obj/vehicle/segway/relaymove(mob/user, direction)
if(user.stat || user.stunned || user.weakened || user.paralysis)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user.incapacitated() anyone?

unload(user)
return
if(open || !(powercell && powercell.charge >= step_energy_drain))
return

. = Move(get_step(src, direction))
if(.)
powercell.charge = max(0, powercell.charge - step_energy_drain)
user.dir = dir

/obj/vehicle/segway/Move(var/turf/destination)
if(istype(destination,/turf/space))
if(!space_speed)
return 0
move_delay = space_speed + slow_cooef
else
if(!land_speed)
return 0
move_delay = land_speed + slow_cooef
return ..()

/obj/vehicle/segway/attack_hand(mob/user)
if(!load)
return
user.SetNextMove(CLICK_CD_MELEE)
if(load != user)
if(do_after(user, 20, target=src))
load.visible_message(\
"<span class='notice'>[load.name] was unbuckled by [user.name]!</span>",\
"<span class='warning'>You were unbuckled from [src] by [user.name].</span>",\
"<span class='notice'>You hear metal clanking.</span>")
unload(load)
else
load.visible_message(\
"<span class='notice'>[load.name] unbuckled \himself!</span>",\
"<span class='notice'>You unbuckle yourself from [src].</span>",\
"<span class='notice'>You hear metal clanking.</span>")
unload(load)

/obj/vehicle/segway/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/stock_parts/cell) && !powercell && open)
user.drop_item()
W.forceMove(src)
powercell = W
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я пока не нашёл дестрой прока который бы чистил ссылку, и удалял саму батарейку по ссылке.

user.visible_message("[user] inserts a cell into the [name].", "You insert a cell into the [name].")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему бы не писать полное название батарейки? А то вдруг это какая-то кастомная супер блюспейс батарейка.

turn_on()
return
if(istype(W, /obj/item/weapon/crowbar))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if.

if(open && powercell)
powercell.forceMove(loc)
powercell = null
user.visible_message("[user] removes the cell from the [name].", "You remove the cell from the [name].")
turn_off()
return
return ..()

/obj/vehicle/segway/examine(mob/user)
..()
to_chat(user, " [open ? "Maintenance panel is open. " : "Maintenance panel is closed. "] [ open && !powercell ? "Powercell is missing. " : "" ]")

/obj/vehicle/segway/turn_on()
light_power = 3
return ..()

/obj/vehicle/segway/turn_off()
light_power = 0
..()
5 changes: 3 additions & 2 deletions code/modules/vehicles/vehicle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
var/stat = 0
var/move_delay = 1 //set this to limit the speed of the vehicle
var/slow_cooef = 0
var/can_pull = 0

var/atom/movable/load //all vehicles can take a load, since they should all be a least drivable
var/load_item_visible = 1 //set if the loaded item should be overlayed on the vehicle sprite
var/load_offset_x = 0 //pixel_x offset for item overlay
var/load_offset_y = 0 //pixel_y offset for item overlay
var/mob_offset_y = 0 //pixel_y offset for mob overlay
var/airlock_automatic_opening = 0 //set this 1 if you want airlocks to open(or not open) when you bump into them

//-------------------------------------------
// Standard procs
Expand All @@ -54,15 +56,14 @@
//See load_object() proc in cargo_trains.dm for an example
if(load && !istype(load, /datum/vehicle_dummy_load))
load.Move(loc, dir)

return 1
else
return 0

/obj/vehicle/proc/can_move()
if(world.time <= l_move_time + move_delay)
return 0
if(!on)
if(!on && !can_pull)
return 0
if(istype(loc, /turf/space) && !istype(src, /obj/vehicle/space))
return 0
Expand Down
Binary file modified icons/obj/vehicles.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions taucetistation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@
#include "code\modules\telesci\telepad.dm"
#include "code\modules\telesci\telesci_computer.dm"
#include "code\modules\tooltip\tooltip.dm"
#include "code\modules\vehicles\segway.dm"
#include "code\modules\vehicles\spacebike.dm"
#include "code\modules\vehicles\vehicle.dm"
#include "code\modules\ventcrawl\ventcrawl.dm"
Expand Down