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

[WIP] Roombas are coming... Add Roombas as Playable Ghost Role. #6812

Closed
Closed
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
2 changes: 2 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
#define MUTINEER (1<<4) // Part of the Mutiny Gang
#define GIVING (1<<5) // Is currently trying to give an item to someone
#define NOBIOSCAN (1<<6)
#define VACCUM_MODE_ON (1<<7) // allow roomba to suck items.
#define MOPPING_MODE_ON (1<<8) // allow roomba to clean floor.

//=================================================

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/typecheck/mobs_generic.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define isARES(A) (istype(A, /mob/living/silicon/decoy/ship_ai))
#define isSilicon(A) (istype(A, /mob/living/silicon))
#define isRemoteControlling(M) (M && M.client && M.client.remote_control)
#define isRobot (R) (istype(R, /mob/living/robot/roomba))

#define isbrain(A) (istype(A, /mob/living/brain))
#define isanimal(A) (istype(A, /mob/living/simple_animal))
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ DEFINE_BITFIELD(mob_flags, list(
"MUTINEER" = MUTINEER,
"GIVING" = GIVING,
"NOBIOSCAN" = NOBIOSCAN,
"VACCUM_MODE_ON" = VACCUM_MODE_ON
))

DEFINE_BITFIELD(mobility_flags, list(
Expand Down
153 changes: 153 additions & 0 deletions code/modules/mob/living/roomba.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/// A cheap little roomba that runs around and keeps ground clean to decrease maptick and marines always make fucking mess at fob.
/mob/living/roomba
name = "Roomba"
desc = "A robot vacuum cleaner. The roomba is designed to keep areas clean from dirty marines."
icon = 'icons/obj/structures/machinery/aibots.dmi'
icon_state = "roomba"
speed = 1
mob_size = MOB_SIZE_SMALL
health = 80
maxHealth = 80
var/vaccum = TRUE
var/mopping = TRUE
var/list/target_vaccum_types = list() //defines list for vaccum
var/list/target_mopping_types = list() //defines list for mopping

// --- Initializes anything you need on load, its essential for lists, action buttons, updating etc. ---

/mob/living/roomba/Initialize(mapload, ...)
. = ..()
src.get_vaccum_targets()
src.get_mopping_targets()
give_action(src, /datum/action/vaccum_toggle)
give_action(src, /datum/action/mopping_toggle)

// --- Every time you move to new tile it will check list of items to delete ---

/mob/living/roomba/Move(NewLoc, direct)
. = ..()
vaccum_suck()
mopping_floor()

// --- Action Button(s) ---

/datum/action/vaccum_toggle
name = "Vaccum Module"
action_icon_state = "recoil_compensation"

/datum/action/vaccum_toggle/give_to(mob/living/L)
..()
update_vaccum_skill()

/datum/action/vaccum_toggle/remove_from(/mob/living/roomba/A)
owner.mob_flags &= ~VACCUM_MODE_ON
..()

/datum/action/vaccum_toggle/proc/update_vaccum_skill()
if(!(owner.mob_flags & VACCUM_MODE_ON))
button.icon_state = "template_on"
owner.mob_flags |= VACCUM_MODE_ON

/datum/action/vaccum_toggle/action_activate()
. = ..()
var/mob/living/roomba/current_roomba = owner
if(owner.mob_flags & VACCUM_MODE_ON)
button.icon_state = "template"
owner.mob_flags &= ~VACCUM_MODE_ON
current_roomba.vaccum = FALSE
to_chat(owner, "You deactivate vaccum module.")
else
button.icon_state = "template_on"
owner.mob_flags |= VACCUM_MODE_ON
current_roomba.vaccum = TRUE
to_chat(owner, "You activate vaccum module.")

/datum/action/mopping_toggle
name = "Mopping Module"
action_icon_state = "vulture_tripod_close"

/datum/action/mopping_toggle/give_to(mob/living/L)
..()
update_mopping_skill()

/datum/action/mopping_toggle/remove_from(/mob/living/roomba/B)
owner.mob_flags &= ~MOPPING_MODE_ON
..()

/datum/action/mopping_toggle/proc/update_mopping_skill()
if(!(owner.mob_flags & MOPPING_MODE_ON))
button.icon_state = "template_on"
owner.mob_flags |= MOPPING_MODE_ON

/datum/action/mopping_toggle/action_activate()
. = ..()
var/mob/living/roomba/current_roomba = owner
if(owner.mob_flags & MOPPING_MODE_ON)
button.icon_state = "template"
owner.mob_flags &= ~MOPPING_MODE_ON
current_roomba.mopping = FALSE
to_chat(owner, "You deactivate mopping module.")
else
button.icon_state = "template_on"
owner.mob_flags |= MOPPING_MODE_ON
current_roomba.mopping = TRUE
to_chat(owner, "You activate mopping module.")

// --- Flags for mob ---

/mob/living/roomba/initialize_pass_flags(datum/pass_flags_container/PF)
..()
if (pass_flags)
pass_flags.flags_pass = PASS_MOB_THRU|PASS_FLAGS_CRAWLER
pass_flags.flags_can_pass_all = PASS_ALL^PASS_OVER_THROW_ITEM

// --- Existence of life and death ---

/mob/living/roomba/Life()
if(health <= 0)
death()
. = ..()

/mob/living/roomba/spawn_gibs()
robogibs(loc)

/mob/living/roomba/handle_regular_status_updates()
updatehealth()

// --- Handles vaccum and mopping "logic" for "cleaning" list ---

/mob/living/roomba/proc/vaccum_suck()
if(vaccum == FALSE)
return
else
for(var/atom/possible_trash in loc)
for(var/trash in src.target_vaccum_types)
if(possible_trash.type == trash)
qdel(possible_trash)

/mob/living/roomba/proc/mopping_floor()
if(mopping == FALSE)
return
else
for(var/atom/possible_trash in loc)
for(var/trash in src.target_mopping_types)
if(possible_trash.type == trash)
qdel(possible_trash)

// --- List of items it should "clean" ---

/mob/living/roomba/proc/get_vaccum_targets()
src.target_vaccum_types = new/list()

target_vaccum_types += /obj/item/trash/uscm_mre
target_vaccum_types += /obj/item/storage/box/MRE

/mob/living/roomba/proc/get_mopping_targets()
src.target_mopping_types = new/list()

target_mopping_types += /obj/effect/decal/cleanable/blood/oil
target_mopping_types += /obj/effect/decal/cleanable/vomit
target_mopping_types += /obj/effect/decal/cleanable/crayon
target_mopping_types += /obj/effect/decal/cleanable/liquid_fuel
target_mopping_types += /obj/effect/decal/cleanable/mucus
target_mopping_types += /obj/effect/decal/cleanable/dirt
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,7 @@
#include "code\modules\mob\living\living_verbs.dm"
#include "code\modules\mob\living\login.dm"
#include "code\modules\mob\living\logout.dm"
#include "code\modules\mob\living\roomba.dm"
#include "code\modules\mob\living\say.dm"
#include "code\modules\mob\living\brain\brain.dm"
#include "code\modules\mob\living\brain\brain_item.dm"
Expand Down
Binary file modified icons/obj/structures/machinery/aibots.dmi
Binary file not shown.
6 changes: 5 additions & 1 deletion maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -66444,6 +66444,10 @@
},
/turf/open/floor/almayer/plating/northeast,
/area/almayer/engineering/lower/engine_core)
"xqf" = (
/mob/living/roomba,
/turf/open/floor/almayer,
/area/almayer/squads/alpha_bravo_shared)
"xqh" = (
/obj/structure/surface/table/almayer,
/obj/item/tool/weldingtool,
Expand Down Expand Up @@ -107048,7 +107052,7 @@ obE
thA
qGc
rth
rth
xqf
rth
aTW
aTW
Expand Down
Loading